From a74a1877a53b2ff5019ef32db6f75f164557fa57 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 14 Jan 2021 02:29:20 +0000 Subject: [PATCH] CodeGen from PR 12393 in Azure/azure-rest-api-specs Batch update 2021 01 01.13.0 - Resource Manager only (#12393) * Copy from previous version (2020-09-01) for comparison. * New version (2021-01-01.13.0). * Removed data plane. --- eng/versioning/version_client.txt | 1 + .../azure-resourcemanager-batch/CHANGELOG.md | 5 + .../azure-resourcemanager-batch/README.md | 83 + sdk/batch/azure-resourcemanager-batch/pom.xml | 62 + .../resourcemanager/batch/BatchManager.java | 297 +++ .../fluent/ApplicationPackagesClient.java | 200 ++ .../batch/fluent/ApplicationsClient.java | 175 ++ .../batch/fluent/BatchAccountsClient.java | 344 +++ .../batch/fluent/BatchManagement.java | 109 + .../batch/fluent/CertificatesClient.java | 283 +++ .../batch/fluent/LocationsClient.java | 70 + .../batch/fluent/OperationsClient.java | 36 + .../batch/fluent/PoolsClient.java | 295 +++ .../PrivateEndpointConnectionsClient.java | 200 ++ .../fluent/PrivateLinkResourcesClient.java | 74 + .../batch/fluent/models/ApplicationInner.java | 127 ++ .../models/ApplicationPackageInner.java | 120 + .../fluent/models/BatchAccountInner.java | 333 +++ .../fluent/models/BatchAccountKeysInner.java | 69 + .../models/BatchLocationQuotaInner.java | 41 + .../batch/fluent/models/CertificateInner.java | 224 ++ .../CheckNameAvailabilityResultInner.java | 75 + .../batch/fluent/models/OperationInner.java | 132 ++ .../batch/fluent/models/PoolInner.java | 759 +++++++ .../PrivateEndpointConnectionInner.java | 122 + .../models/PrivateLinkResourceInner.java | 90 + .../batch/fluent/models/package-info.java | 6 + .../batch/fluent/package-info.java | 6 + .../batch/implementation/ApplicationImpl.java | 157 ++ .../ApplicationPackageImpl.java | 131 ++ .../ApplicationPackagesClientImpl.java | 1286 +++++++++++ .../ApplicationPackagesImpl.java | 266 +++ .../ApplicationsClientImpl.java | 1157 ++++++++++ .../implementation/ApplicationsImpl.java | 191 ++ .../implementation/BatchAccountImpl.java | 309 +++ .../implementation/BatchAccountKeysImpl.java | 40 + .../BatchAccountsClientImpl.java | 1989 +++++++++++++++++ .../implementation/BatchAccountsImpl.java | 231 ++ .../BatchLocationQuotaImpl.java | 32 + .../BatchManagementBuilder.java | 147 ++ .../implementation/BatchManagementImpl.java | 406 ++++ .../batch/implementation/CertificateImpl.java | 271 +++ .../CertificatesClientImpl.java | 1661 ++++++++++++++ .../implementation/CertificatesImpl.java | 221 ++ .../CheckNameAvailabilityResultImpl.java | 41 + .../implementation/LocationsClientImpl.java | 371 +++ .../batch/implementation/LocationsImpl.java | 87 + .../batch/implementation/OperationImpl.java | 45 + .../implementation/OperationsClientImpl.java | 269 +++ .../batch/implementation/OperationsImpl.java | 46 + .../batch/implementation/PoolImpl.java | 406 ++++ .../batch/implementation/PoolsClientImpl.java | 1787 +++++++++++++++ .../batch/implementation/PoolsImpl.java | 245 ++ .../PrivateEndpointConnectionImpl.java | 59 + .../PrivateEndpointConnectionsClientImpl.java | 1026 +++++++++ .../PrivateEndpointConnectionsImpl.java | 128 ++ .../PrivateLinkResourceImpl.java | 68 + .../PrivateLinkResourcesClientImpl.java | 552 +++++ .../PrivateLinkResourcesImpl.java | 76 + .../batch/implementation/Utils.java | 67 + .../batch/implementation/package-info.java | 6 + .../batch/models/AccountKeyType.java | 47 + .../ActivateApplicationPackageParameters.java | 56 + .../batch/models/AllocationState.java | 50 + .../batch/models/Application.java | 224 ++ .../batch/models/ApplicationPackage.java | 139 ++ .../models/ApplicationPackageReference.java | 92 + .../batch/models/ApplicationPackages.java | 197 ++ .../batch/models/Applications.java | 146 ++ .../batch/models/AutoScaleRun.java | 114 + .../batch/models/AutoScaleRunError.java | 122 + .../batch/models/AutoScaleSettings.java | 82 + .../models/AutoStorageBaseProperties.java | 57 + .../batch/models/AutoStorageProperties.java | 67 + .../batch/models/AutoUserScope.java | 47 + .../batch/models/AutoUserSpecification.java | 87 + .../AzureBlobFileSystemConfiguration.java | 203 ++ .../models/AzureFileShareConfiguration.java | 181 ++ .../batch/models/BatchAccount.java | 427 ++++ .../models/BatchAccountCreateParameters.java | 267 +++ .../batch/models/BatchAccountIdentity.java | 136 ++ ...AccountIdentityUserAssignedIdentities.java | 54 + .../batch/models/BatchAccountKeys.java | 38 + .../batch/models/BatchAccountListResult.java | 81 + .../BatchAccountRegenerateKeyParameters.java | 56 + .../models/BatchAccountUpdateParameters.java | 146 ++ .../batch/models/BatchAccounts.java | 239 ++ .../models/BatchAccountsCreateHeaders.java | 76 + .../models/BatchAccountsCreateResponse.java | 37 + .../models/BatchAccountsDeleteHeaders.java | 76 + .../models/BatchAccountsDeleteResponse.java | 26 + .../batch/models/BatchLocationQuota.java | 25 + .../batch/models/BatchPoolIdentity.java | 102 + ...tchPoolIdentityUserAssignedIdentities.java | 54 + .../batch/models/CachingType.java | 50 + .../batch/models/Certificate.java | 353 +++ .../models/CertificateBaseProperties.java | 106 + .../CertificateCreateOrUpdateParameters.java | 176 ++ .../CertificateCreateOrUpdateProperties.java | 105 + .../batch/models/CertificateFormat.java | 47 + .../batch/models/CertificateProperties.java | 144 ++ .../models/CertificateProvisioningState.java | 50 + .../batch/models/CertificateReference.java | 175 ++ .../models/CertificateStoreLocation.java | 47 + .../batch/models/CertificateVisibility.java | 50 + .../batch/models/Certificates.java | 195 ++ .../CertificatesCancelDeletionHeaders.java | 50 + .../CertificatesCancelDeletionResponse.java | 38 + .../models/CertificatesCreateHeaders.java | 50 + .../models/CertificatesCreateResponse.java | 37 + .../models/CertificatesDeleteHeaders.java | 76 + .../models/CertificatesDeleteResponse.java | 26 + .../batch/models/CertificatesGetHeaders.java | 50 + .../batch/models/CertificatesGetResponse.java | 37 + .../models/CertificatesUpdateHeaders.java | 50 + .../models/CertificatesUpdateResponse.java | 37 + .../CheckNameAvailabilityParameters.java | 87 + .../models/CheckNameAvailabilityResult.java | 40 + .../batch/models/CifsMountConfiguration.java | 178 ++ .../models/CloudServiceConfiguration.java | 98 + .../models/ComputeNodeDeallocationOption.java | 53 + .../batch/models/ComputeNodeFillType.java | 47 + .../batch/models/ContainerConfiguration.java | 120 + .../batch/models/ContainerRegistry.java | 112 + .../models/ContainerWorkingDirectory.java | 47 + .../batch/models/DataDisk.java | 166 ++ .../batch/models/DeleteCertificateError.java | 149 ++ .../batch/models/DeploymentConfiguration.java | 93 + .../models/DiskEncryptionConfiguration.java | 57 + .../batch/models/DiskEncryptionTarget.java | 47 + .../batch/models/ElevationLevel.java | 47 + .../batch/models/EncryptionProperties.java | 82 + .../batch/models/EnvironmentSetting.java | 81 + .../batch/models/FixedScaleSettings.java | 143 ++ .../batch/models/ImageReference.java | 170 ++ .../batch/models/InboundEndpointProtocol.java | 47 + .../batch/models/InboundNatPool.java | 233 ++ .../models/InterNodeCommunicationState.java | 47 + .../models/IpAddressProvisioningType.java | 50 + .../batch/models/KeySource.java | 47 + .../batch/models/KeyVaultProperties.java | 67 + .../batch/models/KeyVaultReference.java | 87 + .../batch/models/LinuxUserConfiguration.java | 123 + .../models/ListApplicationPackagesResult.java | 81 + .../batch/models/ListApplicationsResult.java | 81 + .../batch/models/ListCertificatesResult.java | 81 + .../batch/models/ListPoolsResult.java | 81 + .../ListPrivateEndpointConnectionsResult.java | 81 + .../ListPrivateLinkResourcesResult.java | 81 + .../batch/models/Locations.java | 60 + .../batch/models/LoginMode.java | 47 + .../batch/models/MetadataItem.java | 86 + .../batch/models/MountConfiguration.java | 141 ++ .../batch/models/NameAvailabilityReason.java | 47 + .../batch/models/NetworkConfiguration.java | 164 ++ .../models/NetworkSecurityGroupRule.java | 169 ++ .../NetworkSecurityGroupRuleAccess.java | 47 + .../batch/models/NfsMountConfiguration.java | 116 + .../models/NodePlacementConfiguration.java | 53 + .../batch/models/NodePlacementPolicyType.java | 47 + .../batch/models/Operation.java | 45 + .../batch/models/OperationDisplay.java | 128 ++ .../batch/models/OperationListResult.java | 84 + .../batch/models/Operations.java | 31 + .../batch/models/PackageState.java | 47 + .../resourcemanager/batch/models/Pool.java | 849 +++++++ .../batch/models/PoolAllocationMode.java | 47 + .../models/PoolEndpointConfiguration.java | 66 + .../batch/models/PoolIdentityType.java | 47 + .../batch/models/PoolProvisioningState.java | 47 + .../resourcemanager/batch/models/Pools.java | 219 ++ .../batch/models/PoolsCreateHeaders.java | 50 + .../batch/models/PoolsCreateResponse.java | 33 + .../batch/models/PoolsDeleteHeaders.java | 76 + .../batch/models/PoolsDeleteResponse.java | 26 + .../models/PoolsDisableAutoScaleHeaders.java | 50 + .../models/PoolsDisableAutoScaleResponse.java | 37 + .../batch/models/PoolsGetHeaders.java | 50 + .../batch/models/PoolsGetResponse.java | 33 + .../batch/models/PoolsStopResizeHeaders.java | 50 + .../batch/models/PoolsStopResizeResponse.java | 33 + .../batch/models/PoolsUpdateHeaders.java | 50 + .../batch/models/PoolsUpdateResponse.java | 33 + .../batch/models/PrivateEndpoint.java | 41 + .../models/PrivateEndpointConnection.java | 67 + ...teEndpointConnectionProvisioningState.java | 50 + .../models/PrivateEndpointConnections.java | 138 ++ .../batch/models/PrivateLinkResource.java | 68 + .../batch/models/PrivateLinkResources.java | 67 + .../PrivateLinkServiceConnectionState.java | 97 + .../PrivateLinkServiceConnectionStatus.java | 53 + .../batch/models/ProvisioningState.java | 59 + .../models/PublicIpAddressConfiguration.java | 88 + .../batch/models/PublicNetworkAccessType.java | 47 + .../batch/models/ResizeError.java | 122 + .../batch/models/ResizeOperationStatus.java | 199 ++ .../batch/models/ResourceFile.java | 245 ++ .../batch/models/ResourceIdentityType.java | 50 + .../batch/models/ScaleSettings.java | 92 + .../batch/models/StartTask.java | 282 +++ .../batch/models/StorageAccountType.java | 47 + .../batch/models/TaskContainerSettings.java | 146 ++ .../batch/models/TaskSchedulingPolicy.java | 56 + .../batch/models/UserAccount.java | 183 ++ .../batch/models/UserIdentity.java | 85 + .../batch/models/VMExtension.java | 261 +++ .../models/VirtualMachineConfiguration.java | 353 +++ .../models/VirtualMachineFamilyCoreQuota.java | 54 + .../batch/models/WindowsConfiguration.java | 50 + .../models/WindowsUserConfiguration.java | 54 + .../batch/models/package-info.java | 6 + .../resourcemanager/batch/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/batch/ci.yml | 7 +- sdk/batch/pom.xml | 1 + 215 files changed, 33013 insertions(+), 4 deletions(-) create mode 100644 sdk/batch/azure-resourcemanager-batch/CHANGELOG.md create mode 100644 sdk/batch/azure-resourcemanager-batch/README.md create mode 100644 sdk/batch/azure-resourcemanager-batch/pom.xml create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/BatchManager.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/ApplicationPackagesClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/ApplicationsClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/BatchAccountsClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/BatchManagement.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/CertificatesClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/LocationsClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/OperationsClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PoolsClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PrivateLinkResourcesClient.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/ApplicationInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/ApplicationPackageInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchAccountInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchAccountKeysInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchLocationQuotaInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/CertificateInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/CheckNameAvailabilityResultInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/OperationInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PoolInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PrivateEndpointConnectionInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PrivateLinkResourceInner.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/package-info.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/package-info.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackageImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackagesClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackagesImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationsClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationsImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountKeysImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountsClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountsImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchLocationQuotaImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchManagementBuilder.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchManagementImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificateImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificatesClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificatesImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CheckNameAvailabilityResultImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/LocationsClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/LocationsImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationsClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationsImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolsClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolsImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourceImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourcesClientImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourcesImpl.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/Utils.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/package-info.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AccountKeyType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ActivateApplicationPackageParameters.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AllocationState.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Application.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackage.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackageReference.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackages.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Applications.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleRun.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleRunError.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleSettings.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoStorageBaseProperties.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoStorageProperties.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoUserScope.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoUserSpecification.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AzureBlobFileSystemConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AzureFileShareConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccount.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountCreateParameters.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountIdentity.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountIdentityUserAssignedIdentities.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountKeys.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountListResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountRegenerateKeyParameters.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountUpdateParameters.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccounts.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsCreateHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsCreateResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsDeleteHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsDeleteResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchLocationQuota.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchPoolIdentity.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchPoolIdentityUserAssignedIdentities.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CachingType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificate.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateBaseProperties.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateCreateOrUpdateParameters.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateCreateOrUpdateProperties.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateFormat.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateProperties.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateProvisioningState.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateReference.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateStoreLocation.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateVisibility.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificates.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCancelDeletionHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCancelDeletionResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCreateHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCreateResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesDeleteHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesDeleteResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesGetHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesGetResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesUpdateHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesUpdateResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CheckNameAvailabilityParameters.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CheckNameAvailabilityResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CifsMountConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CloudServiceConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ComputeNodeDeallocationOption.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ComputeNodeFillType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerRegistry.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerWorkingDirectory.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DataDisk.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DeleteCertificateError.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DeploymentConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DiskEncryptionConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DiskEncryptionTarget.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ElevationLevel.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/EncryptionProperties.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/EnvironmentSetting.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/FixedScaleSettings.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ImageReference.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InboundEndpointProtocol.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InboundNatPool.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InterNodeCommunicationState.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/IpAddressProvisioningType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeySource.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeyVaultProperties.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeyVaultReference.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/LinuxUserConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListApplicationPackagesResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListApplicationsResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListCertificatesResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPoolsResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPrivateEndpointConnectionsResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPrivateLinkResourcesResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Locations.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/LoginMode.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/MetadataItem.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/MountConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NameAvailabilityReason.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkSecurityGroupRule.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkSecurityGroupRuleAccess.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NfsMountConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NodePlacementConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NodePlacementPolicyType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Operation.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/OperationDisplay.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/OperationListResult.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Operations.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PackageState.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pool.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolAllocationMode.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolEndpointConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolIdentityType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolProvisioningState.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pools.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsCreateHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsCreateResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDeleteHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDeleteResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDisableAutoScaleHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDisableAutoScaleResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsGetHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsGetResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsStopResizeHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsStopResizeResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsUpdateHeaders.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsUpdateResponse.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpoint.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnection.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnectionProvisioningState.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnections.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkResource.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkResources.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkServiceConnectionState.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkServiceConnectionStatus.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ProvisioningState.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PublicIpAddressConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PublicNetworkAccessType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResizeError.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResizeOperationStatus.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResourceFile.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResourceIdentityType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ScaleSettings.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/StartTask.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/StorageAccountType.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/TaskContainerSettings.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/TaskSchedulingPolicy.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/UserAccount.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/UserIdentity.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VMExtension.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VirtualMachineConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VirtualMachineFamilyCoreQuota.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/WindowsConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/WindowsUserConfiguration.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/package-info.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/package-info.java create mode 100644 sdk/batch/azure-resourcemanager-batch/src/main/java/module-info.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 677f29c6d900e..c33cce34423d9 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -191,6 +191,7 @@ com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthbot;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-batch;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/sdk/batch/azure-resourcemanager-batch/CHANGELOG.md b/sdk/batch/azure-resourcemanager-batch/CHANGELOG.md new file mode 100644 index 0000000000000..51e3d7a814fe9 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-01-14) + +- Azure Resource Manager Batch client library for Java. This package contains Microsoft Azure SDK for Batch Management SDK. Package tag package-2021-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/batch/azure-resourcemanager-batch/README.md b/sdk/batch/azure-resourcemanager-batch/README.md new file mode 100644 index 0000000000000..7042dec428d87 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager Batch client library for Java + +Azure Resource Manager Batch client library for Java. + +This package contains Microsoft Azure SDK for Batch Management SDK. Package tag package-2021-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-batch;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-batch + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +BatchManager manager = BatchManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/batch/azure-resourcemanager-batch/pom.xml b/sdk/batch/azure-resourcemanager-batch/pom.xml new file mode 100644 index 0000000000000..c0d91814de032 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/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-batch + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Batch Management + This package contains Microsoft Azure SDK for Batch Management SDK. Package tag package-2021-01. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core-management + 1.1.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/BatchManager.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/BatchManager.java new file mode 100644 index 0000000000000..a1d796995b3f4 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/BatchManager.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch; + +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.batch.fluent.BatchManagement; +import com.azure.resourcemanager.batch.implementation.ApplicationPackagesImpl; +import com.azure.resourcemanager.batch.implementation.ApplicationsImpl; +import com.azure.resourcemanager.batch.implementation.BatchAccountsImpl; +import com.azure.resourcemanager.batch.implementation.BatchManagementBuilder; +import com.azure.resourcemanager.batch.implementation.CertificatesImpl; +import com.azure.resourcemanager.batch.implementation.LocationsImpl; +import com.azure.resourcemanager.batch.implementation.OperationsImpl; +import com.azure.resourcemanager.batch.implementation.PoolsImpl; +import com.azure.resourcemanager.batch.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.batch.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.batch.models.ApplicationPackages; +import com.azure.resourcemanager.batch.models.Applications; +import com.azure.resourcemanager.batch.models.BatchAccounts; +import com.azure.resourcemanager.batch.models.Certificates; +import com.azure.resourcemanager.batch.models.Locations; +import com.azure.resourcemanager.batch.models.Operations; +import com.azure.resourcemanager.batch.models.Pools; +import com.azure.resourcemanager.batch.models.PrivateEndpointConnections; +import com.azure.resourcemanager.batch.models.PrivateLinkResources; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to BatchManager. */ +public final class BatchManager { + private BatchAccounts batchAccounts; + + private ApplicationPackages applicationPackages; + + private Applications applications; + + private Locations locations; + + private Operations operations; + + private Certificates certificates; + + private PrivateLinkResources privateLinkResources; + + private PrivateEndpointConnections privateEndpointConnections; + + private Pools pools; + + private final BatchManagement clientObject; + + private BatchManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new BatchManagementBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Batch service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Batch service API instance. + */ + public static BatchManager 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 BatchManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new BatchManager.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 Batch service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Batch service API instance. + */ + public BatchManager 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.batch", + "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 BatchManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of BatchAccounts. */ + public BatchAccounts batchAccounts() { + if (this.batchAccounts == null) { + this.batchAccounts = new BatchAccountsImpl(clientObject.getBatchAccounts(), this); + } + return batchAccounts; + } + + /** @return Resource collection API of ApplicationPackages. */ + public ApplicationPackages applicationPackages() { + if (this.applicationPackages == null) { + this.applicationPackages = new ApplicationPackagesImpl(clientObject.getApplicationPackages(), this); + } + return applicationPackages; + } + + /** @return Resource collection API of Applications. */ + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(clientObject.getApplications(), this); + } + return applications; + } + + /** @return Resource collection API of Locations. */ + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(clientObject.getLocations(), this); + } + return locations; + } + + /** @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 Certificates. */ + public Certificates certificates() { + if (this.certificates == null) { + this.certificates = new CertificatesImpl(clientObject.getCertificates(), this); + } + return certificates; + } + + /** @return Resource collection API of PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** @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 Pools. */ + public Pools pools() { + if (this.pools == null) { + this.pools = new PoolsImpl(clientObject.getPools(), this); + } + return pools; + } + + /** + * @return Wrapped service client BatchManagement providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public BatchManagement serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/ApplicationPackagesClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/ApplicationPackagesClient.java new file mode 100644 index 0000000000000..31deee5e53603 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/ApplicationPackagesClient.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.fluent.models.ApplicationPackageInner; +import com.azure.resourcemanager.batch.models.ActivateApplicationPackageParameters; + +/** An instance of this class provides access to all the operations defined in ApplicationPackagesClient. */ +public interface ApplicationPackagesClient { + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationPackageInner activate( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters); + + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @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 an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response activateWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters, + Context context); + + /** + * Creates an application package record. The record contains the SAS where the package should be uploaded to. Once + * it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be + * used. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationPackageInner create( + String resourceGroupName, String accountName, String applicationName, String versionName); + + /** + * Creates an application package record. The record contains the SAS where the package should be uploaded to. Once + * it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be + * used. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @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 an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ApplicationPackageInner parameters, + Context context); + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 applicationName, String versionName); + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @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 applicationName, String versionName, Context context); + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified application package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationPackageInner get( + String resourceGroupName, String accountName, String applicationName, String versionName); + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @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 information about the specified application package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String applicationName, String versionName, Context context); + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String accountName, String applicationName); + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param maxresults The maximum number of items to return in the response. + * @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 result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String accountName, String applicationName, Integer maxresults, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/ApplicationsClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/ApplicationsClient.java new file mode 100644 index 0000000000000..f4d2c5358f2a2 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/ApplicationsClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.fluent.models.ApplicationInner; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public interface ApplicationsClient { + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner create(String resourceGroupName, String accountName, String applicationName); + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @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 contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + ApplicationInner parameters, + Context context); + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName); + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName, Context context); + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner get(String resourceGroupName, String accountName, String applicationName); + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String applicationName, Context context); + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner update( + String resourceGroupName, String accountName, String applicationName, ApplicationInner parameters); + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @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 contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + ApplicationInner parameters, + Context context); + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String accountName); + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @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 result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String accountName, Integer maxresults, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/BatchAccountsClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/BatchAccountsClient.java new file mode 100644 index 0000000000000..2154974617dbb --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/BatchAccountsClient.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountInner; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountKeysInner; +import com.azure.resourcemanager.batch.models.BatchAccountCreateParameters; +import com.azure.resourcemanager.batch.models.BatchAccountRegenerateKeyParameters; +import com.azure.resourcemanager.batch.models.BatchAccountUpdateParameters; + +/** An instance of this class provides access to all the operations defined in BatchAccountsClient. */ +public interface BatchAccountsClient { + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BatchAccountInner> beginCreate( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters); + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @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 contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BatchAccountInner> beginCreate( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters, Context context); + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BatchAccountInner create(String resourceGroupName, String accountName, BatchAccountCreateParameters parameters); + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @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 contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BatchAccountInner create( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters, Context context); + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters Additional parameters for account update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BatchAccountInner update(String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters); + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters Additional parameters for account update. + * @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 contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters, Context context); + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName); + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, Context context); + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, Context context); + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BatchAccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 synchronizeAutoStorageKeys(String resourceGroupName, String accountName); + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 synchronizeAutoStorageKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BatchAccountKeysInner regenerateKey( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters parameters); + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateKeyWithResponse( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters parameters, Context context); + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BatchAccountKeysInner getKeys(String resourceGroupName, String accountName); + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getKeysWithResponse(String resourceGroupName, String accountName, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/BatchManagement.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/BatchManagement.java new file mode 100644 index 0000000000000..dd2c8e05e25f7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/BatchManagement.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for BatchManagement class. */ +public interface BatchManagement { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @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 BatchAccountsClient object to access its operations. + * + * @return the BatchAccountsClient object. + */ + BatchAccountsClient getBatchAccounts(); + + /** + * Gets the ApplicationPackagesClient object to access its operations. + * + * @return the ApplicationPackagesClient object. + */ + ApplicationPackagesClient getApplicationPackages(); + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + ApplicationsClient getApplications(); + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + LocationsClient getLocations(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CertificatesClient object to access its operations. + * + * @return the CertificatesClient object. + */ + CertificatesClient getCertificates(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PoolsClient object to access its operations. + * + * @return the PoolsClient object. + */ + PoolsClient getPools(); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/CertificatesClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/CertificatesClient.java new file mode 100644 index 0000000000000..090927780eb46 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/CertificatesClient.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; +import com.azure.resourcemanager.batch.models.CertificateCreateOrUpdateParameters; + +/** An instance of this class provides access to all the operations defined in CertificatesClient. */ +public interface CertificatesClient { + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBatchAccount(String resourceGroupName, String accountName); + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are "properties/provisioningState", + * "properties/provisioningStateTransitionTime", "name". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBatchAccount( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context); + + /** + * Creates a new certificate inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Additional parameters for certificate creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateInner create( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters); + + /** + * Creates a new certificate inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Additional parameters for certificate creation. + * @param ifMatch The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply + * the operation only if the certificate already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new certificate to be created, but to prevent updating an existing + * certificate. Other values will be ignored. + * @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 contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch, + String ifNoneMatch, + Context context); + + /** + * Updates the properties of an existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Certificate entity to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateInner update( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters); + + /** + * Updates the properties of an existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Certificate entity to update. + * @param ifMatch The entity state (ETag) version of the certificate to update. This value can be omitted or set to + * "*" to apply the operation unconditionally. + * @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 contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch, + Context context); + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String certificateName); + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String certificateName, Context context); + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 certificateName); + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String certificateName, Context context); + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateInner get(String resourceGroupName, String accountName, String certificateName); + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @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 information about the specified certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String certificateName, Context context); + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateInner cancelDeletion(String resourceGroupName, String accountName, String certificateName); + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @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 contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelDeletionWithResponse( + String resourceGroupName, String accountName, String certificateName, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/LocationsClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/LocationsClient.java new file mode 100644 index 0000000000000..a20c9b0640b98 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/LocationsClient.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.batch.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.batch.fluent.models.BatchLocationQuotaInner; +import com.azure.resourcemanager.batch.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.batch.models.CheckNameAvailabilityParameters; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public interface LocationsClient { + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Batch service quotas for the specified subscription at the given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BatchLocationQuotaInner getQuotas(String locationName); + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @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 Batch service quotas for the specified subscription at the given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getQuotasWithResponse(String locationName, Context context); + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkNameAvailability( + String locationName, CheckNameAvailabilityParameters parameters); + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + String locationName, CheckNameAvailabilityParameters parameters, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/OperationsClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/OperationsClient.java new file mode 100644 index 0000000000000..102a74354c699 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/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.batch.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.batch.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PoolsClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PoolsClient.java new file mode 100644 index 0000000000000..d31e39f77c9a3 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PoolsClient.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; + +/** An instance of this class provides access to all the operations defined in PoolsClient. */ +public interface PoolsClient { + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBatchAccount(String resourceGroupName, String accountName); + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are: + *

name properties/allocationState properties/allocationStateTransitionTime properties/creationTime + * properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified + * properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale + * properties/scaleSettings/fixedScale. + * @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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBatchAccount( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context); + + /** + * Creates a new pool inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Additional parameters for pool creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner create(String resourceGroupName, String accountName, String poolName, PoolInner parameters); + + /** + * Creates a new pool inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Additional parameters for pool creation. + * @param ifMatch The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the + * operation only if the pool already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other + * values will be ignored. + * @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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String accountName, + String poolName, + PoolInner parameters, + String ifMatch, + String ifNoneMatch, + Context context); + + /** + * Updates the properties of an existing pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Pool properties that should be updated. Properties that are supplied will be updated, any + * property not supplied will be unchanged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner update(String resourceGroupName, String accountName, String poolName, PoolInner parameters); + + /** + * Updates the properties of an existing pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Pool properties that should be updated. Properties that are supplied will be updated, any + * property not supplied will be unchanged. + * @param ifMatch The entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to + * apply the operation unconditionally. + * @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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String accountName, + String poolName, + PoolInner parameters, + String ifMatch, + Context context); + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, String poolName); + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String poolName, Context context); + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 poolName); + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String poolName, Context context); + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner get(String resourceGroupName, String accountName, String poolName); + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String accountName, String poolName, Context context); + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner disableAutoScale(String resourceGroupName, String accountName, String poolName); + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response disableAutoScaleWithResponse( + String resourceGroupName, String accountName, String poolName, Context context); + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PoolInner stopResize(String resourceGroupName, String accountName, String poolName); + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response stopResizeWithResponse( + String resourceGroupName, String accountName, String poolName, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PrivateEndpointConnectionsClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..e38582df1f23a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.batch.fluent.models.PrivateEndpointConnectionInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBatchAccount(String resourceGroupName, String accountName); + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBatchAccount( + String resourceGroupName, String accountName, Integer maxresults, Context context); + + /** + * Gets information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Gets information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch); + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @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 contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context); + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch); + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @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 contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PrivateLinkResourcesClient.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..72ce20f09f610 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.fluent.models.PrivateLinkResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBatchAccount(String resourceGroupName, String accountName); + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBatchAccount( + String resourceGroupName, String accountName, Integer maxresults, Context context); + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String accountName, String privateLinkResourceName); + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String accountName, String privateLinkResourceName, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/ApplicationInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/ApplicationInner.java new file mode 100644 index 0000000000000..d61fc7b0939c7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/ApplicationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains information about an application in a Batch account. */ +@JsonFlatten +@Fluent +public class ApplicationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationInner.class); + + /* + * The display name for the application. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * A value indicating whether packages within the application may be + * overwritten using the same version string. + */ + @JsonProperty(value = "properties.allowUpdates") + private Boolean allowUpdates; + + /* + * The package to use if a client requests the application but does not + * specify a version. This property can only be set to the name of an + * existing package. + */ + @JsonProperty(value = "properties.defaultVersion") + private String defaultVersion; + + /* + * The ETag of the resource, used for concurrency statements. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the displayName property: The display name for the application. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name for the application. + * + * @param displayName the displayName value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the allowUpdates property: A value indicating whether packages within the application may be overwritten + * using the same version string. + * + * @return the allowUpdates value. + */ + public Boolean allowUpdates() { + return this.allowUpdates; + } + + /** + * Set the allowUpdates property: A value indicating whether packages within the application may be overwritten + * using the same version string. + * + * @param allowUpdates the allowUpdates value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withAllowUpdates(Boolean allowUpdates) { + this.allowUpdates = allowUpdates; + return this; + } + + /** + * Get the defaultVersion property: The package to use if a client requests the application but does not specify a + * version. This property can only be set to the name of an existing package. + * + * @return the defaultVersion value. + */ + public String defaultVersion() { + return this.defaultVersion; + } + + /** + * Set the defaultVersion property: The package to use if a client requests the application but does not specify a + * version. This property can only be set to the name of an existing package. + * + * @param defaultVersion the defaultVersion value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withDefaultVersion(String defaultVersion) { + this.defaultVersion = defaultVersion; + return this; + } + + /** + * Get the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/ApplicationPackageInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/ApplicationPackageInner.java new file mode 100644 index 0000000000000..9355bb5712079 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/ApplicationPackageInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.models.PackageState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An application package which represents a particular version of an application. */ +@JsonFlatten +@Immutable +public class ApplicationPackageInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPackageInner.class); + + /* + * The current state of the application package. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private PackageState state; + + /* + * The format of the application package, if the package is active. + */ + @JsonProperty(value = "properties.format", access = JsonProperty.Access.WRITE_ONLY) + private String format; + + /* + * The URL for the application package in Azure Storage. + */ + @JsonProperty(value = "properties.storageUrl", access = JsonProperty.Access.WRITE_ONLY) + private String storageUrl; + + /* + * The UTC time at which the Azure Storage URL will expire. + */ + @JsonProperty(value = "properties.storageUrlExpiry", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime storageUrlExpiry; + + /* + * The time at which the package was last activated, if the package is + * active. + */ + @JsonProperty(value = "properties.lastActivationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastActivationTime; + + /* + * The ETag of the resource, used for concurrency statements. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the state property: The current state of the application package. + * + * @return the state value. + */ + public PackageState state() { + return this.state; + } + + /** + * Get the format property: The format of the application package, if the package is active. + * + * @return the format value. + */ + public String format() { + return this.format; + } + + /** + * Get the storageUrl property: The URL for the application package in Azure Storage. + * + * @return the storageUrl value. + */ + public String storageUrl() { + return this.storageUrl; + } + + /** + * Get the storageUrlExpiry property: The UTC time at which the Azure Storage URL will expire. + * + * @return the storageUrlExpiry value. + */ + public OffsetDateTime storageUrlExpiry() { + return this.storageUrlExpiry; + } + + /** + * Get the lastActivationTime property: The time at which the package was last activated, if the package is active. + * + * @return the lastActivationTime value. + */ + public OffsetDateTime lastActivationTime() { + return this.lastActivationTime; + } + + /** + * Get the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchAccountInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchAccountInner.java new file mode 100644 index 0000000000000..01fcecfae7908 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchAccountInner.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.models.AutoStorageProperties; +import com.azure.resourcemanager.batch.models.BatchAccountIdentity; +import com.azure.resourcemanager.batch.models.EncryptionProperties; +import com.azure.resourcemanager.batch.models.KeyVaultReference; +import com.azure.resourcemanager.batch.models.PoolAllocationMode; +import com.azure.resourcemanager.batch.models.ProvisioningState; +import com.azure.resourcemanager.batch.models.PublicNetworkAccessType; +import com.azure.resourcemanager.batch.models.VirtualMachineFamilyCoreQuota; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Contains information about an Azure Batch account. */ +@JsonFlatten +@Fluent +public class BatchAccountInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountInner.class); + + /* + * The identity of the Batch account. + */ + @JsonProperty(value = "identity") + private BatchAccountIdentity identity; + + /* + * The account endpoint used to interact with the Batch service. + */ + @JsonProperty(value = "properties.accountEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String accountEndpoint; + + /* + * The provisioned state of the resource + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The allocation mode for creating pools in the Batch account. + */ + @JsonProperty(value = "properties.poolAllocationMode", access = JsonProperty.Access.WRITE_ONLY) + private PoolAllocationMode poolAllocationMode; + + /* + * Identifies the Azure key vault associated with a Batch account. + */ + @JsonProperty(value = "properties.keyVaultReference", access = JsonProperty.Access.WRITE_ONLY) + private KeyVaultReference keyVaultReference; + + /* + * If not specified, the default value is 'enabled'. + */ + @JsonProperty(value = "properties.publicNetworkAccess", access = JsonProperty.Access.WRITE_ONLY) + private PublicNetworkAccessType publicNetworkAccess; + + /* + * List of private endpoint connections associated with the Batch account + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Contains information about the auto-storage account associated with a + * Batch account. + */ + @JsonProperty(value = "properties.autoStorage", access = JsonProperty.Access.WRITE_ONLY) + private AutoStorageProperties autoStorage; + + /* + * Configures how customer data is encrypted inside the Batch account. By + * default, accounts are encrypted using a Microsoft managed key. For + * additional control, a customer-managed key can be used instead. + */ + @JsonProperty(value = "properties.encryption", access = JsonProperty.Access.WRITE_ONLY) + private EncryptionProperties encryption; + + /* + * For accounts with PoolAllocationMode set to UserSubscription, quota is + * managed on the subscription so this value is not returned. + */ + @JsonProperty(value = "properties.dedicatedCoreQuota", access = JsonProperty.Access.WRITE_ONLY) + private Integer dedicatedCoreQuota; + + /* + * For accounts with PoolAllocationMode set to UserSubscription, quota is + * managed on the subscription so this value is not returned. + */ + @JsonProperty(value = "properties.lowPriorityCoreQuota", access = JsonProperty.Access.WRITE_ONLY) + private Integer lowPriorityCoreQuota; + + /* + * A list of the dedicated core quota per Virtual Machine family for the + * Batch account. For accounts with PoolAllocationMode set to + * UserSubscription, quota is managed on the subscription so this value is + * not returned. + */ + @JsonProperty(value = "properties.dedicatedCoreQuotaPerVMFamily", access = JsonProperty.Access.WRITE_ONLY) + private List dedicatedCoreQuotaPerVMFamily; + + /* + * Batch is transitioning its core quota system for dedicated cores to be + * enforced per Virtual Machine family. During this transitional phase, the + * dedicated core quota per Virtual Machine family may not yet be enforced. + * If this flag is false, dedicated core quota is enforced via the old + * dedicatedCoreQuota property on the account and does not consider Virtual + * Machine family. If this flag is true, dedicated core quota is enforced + * via the dedicatedCoreQuotaPerVMFamily property on the account, and the + * old dedicatedCoreQuota does not apply. + */ + @JsonProperty(value = "properties.dedicatedCoreQuotaPerVMFamilyEnforced", access = JsonProperty.Access.WRITE_ONLY) + private Boolean dedicatedCoreQuotaPerVMFamilyEnforced; + + /* + * The pool quota for the Batch account. + */ + @JsonProperty(value = "properties.poolQuota", access = JsonProperty.Access.WRITE_ONLY) + private Integer poolQuota; + + /* + * The active job and job schedule quota for the Batch account. + */ + @JsonProperty(value = "properties.activeJobAndJobScheduleQuota", access = JsonProperty.Access.WRITE_ONLY) + private Integer activeJobAndJobScheduleQuota; + + /** + * Get the identity property: The identity of the Batch account. + * + * @return the identity value. + */ + public BatchAccountIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the Batch account. + * + * @param identity the identity value to set. + * @return the BatchAccountInner object itself. + */ + public BatchAccountInner withIdentity(BatchAccountIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the accountEndpoint property: The account endpoint used to interact with the Batch service. + * + * @return the accountEndpoint value. + */ + public String accountEndpoint() { + return this.accountEndpoint; + } + + /** + * Get the provisioningState property: The provisioned state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the poolAllocationMode property: The allocation mode for creating pools in the Batch account. + * + * @return the poolAllocationMode value. + */ + public PoolAllocationMode poolAllocationMode() { + return this.poolAllocationMode; + } + + /** + * Get the keyVaultReference property: Identifies the Azure key vault associated with a Batch account. + * + * @return the keyVaultReference value. + */ + public KeyVaultReference keyVaultReference() { + return this.keyVaultReference; + } + + /** + * Get the publicNetworkAccess property: If not specified, the default value is 'enabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessType publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections associated with the Batch + * account. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the autoStorage property: Contains information about the auto-storage account associated with a Batch + * account. + * + * @return the autoStorage value. + */ + public AutoStorageProperties autoStorage() { + return this.autoStorage; + } + + /** + * Get the encryption property: Configures how customer data is encrypted inside the Batch account. By default, + * accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used + * instead. + * + * @return the encryption value. + */ + public EncryptionProperties encryption() { + return this.encryption; + } + + /** + * Get the dedicatedCoreQuota property: For accounts with PoolAllocationMode set to UserSubscription, quota is + * managed on the subscription so this value is not returned. + * + * @return the dedicatedCoreQuota value. + */ + public Integer dedicatedCoreQuota() { + return this.dedicatedCoreQuota; + } + + /** + * Get the lowPriorityCoreQuota property: For accounts with PoolAllocationMode set to UserSubscription, quota is + * managed on the subscription so this value is not returned. + * + * @return the lowPriorityCoreQuota value. + */ + public Integer lowPriorityCoreQuota() { + return this.lowPriorityCoreQuota; + } + + /** + * Get the dedicatedCoreQuotaPerVMFamily property: A list of the dedicated core quota per Virtual Machine family for + * the Batch account. For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the + * subscription so this value is not returned. + * + * @return the dedicatedCoreQuotaPerVMFamily value. + */ + public List dedicatedCoreQuotaPerVMFamily() { + return this.dedicatedCoreQuotaPerVMFamily; + } + + /** + * Get the dedicatedCoreQuotaPerVMFamilyEnforced property: Batch is transitioning its core quota system for + * dedicated cores to be enforced per Virtual Machine family. During this transitional phase, the dedicated core + * quota per Virtual Machine family may not yet be enforced. If this flag is false, dedicated core quota is enforced + * via the old dedicatedCoreQuota property on the account and does not consider Virtual Machine family. If this flag + * is true, dedicated core quota is enforced via the dedicatedCoreQuotaPerVMFamily property on the account, and the + * old dedicatedCoreQuota does not apply. + * + * @return the dedicatedCoreQuotaPerVMFamilyEnforced value. + */ + public Boolean dedicatedCoreQuotaPerVMFamilyEnforced() { + return this.dedicatedCoreQuotaPerVMFamilyEnforced; + } + + /** + * Get the poolQuota property: The pool quota for the Batch account. + * + * @return the poolQuota value. + */ + public Integer poolQuota() { + return this.poolQuota; + } + + /** + * Get the activeJobAndJobScheduleQuota property: The active job and job schedule quota for the Batch account. + * + * @return the activeJobAndJobScheduleQuota value. + */ + public Integer activeJobAndJobScheduleQuota() { + return this.activeJobAndJobScheduleQuota; + } + + /** {@inheritDoc} */ + @Override + public BatchAccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public BatchAccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (keyVaultReference() != null) { + keyVaultReference().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (autoStorage() != null) { + autoStorage().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + if (dedicatedCoreQuotaPerVMFamily() != null) { + dedicatedCoreQuotaPerVMFamily().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchAccountKeysInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchAccountKeysInner.java new file mode 100644 index 0000000000000..1097e7bda38cc --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchAccountKeysInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent.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 set of Azure Batch account keys. */ +@Immutable +public final class BatchAccountKeysInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountKeysInner.class); + + /* + * The Batch account name. + */ + @JsonProperty(value = "accountName", access = JsonProperty.Access.WRITE_ONLY) + private String accountName; + + /* + * The primary key associated with the account. + */ + @JsonProperty(value = "primary", access = JsonProperty.Access.WRITE_ONLY) + private String primary; + + /* + * The secondary key associated with the account. + */ + @JsonProperty(value = "secondary", access = JsonProperty.Access.WRITE_ONLY) + private String secondary; + + /** + * Get the accountName property: The Batch account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Get the primary property: The primary key associated with the account. + * + * @return the primary value. + */ + public String primary() { + return this.primary; + } + + /** + * Get the secondary property: The secondary key associated with the account. + * + * @return the secondary value. + */ + public String secondary() { + return this.secondary; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchLocationQuotaInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchLocationQuotaInner.java new file mode 100644 index 0000000000000..9a4d78f7a6362 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/BatchLocationQuotaInner.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.batch.fluent.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; + +/** Quotas associated with a Batch region for a particular subscription. */ +@Immutable +public final class BatchLocationQuotaInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchLocationQuotaInner.class); + + /* + * The number of Batch accounts that may be created under the subscription + * in the specified region. + */ + @JsonProperty(value = "accountQuota", access = JsonProperty.Access.WRITE_ONLY) + private Integer accountQuota; + + /** + * Get the accountQuota property: The number of Batch accounts that may be created under the subscription in the + * specified region. + * + * @return the accountQuota value. + */ + public Integer accountQuota() { + return this.accountQuota; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/CertificateInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/CertificateInner.java new file mode 100644 index 0000000000000..72bb750c417ba --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/CertificateInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.models.CertificateFormat; +import com.azure.resourcemanager.batch.models.CertificateProvisioningState; +import com.azure.resourcemanager.batch.models.DeleteCertificateError; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Contains information about a certificate. */ +@JsonFlatten +@Fluent +public class CertificateInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateInner.class); + + /* + * This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + */ + @JsonProperty(value = "properties.thumbprintAlgorithm") + private String thumbprintAlgorithm; + + /* + * This must match the thumbprint from the name. + */ + @JsonProperty(value = "properties.thumbprint") + private String thumbprint; + + /* + * The format of the certificate - either Pfx or Cer. If omitted, the + * default is Pfx. + */ + @JsonProperty(value = "properties.format") + private CertificateFormat format; + + /* + * The provisioningState property. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private CertificateProvisioningState provisioningState; + + /* + * The time at which the certificate entered its current state. + */ + @JsonProperty(value = "properties.provisioningStateTransitionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime provisioningStateTransitionTime; + + /* + * The previous provisioned state of the resource + */ + @JsonProperty(value = "properties.previousProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private CertificateProvisioningState previousProvisioningState; + + /* + * The time at which the certificate entered its previous state. + */ + @JsonProperty(value = "properties.previousProvisioningStateTransitionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime previousProvisioningStateTransitionTime; + + /* + * The public key of the certificate. + */ + @JsonProperty(value = "properties.publicData", access = JsonProperty.Access.WRITE_ONLY) + private String publicData; + + /* + * This is only returned when the certificate provisioningState is + * 'Failed'. + */ + @JsonProperty(value = "properties.deleteCertificateError", access = JsonProperty.Access.WRITE_ONLY) + private DeleteCertificateError deleteCertificateError; + + /* + * The ETag of the resource, used for concurrency statements. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the thumbprintAlgorithm property: This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + * + * @return the thumbprintAlgorithm value. + */ + public String thumbprintAlgorithm() { + return this.thumbprintAlgorithm; + } + + /** + * Set the thumbprintAlgorithm property: This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + * + * @param thumbprintAlgorithm the thumbprintAlgorithm value to set. + * @return the CertificateInner object itself. + */ + public CertificateInner withThumbprintAlgorithm(String thumbprintAlgorithm) { + this.thumbprintAlgorithm = thumbprintAlgorithm; + return this; + } + + /** + * Get the thumbprint property: This must match the thumbprint from the name. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: This must match the thumbprint from the name. + * + * @param thumbprint the thumbprint value to set. + * @return the CertificateInner object itself. + */ + public CertificateInner withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the format property: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * + * @return the format value. + */ + public CertificateFormat format() { + return this.format; + } + + /** + * Set the format property: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * + * @param format the format value to set. + * @return the CertificateInner object itself. + */ + public CertificateInner withFormat(CertificateFormat format) { + this.format = format; + return this; + } + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public CertificateProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisioningStateTransitionTime property: The time at which the certificate entered its current state. + * + * @return the provisioningStateTransitionTime value. + */ + public OffsetDateTime provisioningStateTransitionTime() { + return this.provisioningStateTransitionTime; + } + + /** + * Get the previousProvisioningState property: The previous provisioned state of the resource. + * + * @return the previousProvisioningState value. + */ + public CertificateProvisioningState previousProvisioningState() { + return this.previousProvisioningState; + } + + /** + * Get the previousProvisioningStateTransitionTime property: The time at which the certificate entered its previous + * state. + * + * @return the previousProvisioningStateTransitionTime value. + */ + public OffsetDateTime previousProvisioningStateTransitionTime() { + return this.previousProvisioningStateTransitionTime; + } + + /** + * Get the publicData property: The public key of the certificate. + * + * @return the publicData value. + */ + public String publicData() { + return this.publicData; + } + + /** + * Get the deleteCertificateError property: This is only returned when the certificate provisioningState is + * 'Failed'. + * + * @return the deleteCertificateError value. + */ + public DeleteCertificateError deleteCertificateError() { + return this.deleteCertificateError; + } + + /** + * Get the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deleteCertificateError() != null) { + deleteCertificateError().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 0000000000000..03c35f5cb03a7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.models.NameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CheckNameAvailability operation response. */ +@Immutable +public final class CheckNameAvailabilityResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResultInner.class); + + /* + * Gets a boolean value that indicates whether the name is available for + * you to use. If true, the name is available. If false, the name has + * already been taken or invalid and cannot be used. + */ + @JsonProperty(value = "nameAvailable", access = JsonProperty.Access.WRITE_ONLY) + private Boolean nameAvailable; + + /* + * Gets the reason that a Batch account name could not be used. The Reason + * element is only returned if NameAvailable is false. + */ + @JsonProperty(value = "reason", access = JsonProperty.Access.WRITE_ONLY) + private NameAvailabilityReason reason; + + /* + * Gets an error message explaining the Reason value in more detail. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the nameAvailable property: Gets a boolean value that indicates whether the name is available for you to use. + * If true, the name is available. If false, the name has already been taken or invalid and cannot be used. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: Gets the reason that a Batch account name could not be used. The Reason element is only + * returned if NameAvailable is false. + * + * @return the reason value. + */ + public NameAvailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: Gets an error message explaining the Reason value in more detail. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/OperationInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..ea78784106372 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/OperationInner.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.batch.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * This is of the format {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Any object + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the name property: This is of the format {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: This is of the format {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that describes the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that describes the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: The intended executor of the operation. + * + * @param origin the origin value to set. + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: Any object. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Any object. + * + * @param properties the properties value to set. + * @return the OperationInner object itself. + */ + public OperationInner 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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PoolInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PoolInner.java new file mode 100644 index 0000000000000..7b83be87fb959 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PoolInner.java @@ -0,0 +1,759 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.models.AllocationState; +import com.azure.resourcemanager.batch.models.ApplicationPackageReference; +import com.azure.resourcemanager.batch.models.AutoScaleRun; +import com.azure.resourcemanager.batch.models.BatchPoolIdentity; +import com.azure.resourcemanager.batch.models.CertificateReference; +import com.azure.resourcemanager.batch.models.DeploymentConfiguration; +import com.azure.resourcemanager.batch.models.InterNodeCommunicationState; +import com.azure.resourcemanager.batch.models.MetadataItem; +import com.azure.resourcemanager.batch.models.MountConfiguration; +import com.azure.resourcemanager.batch.models.NetworkConfiguration; +import com.azure.resourcemanager.batch.models.PoolProvisioningState; +import com.azure.resourcemanager.batch.models.ResizeOperationStatus; +import com.azure.resourcemanager.batch.models.ScaleSettings; +import com.azure.resourcemanager.batch.models.StartTask; +import com.azure.resourcemanager.batch.models.TaskSchedulingPolicy; +import com.azure.resourcemanager.batch.models.UserAccount; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Contains information about a pool. */ +@JsonFlatten +@Fluent +public class PoolInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolInner.class); + + /* + * The type of identity used for the Batch Pool. + */ + @JsonProperty(value = "identity") + private BatchPoolIdentity identity; + + /* + * The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * This is the last time at which the pool level data, such as the + * targetDedicatedNodes or autoScaleSettings, changed. It does not factor + * in node-level changes such as a compute node changing state. + */ + @JsonProperty(value = "properties.lastModified", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModified; + + /* + * The creation time of the pool. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationTime; + + /* + * The current state of the pool. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PoolProvisioningState provisioningState; + + /* + * The time at which the pool entered its current state. + */ + @JsonProperty(value = "properties.provisioningStateTransitionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime provisioningStateTransitionTime; + + /* + * Whether the pool is resizing. + */ + @JsonProperty(value = "properties.allocationState", access = JsonProperty.Access.WRITE_ONLY) + private AllocationState allocationState; + + /* + * The time at which the pool entered its current allocation state. + */ + @JsonProperty(value = "properties.allocationStateTransitionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime allocationStateTransitionTime; + + /* + * For information about available sizes of virtual machines for Cloud + * Services pools (pools created with cloudServiceConfiguration), see Sizes + * for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). + * Batch supports all Cloud Services VM sizes except ExtraSmall. For + * information about available VM sizes for pools using images from the + * Virtual Machines Marketplace (pools created with + * virtualMachineConfiguration) see Sizes for Virtual Machines (Linux) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) + * or Sizes for Virtual Machines (Windows) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). + * Batch supports all Azure VM sizes except STANDARD_A0 and those with + * premium storage (STANDARD_GS, STANDARD_DS, and STANDARD_DSV2 series). + */ + @JsonProperty(value = "properties.vmSize") + private String vmSize; + + /* + * Using CloudServiceConfiguration specifies that the nodes should be + * creating using Azure Cloud Services (PaaS), while + * VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). + */ + @JsonProperty(value = "properties.deploymentConfiguration") + private DeploymentConfiguration deploymentConfiguration; + + /* + * The number of compute nodes currently in the pool. + */ + @JsonProperty(value = "properties.currentDedicatedNodes", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentDedicatedNodes; + + /* + * The number of low priority compute nodes currently in the pool. + */ + @JsonProperty(value = "properties.currentLowPriorityNodes", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentLowPriorityNodes; + + /* + * Defines the desired size of the pool. This can either be 'fixedScale' + * where the requested targetDedicatedNodes is specified, or 'autoScale' + * which defines a formula which is periodically reevaluated. If this + * property is not specified, the pool will have a fixed scale with 0 + * targetDedicatedNodes. + */ + @JsonProperty(value = "properties.scaleSettings") + private ScaleSettings scaleSettings; + + /* + * This property is set only if the pool automatically scales, i.e. + * autoScaleSettings are used. + */ + @JsonProperty(value = "properties.autoScaleRun", access = JsonProperty.Access.WRITE_ONLY) + private AutoScaleRun autoScaleRun; + + /* + * This imposes restrictions on which nodes can be assigned to the pool. + * Enabling this value can reduce the chance of the requested number of + * nodes to be allocated in the pool. If not specified, this value defaults + * to 'Disabled'. + */ + @JsonProperty(value = "properties.interNodeCommunication") + private InterNodeCommunicationState interNodeCommunication; + + /* + * The network configuration for a pool. + */ + @JsonProperty(value = "properties.networkConfiguration") + private NetworkConfiguration networkConfiguration; + + /* + * The default value is 1. The maximum value is the smaller of 4 times the + * number of cores of the vmSize of the pool or 256. + */ + @JsonProperty(value = "properties.taskSlotsPerNode") + private Integer taskSlotsPerNode; + + /* + * If not specified, the default is spread. + */ + @JsonProperty(value = "properties.taskSchedulingPolicy") + private TaskSchedulingPolicy taskSchedulingPolicy; + + /* + * The list of user accounts to be created on each node in the pool. + */ + @JsonProperty(value = "properties.userAccounts") + private List userAccounts; + + /* + * The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code. + */ + @JsonProperty(value = "properties.metadata") + private List metadata; + + /* + * In an PATCH (update) operation, this property can be set to an empty + * object to remove the start task from the pool. + */ + @JsonProperty(value = "properties.startTask") + private StartTask startTask; + + /* + * For Windows compute nodes, the Batch service installs the certificates + * to the specified certificate store and location. For Linux compute + * nodes, the certificates are stored in a directory inside the task + * working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR + * is supplied to the task to query for this location. For certificates + * with visibility of 'remoteUser', a 'certs' directory is created in the + * user's home directory (e.g., /home/{user-name}/certs) and certificates + * are placed in that directory. + */ + @JsonProperty(value = "properties.certificates") + private List certificates; + + /* + * Changes to application package references affect all new compute nodes + * joining the pool, but do not affect compute nodes that are already in + * the pool until they are rebooted or reimaged. There is a maximum of 10 + * application package references on any given pool. + */ + @JsonProperty(value = "properties.applicationPackages") + private List applicationPackages; + + /* + * The list of application licenses must be a subset of available Batch + * service application licenses. If a license is requested which is not + * supported, pool creation will fail. + */ + @JsonProperty(value = "properties.applicationLicenses") + private List applicationLicenses; + + /* + * Describes either the current operation (if the pool AllocationState is + * Resizing) or the previously completed operation (if the AllocationState + * is Steady). + */ + @JsonProperty(value = "properties.resizeOperationStatus", access = JsonProperty.Access.WRITE_ONLY) + private ResizeOperationStatus resizeOperationStatus; + + /* + * This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + */ + @JsonProperty(value = "properties.mountConfiguration") + private List mountConfiguration; + + /* + * The ETag of the resource, used for concurrency statements. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the identity property: The type of identity used for the Batch Pool. + * + * @return the identity value. + */ + public BatchPoolIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The type of identity used for the Batch Pool. + * + * @param identity the identity value to set. + * @return the PoolInner object itself. + */ + public PoolInner withIdentity(BatchPoolIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the displayName property: The display name need not be unique and can contain any Unicode characters up to a + * maximum length of 1024. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name need not be unique and can contain any Unicode characters up to a + * maximum length of 1024. + * + * @param displayName the displayName value to set. + * @return the PoolInner object itself. + */ + public PoolInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the lastModified property: This is the last time at which the pool level data, such as the + * targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute + * node changing state. + * + * @return the lastModified value. + */ + public OffsetDateTime lastModified() { + return this.lastModified; + } + + /** + * Get the creationTime property: The creation time of the pool. + * + * @return the creationTime value. + */ + public OffsetDateTime creationTime() { + return this.creationTime; + } + + /** + * Get the provisioningState property: The current state of the pool. + * + * @return the provisioningState value. + */ + public PoolProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisioningStateTransitionTime property: The time at which the pool entered its current state. + * + * @return the provisioningStateTransitionTime value. + */ + public OffsetDateTime provisioningStateTransitionTime() { + return this.provisioningStateTransitionTime; + } + + /** + * Get the allocationState property: Whether the pool is resizing. + * + * @return the allocationState value. + */ + public AllocationState allocationState() { + return this.allocationState; + } + + /** + * Get the allocationStateTransitionTime property: The time at which the pool entered its current allocation state. + * + * @return the allocationStateTransitionTime value. + */ + public OffsetDateTime allocationStateTransitionTime() { + return this.allocationStateTransitionTime; + } + + /** + * Get the vmSize property: For information about available sizes of virtual machines for Cloud Services pools + * (pools created with cloudServiceConfiguration), see Sizes for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud + * Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the + * Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines + * (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual + * Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch + * supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and + * STANDARD_DSV2 series). + * + * @return the vmSize value. + */ + public String vmSize() { + return this.vmSize; + } + + /** + * Set the vmSize property: For information about available sizes of virtual machines for Cloud Services pools + * (pools created with cloudServiceConfiguration), see Sizes for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud + * Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the + * Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines + * (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual + * Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch + * supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and + * STANDARD_DSV2 series). + * + * @param vmSize the vmSize value to set. + * @return the PoolInner object itself. + */ + public PoolInner withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the deploymentConfiguration property: Using CloudServiceConfiguration specifies that the nodes should be + * creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). + * + * @return the deploymentConfiguration value. + */ + public DeploymentConfiguration deploymentConfiguration() { + return this.deploymentConfiguration; + } + + /** + * Set the deploymentConfiguration property: Using CloudServiceConfiguration specifies that the nodes should be + * creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). + * + * @param deploymentConfiguration the deploymentConfiguration value to set. + * @return the PoolInner object itself. + */ + public PoolInner withDeploymentConfiguration(DeploymentConfiguration deploymentConfiguration) { + this.deploymentConfiguration = deploymentConfiguration; + return this; + } + + /** + * Get the currentDedicatedNodes property: The number of compute nodes currently in the pool. + * + * @return the currentDedicatedNodes value. + */ + public Integer currentDedicatedNodes() { + return this.currentDedicatedNodes; + } + + /** + * Get the currentLowPriorityNodes property: The number of low priority compute nodes currently in the pool. + * + * @return the currentLowPriorityNodes value. + */ + public Integer currentLowPriorityNodes() { + return this.currentLowPriorityNodes; + } + + /** + * Get the scaleSettings property: Defines the desired size of the pool. This can either be 'fixedScale' where the + * requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically + * reevaluated. If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes. + * + * @return the scaleSettings value. + */ + public ScaleSettings scaleSettings() { + return this.scaleSettings; + } + + /** + * Set the scaleSettings property: Defines the desired size of the pool. This can either be 'fixedScale' where the + * requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically + * reevaluated. If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes. + * + * @param scaleSettings the scaleSettings value to set. + * @return the PoolInner object itself. + */ + public PoolInner withScaleSettings(ScaleSettings scaleSettings) { + this.scaleSettings = scaleSettings; + return this; + } + + /** + * Get the autoScaleRun property: This property is set only if the pool automatically scales, i.e. autoScaleSettings + * are used. + * + * @return the autoScaleRun value. + */ + public AutoScaleRun autoScaleRun() { + return this.autoScaleRun; + } + + /** + * Get the interNodeCommunication property: This imposes restrictions on which nodes can be assigned to the pool. + * Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not + * specified, this value defaults to 'Disabled'. + * + * @return the interNodeCommunication value. + */ + public InterNodeCommunicationState interNodeCommunication() { + return this.interNodeCommunication; + } + + /** + * Set the interNodeCommunication property: This imposes restrictions on which nodes can be assigned to the pool. + * Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not + * specified, this value defaults to 'Disabled'. + * + * @param interNodeCommunication the interNodeCommunication value to set. + * @return the PoolInner object itself. + */ + public PoolInner withInterNodeCommunication(InterNodeCommunicationState interNodeCommunication) { + this.interNodeCommunication = interNodeCommunication; + return this; + } + + /** + * Get the networkConfiguration property: The network configuration for a pool. + * + * @return the networkConfiguration value. + */ + public NetworkConfiguration networkConfiguration() { + return this.networkConfiguration; + } + + /** + * Set the networkConfiguration property: The network configuration for a pool. + * + * @param networkConfiguration the networkConfiguration value to set. + * @return the PoolInner object itself. + */ + public PoolInner withNetworkConfiguration(NetworkConfiguration networkConfiguration) { + this.networkConfiguration = networkConfiguration; + return this; + } + + /** + * Get the taskSlotsPerNode property: The default value is 1. The maximum value is the smaller of 4 times the number + * of cores of the vmSize of the pool or 256. + * + * @return the taskSlotsPerNode value. + */ + public Integer taskSlotsPerNode() { + return this.taskSlotsPerNode; + } + + /** + * Set the taskSlotsPerNode property: The default value is 1. The maximum value is the smaller of 4 times the number + * of cores of the vmSize of the pool or 256. + * + * @param taskSlotsPerNode the taskSlotsPerNode value to set. + * @return the PoolInner object itself. + */ + public PoolInner withTaskSlotsPerNode(Integer taskSlotsPerNode) { + this.taskSlotsPerNode = taskSlotsPerNode; + return this; + } + + /** + * Get the taskSchedulingPolicy property: If not specified, the default is spread. + * + * @return the taskSchedulingPolicy value. + */ + public TaskSchedulingPolicy taskSchedulingPolicy() { + return this.taskSchedulingPolicy; + } + + /** + * Set the taskSchedulingPolicy property: If not specified, the default is spread. + * + * @param taskSchedulingPolicy the taskSchedulingPolicy value to set. + * @return the PoolInner object itself. + */ + public PoolInner withTaskSchedulingPolicy(TaskSchedulingPolicy taskSchedulingPolicy) { + this.taskSchedulingPolicy = taskSchedulingPolicy; + return this; + } + + /** + * Get the userAccounts property: The list of user accounts to be created on each node in the pool. + * + * @return the userAccounts value. + */ + public List userAccounts() { + return this.userAccounts; + } + + /** + * Set the userAccounts property: The list of user accounts to be created on each node in the pool. + * + * @param userAccounts the userAccounts value to set. + * @return the PoolInner object itself. + */ + public PoolInner withUserAccounts(List userAccounts) { + this.userAccounts = userAccounts; + return this; + } + + /** + * Get the metadata property: The Batch service does not assign any meaning to metadata; it is solely for the use of + * user code. + * + * @return the metadata value. + */ + public List metadata() { + return this.metadata; + } + + /** + * Set the metadata property: The Batch service does not assign any meaning to metadata; it is solely for the use of + * user code. + * + * @param metadata the metadata value to set. + * @return the PoolInner object itself. + */ + public PoolInner withMetadata(List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the startTask property: In an PATCH (update) operation, this property can be set to an empty object to remove + * the start task from the pool. + * + * @return the startTask value. + */ + public StartTask startTask() { + return this.startTask; + } + + /** + * Set the startTask property: In an PATCH (update) operation, this property can be set to an empty object to remove + * the start task from the pool. + * + * @param startTask the startTask value to set. + * @return the PoolInner object itself. + */ + public PoolInner withStartTask(StartTask startTask) { + this.startTask = startTask; + return this; + } + + /** + * Get the certificates property: For Windows compute nodes, the Batch service installs the certificates to the + * specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory + * inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task + * to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in + * the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @return the certificates value. + */ + public List certificates() { + return this.certificates; + } + + /** + * Set the certificates property: For Windows compute nodes, the Batch service installs the certificates to the + * specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory + * inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task + * to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in + * the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @param certificates the certificates value to set. + * @return the PoolInner object itself. + */ + public PoolInner withCertificates(List certificates) { + this.certificates = certificates; + return this; + } + + /** + * Get the applicationPackages property: Changes to application package references affect all new compute nodes + * joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or + * reimaged. There is a maximum of 10 application package references on any given pool. + * + * @return the applicationPackages value. + */ + public List applicationPackages() { + return this.applicationPackages; + } + + /** + * Set the applicationPackages property: Changes to application package references affect all new compute nodes + * joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or + * reimaged. There is a maximum of 10 application package references on any given pool. + * + * @param applicationPackages the applicationPackages value to set. + * @return the PoolInner object itself. + */ + public PoolInner withApplicationPackages(List applicationPackages) { + this.applicationPackages = applicationPackages; + return this; + } + + /** + * Get the applicationLicenses property: The list of application licenses must be a subset of available Batch + * service application licenses. If a license is requested which is not supported, pool creation will fail. + * + * @return the applicationLicenses value. + */ + public List applicationLicenses() { + return this.applicationLicenses; + } + + /** + * Set the applicationLicenses property: The list of application licenses must be a subset of available Batch + * service application licenses. If a license is requested which is not supported, pool creation will fail. + * + * @param applicationLicenses the applicationLicenses value to set. + * @return the PoolInner object itself. + */ + public PoolInner withApplicationLicenses(List applicationLicenses) { + this.applicationLicenses = applicationLicenses; + return this; + } + + /** + * Get the resizeOperationStatus property: Describes either the current operation (if the pool AllocationState is + * Resizing) or the previously completed operation (if the AllocationState is Steady). + * + * @return the resizeOperationStatus value. + */ + public ResizeOperationStatus resizeOperationStatus() { + return this.resizeOperationStatus; + } + + /** + * Get the mountConfiguration property: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + * + * @return the mountConfiguration value. + */ + public List mountConfiguration() { + return this.mountConfiguration; + } + + /** + * Set the mountConfiguration property: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + * + * @param mountConfiguration the mountConfiguration value to set. + * @return the PoolInner object itself. + */ + public PoolInner withMountConfiguration(List mountConfiguration) { + this.mountConfiguration = mountConfiguration; + return this; + } + + /** + * Get the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (deploymentConfiguration() != null) { + deploymentConfiguration().validate(); + } + if (scaleSettings() != null) { + scaleSettings().validate(); + } + if (autoScaleRun() != null) { + autoScaleRun().validate(); + } + if (networkConfiguration() != null) { + networkConfiguration().validate(); + } + if (taskSchedulingPolicy() != null) { + taskSchedulingPolicy().validate(); + } + if (userAccounts() != null) { + userAccounts().forEach(e -> e.validate()); + } + if (metadata() != null) { + metadata().forEach(e -> e.validate()); + } + if (startTask() != null) { + startTask().validate(); + } + if (certificates() != null) { + certificates().forEach(e -> e.validate()); + } + if (applicationPackages() != null) { + applicationPackages().forEach(e -> e.validate()); + } + if (resizeOperationStatus() != null) { + resizeOperationStatus().validate(); + } + if (mountConfiguration() != null) { + mountConfiguration().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PrivateEndpointConnectionInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..77fe26e423ae2 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.models.PrivateEndpoint; +import com.azure.resourcemanager.batch.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.batch.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains information about a private link resource. */ +@JsonFlatten +@Fluent +public class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * The provisioning state of the private endpoint connection. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProvisioningState provisioningState; + + /* + * The private endpoint of the private endpoint connection. + */ + @JsonProperty(value = "properties.privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * The private link service connection state of the private endpoint + * connection + */ + @JsonProperty(value = "properties.privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The ETag of the resource, used for concurrency statements. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the privateEndpoint property: The private endpoint of the private endpoint connection. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint of the private endpoint connection. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: The private link service connection state of the private + * endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: The private link service connection state of the private + * endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PrivateLinkResourceInner.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..b8ad8b016c3a3 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/PrivateLinkResourceInner.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.batch.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Contains information about a private link resource. */ +@JsonFlatten +@Immutable +public class PrivateLinkResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); + + /* + * The group id is used to establish the private link connection. + */ + @JsonProperty(value = "properties.groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The list of required members that are used to establish the private link + * connection. + */ + @JsonProperty(value = "properties.requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The list of required zone names for the private DNS resource name + */ + @JsonProperty(value = "properties.requiredZoneNames", access = JsonProperty.Access.WRITE_ONLY) + private List requiredZoneNames; + + /* + * The ETag of the resource, used for concurrency statements. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the groupId property: The group id is used to establish the private link connection. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The list of required members that are used to establish the private link + * connection. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The list of required zone names for the private DNS resource name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Get the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/package-info.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/package-info.java new file mode 100644 index 0000000000000..84e1c03ace968 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for BatchManagement. null. */ +package com.azure.resourcemanager.batch.fluent.models; diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/package-info.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/package-info.java new file mode 100644 index 0000000000000..9dd56b9920224 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for BatchManagement. null. */ +package com.azure.resourcemanager.batch.fluent; diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationImpl.java new file mode 100644 index 0000000000000..9d92e27a1af85 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.ApplicationInner; +import com.azure.resourcemanager.batch.models.Application; + +public final class ApplicationImpl implements Application, Application.Definition, Application.Update { + private ApplicationInner innerObject; + + private final BatchManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Boolean allowUpdates() { + return this.innerModel().allowUpdates(); + } + + public String defaultVersion() { + return this.innerModel().defaultVersion(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public ApplicationInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String applicationName; + + public ApplicationImpl withExistingBatchAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public Application create() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .createWithResponse(resourceGroupName, accountName, applicationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Application create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .createWithResponse(resourceGroupName, accountName, applicationName, this.innerModel(), context) + .getValue(); + return this; + } + + ApplicationImpl(String name, BatchManager serviceManager) { + this.innerObject = new ApplicationInner(); + this.serviceManager = serviceManager; + this.applicationName = name; + } + + public ApplicationImpl update() { + return this; + } + + public Application apply() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .updateWithResponse(resourceGroupName, accountName, applicationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Application apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .updateWithResponse(resourceGroupName, accountName, applicationName, this.innerModel(), context) + .getValue(); + return this; + } + + ApplicationImpl(ApplicationInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "batchAccounts"); + this.applicationName = Utils.getValueFromIdByName(innerObject.id(), "applications"); + } + + public Application refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .getWithResponse(resourceGroupName, accountName, applicationName, Context.NONE) + .getValue(); + return this; + } + + public Application refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .getWithResponse(resourceGroupName, accountName, applicationName, context) + .getValue(); + return this; + } + + public ApplicationImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public ApplicationImpl withAllowUpdates(Boolean allowUpdates) { + this.innerModel().withAllowUpdates(allowUpdates); + return this; + } + + public ApplicationImpl withDefaultVersion(String defaultVersion) { + this.innerModel().withDefaultVersion(defaultVersion); + return this; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackageImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackageImpl.java new file mode 100644 index 0000000000000..3201dedab836f --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackageImpl.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.ApplicationPackageInner; +import com.azure.resourcemanager.batch.models.ApplicationPackage; +import com.azure.resourcemanager.batch.models.PackageState; +import java.time.OffsetDateTime; + +public final class ApplicationPackageImpl implements ApplicationPackage, ApplicationPackage.Definition { + private ApplicationPackageInner innerObject; + + private final BatchManager serviceManager; + + ApplicationPackageImpl(ApplicationPackageInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PackageState state() { + return this.innerModel().state(); + } + + public String format() { + return this.innerModel().format(); + } + + public String storageUrl() { + return this.innerModel().storageUrl(); + } + + public OffsetDateTime storageUrlExpiry() { + return this.innerModel().storageUrlExpiry(); + } + + public OffsetDateTime lastActivationTime() { + return this.innerModel().lastActivationTime(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public ApplicationPackageInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String applicationName; + + private String versionName; + + public ApplicationPackageImpl withExistingApplication( + String resourceGroupName, String accountName, String applicationName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.applicationName = applicationName; + return this; + } + + public ApplicationPackage create() { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationPackages() + .createWithResponse( + resourceGroupName, accountName, applicationName, versionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ApplicationPackage create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationPackages() + .createWithResponse( + resourceGroupName, accountName, applicationName, versionName, this.innerModel(), context) + .getValue(); + return this; + } + + ApplicationPackageImpl(String name, BatchManager serviceManager) { + this.innerObject = new ApplicationPackageInner(); + this.serviceManager = serviceManager; + this.versionName = name; + } + + public ApplicationPackage refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationPackages() + .getWithResponse(resourceGroupName, accountName, applicationName, versionName, Context.NONE) + .getValue(); + return this; + } + + public ApplicationPackage refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationPackages() + .getWithResponse(resourceGroupName, accountName, applicationName, versionName, context) + .getValue(); + return this; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackagesClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackagesClientImpl.java new file mode 100644 index 0000000000000..23d93d079029d --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackagesClientImpl.java @@ -0,0 +1,1286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.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.batch.fluent.ApplicationPackagesClient; +import com.azure.resourcemanager.batch.fluent.models.ApplicationPackageInner; +import com.azure.resourcemanager.batch.models.ActivateApplicationPackageParameters; +import com.azure.resourcemanager.batch.models.ListApplicationPackagesResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApplicationPackagesClient. */ +public final class ApplicationPackagesClientImpl implements ApplicationPackagesClient { + private final ClientLogger logger = new ClientLogger(ApplicationPackagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ApplicationPackagesService service; + + /** The service client containing this operation class. */ + private final BatchManagementImpl client; + + /** + * Initializes an instance of ApplicationPackagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationPackagesClientImpl(BatchManagementImpl client) { + this.service = + RestProxy.create(ApplicationPackagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementApplicationPackages to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementAppli") + private interface ApplicationPackagesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}/versions/{versionName}/activate") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> activate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @PathParam("versionName") String versionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ActivateApplicationPackageParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}/versions/{versionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @PathParam("versionName") String versionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ApplicationPackageInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}/versions/{versionName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @PathParam("versionName") String versionName, + @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.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}/versions/{versionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @PathParam("versionName") String versionName, + @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.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}/versions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @QueryParam("maxresults") Integer maxresults, + @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); + } + + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> activateWithResponseAsync( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName 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 + .activate( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + versionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> activateWithResponseAsync( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName 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 + .activate( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + versionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono activateAsync( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters) { + return activateWithResponseAsync(resourceGroupName, accountName, applicationName, versionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationPackageInner activate( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters) { + return activateAsync(resourceGroupName, accountName, applicationName, versionName, parameters).block(); + } + + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response activateWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters, + Context context) { + return activateWithResponseAsync( + resourceGroupName, accountName, applicationName, versionName, parameters, context) + .block(); + } + + /** + * Creates an application package record. The record contains the SAS where the package should be uploaded to. Once + * it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be + * used. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ApplicationPackageInner 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName 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) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + versionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates an application package record. The record contains the SAS where the package should be uploaded to. Once + * it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be + * used. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ApplicationPackageInner 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName 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) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + versionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates an application package record. The record contains the SAS where the package should be uploaded to. Once + * it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be + * used. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ApplicationPackageInner parameters) { + return createWithResponseAsync(resourceGroupName, accountName, applicationName, versionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates an application package record. The record contains the SAS where the package should be uploaded to. Once + * it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be + * used. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String accountName, String applicationName, String versionName) { + final ApplicationPackageInner parameters = null; + return createWithResponseAsync(resourceGroupName, accountName, applicationName, versionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates an application package record. The record contains the SAS where the package should be uploaded to. Once + * it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be + * used. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationPackageInner create( + String resourceGroupName, String accountName, String applicationName, String versionName) { + final ApplicationPackageInner parameters = null; + return createAsync(resourceGroupName, accountName, applicationName, versionName, parameters).block(); + } + + /** + * Creates an application package record. The record contains the SAS where the package should be uploaded to. Once + * it is uploaded the `ApplicationPackage` needs to be activated using `ApplicationPackageActive` before it can be + * used. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ApplicationPackageInner parameters, + Context context) { + return createWithResponseAsync( + resourceGroupName, accountName, applicationName, versionName, parameters, context) + .block(); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 applicationName, String versionName) { + 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName 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, + applicationName, + versionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 applicationName, String versionName, 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName 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, + applicationName, + versionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 applicationName, String versionName) { + return deleteWithResponseAsync(resourceGroupName, accountName, applicationName, versionName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 applicationName, String versionName) { + deleteAsync(resourceGroupName, accountName, applicationName, versionName).block(); + } + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 applicationName, String versionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, applicationName, versionName, context).block(); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified application package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String applicationName, String versionName) { + 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + versionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified application package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String applicationName, String versionName, 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (versionName == null) { + return Mono.error(new IllegalArgumentException("Parameter versionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + versionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified application package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String accountName, String applicationName, String versionName) { + return getWithResponseAsync(resourceGroupName, accountName, applicationName, versionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified application package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationPackageInner get( + String resourceGroupName, String accountName, String applicationName, String versionName) { + return getAsync(resourceGroupName, accountName, applicationName, versionName).block(); + } + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified application package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String applicationName, String versionName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, applicationName, versionName, context).block(); + } + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String accountName, String applicationName, Integer maxresults) { + 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName 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, + applicationName, + maxresults, + 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()))); + } + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String accountName, String applicationName, Integer maxresults, 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName 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, + applicationName, + maxresults, + 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)); + } + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String accountName, String applicationName, Integer maxresults) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, accountName, applicationName, maxresults), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String accountName, String applicationName) { + final Integer maxresults = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, accountName, applicationName, maxresults), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String accountName, String applicationName, Integer maxresults, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, accountName, applicationName, maxresults, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String accountName, String applicationName) { + final Integer maxresults = null; + return new PagedIterable<>(listAsync(resourceGroupName, accountName, applicationName, maxresults)); + } + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list application packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String accountName, String applicationName, Integer maxresults, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, accountName, applicationName, maxresults, 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 result of performing list application packages. + */ + @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 result of performing list application packages. + */ + @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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackagesImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackagesImpl.java new file mode 100644 index 0000000000000..5dc08860fd9c0 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationPackagesImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.ApplicationPackagesClient; +import com.azure.resourcemanager.batch.fluent.models.ApplicationPackageInner; +import com.azure.resourcemanager.batch.models.ActivateApplicationPackageParameters; +import com.azure.resourcemanager.batch.models.ApplicationPackage; +import com.azure.resourcemanager.batch.models.ApplicationPackages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ApplicationPackagesImpl implements ApplicationPackages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPackagesImpl.class); + + private final ApplicationPackagesClient innerClient; + + private final BatchManager serviceManager; + + public ApplicationPackagesImpl(ApplicationPackagesClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ApplicationPackage activate( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters) { + ApplicationPackageInner inner = + this.serviceClient().activate(resourceGroupName, accountName, applicationName, versionName, parameters); + if (inner != null) { + return new ApplicationPackageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response activateWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters, + Context context) { + Response inner = + this + .serviceClient() + .activateWithResponse( + resourceGroupName, accountName, applicationName, versionName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationPackageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, String applicationName, String versionName) { + this.serviceClient().delete(resourceGroupName, accountName, applicationName, versionName); + } + + public Response deleteWithResponse( + String resourceGroupName, String accountName, String applicationName, String versionName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, accountName, applicationName, versionName, context); + } + + public ApplicationPackage get( + String resourceGroupName, String accountName, String applicationName, String versionName) { + ApplicationPackageInner inner = + this.serviceClient().get(resourceGroupName, accountName, applicationName, versionName); + if (inner != null) { + return new ApplicationPackageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String applicationName, String versionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, applicationName, versionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationPackageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list( + String resourceGroupName, String accountName, String applicationName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, accountName, applicationName); + return inner.mapPage(inner1 -> new ApplicationPackageImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String accountName, String applicationName, Integer maxresults, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, accountName, applicationName, maxresults, context); + return inner.mapPage(inner1 -> new ApplicationPackageImpl(inner1, this.manager())); + } + + public ApplicationPackage 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + String versionName = Utils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + return this + .getWithResponse(resourceGroupName, accountName, applicationName, versionName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + String versionName = Utils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, applicationName, versionName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + String versionName = Utils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + this.deleteWithResponse(resourceGroupName, accountName, applicationName, versionName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + String versionName = Utils.getValueFromIdByName(id, "versions"); + if (versionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'versions'.", id))); + } + return this.deleteWithResponse(resourceGroupName, accountName, applicationName, versionName, context); + } + + private ApplicationPackagesClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } + + public ApplicationPackageImpl define(String name) { + return new ApplicationPackageImpl(name, this.manager()); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationsClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationsClientImpl.java new file mode 100644 index 0000000000000..d1d2fabdf4c4b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationsClientImpl.java @@ -0,0 +1,1157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.ApplicationsClient; +import com.azure.resourcemanager.batch.fluent.models.ApplicationInner; +import com.azure.resourcemanager.batch.models.ListApplicationsResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public final class ApplicationsClientImpl implements ApplicationsClient { + private final ClientLogger logger = new ClientLogger(ApplicationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ApplicationsService service; + + /** The service client containing this operation class. */ + private final BatchManagementImpl client; + + /** + * Initializes an instance of ApplicationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationsClientImpl(BatchManagementImpl client) { + this.service = + RestProxy.create(ApplicationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementApplications to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementAppli") + private interface ApplicationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ApplicationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @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.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/applications/{applicationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("applicationName") String applicationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") ApplicationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/applications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("maxresults") Integer maxresults, + @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); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String accountName, String applicationName, ApplicationInner 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName 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) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String accountName, + String applicationName, + ApplicationInner 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName 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) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String accountName, String applicationName, ApplicationInner parameters) { + return createWithResponseAsync(resourceGroupName, accountName, applicationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String accountName, String applicationName) { + final ApplicationInner parameters = null; + return createWithResponseAsync(resourceGroupName, accountName, applicationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner create(String resourceGroupName, String accountName, String applicationName) { + final ApplicationInner parameters = null; + return createAsync(resourceGroupName, accountName, applicationName, parameters).block(); + } + + /** + * Adds an application to the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + ApplicationInner parameters, + Context context) { + return createWithResponseAsync(resourceGroupName, accountName, applicationName, parameters, context).block(); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName) { + 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName 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, + applicationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName, 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName 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, + applicationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName) { + return deleteWithResponseAsync(resourceGroupName, accountName, applicationName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName) { + deleteAsync(resourceGroupName, accountName, applicationName).block(); + } + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, accountName, applicationName, context).block(); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String applicationName) { + 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String applicationName, 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String applicationName) { + return getWithResponseAsync(resourceGroupName, accountName, applicationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner get(String resourceGroupName, String accountName, String applicationName) { + return getAsync(resourceGroupName, accountName, applicationName).block(); + } + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String applicationName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, applicationName, context).block(); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, String applicationName, ApplicationInner 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String accountName, + String applicationName, + ApplicationInner 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 (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + applicationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, String applicationName, ApplicationInner parameters) { + return updateWithResponseAsync(resourceGroupName, accountName, applicationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner update( + String resourceGroupName, String accountName, String applicationName, ApplicationInner parameters) { + return updateAsync(resourceGroupName, accountName, applicationName, parameters).block(); + } + + /** + * Updates settings for the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param parameters The parameters for the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an application in a Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + ApplicationInner parameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, accountName, applicationName, parameters, context).block(); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String accountName, Integer maxresults) { + 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, + maxresults, + 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()))); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String accountName, Integer maxresults, 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, + maxresults, + 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)); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String accountName, Integer maxresults) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, accountName, maxresults), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String accountName) { + final Integer maxresults = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, accountName, maxresults), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, accountName, maxresults, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String accountName) { + final Integer maxresults = null; + return new PagedIterable<>(listAsync(resourceGroupName, accountName, maxresults)); + } + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of performing list applications. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, accountName, maxresults, 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 result of performing list applications. + */ + @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 result of performing list applications. + */ + @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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationsImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationsImpl.java new file mode 100644 index 0000000000000..666065a0e043a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/ApplicationsImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.ApplicationsClient; +import com.azure.resourcemanager.batch.fluent.models.ApplicationInner; +import com.azure.resourcemanager.batch.models.Application; +import com.azure.resourcemanager.batch.models.Applications; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ApplicationsImpl implements Applications { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationsImpl.class); + + private final ApplicationsClient innerClient; + + private final BatchManager serviceManager; + + public ApplicationsImpl(ApplicationsClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String accountName, String applicationName) { + this.serviceClient().delete(resourceGroupName, accountName, applicationName); + } + + public Response deleteWithResponse( + String resourceGroupName, String accountName, String applicationName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, accountName, applicationName, context); + } + + public Application get(String resourceGroupName, String accountName, String applicationName) { + ApplicationInner inner = this.serviceClient().get(resourceGroupName, accountName, applicationName); + if (inner != null) { + return new ApplicationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String applicationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, applicationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, accountName, maxresults, context); + return inner.mapPage(inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public Application 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, applicationName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, applicationName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + this.deleteWithResponse(resourceGroupName, accountName, applicationName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.deleteWithResponse(resourceGroupName, accountName, applicationName, context); + } + + private ApplicationsClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } + + public ApplicationImpl define(String name) { + return new ApplicationImpl(name, this.manager()); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountImpl.java new file mode 100644 index 0000000000000..cd316cae44b10 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountImpl.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountInner; +import com.azure.resourcemanager.batch.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.batch.models.AutoStorageBaseProperties; +import com.azure.resourcemanager.batch.models.AutoStorageProperties; +import com.azure.resourcemanager.batch.models.BatchAccount; +import com.azure.resourcemanager.batch.models.BatchAccountCreateParameters; +import com.azure.resourcemanager.batch.models.BatchAccountIdentity; +import com.azure.resourcemanager.batch.models.BatchAccountUpdateParameters; +import com.azure.resourcemanager.batch.models.EncryptionProperties; +import com.azure.resourcemanager.batch.models.KeyVaultReference; +import com.azure.resourcemanager.batch.models.PoolAllocationMode; +import com.azure.resourcemanager.batch.models.PrivateEndpointConnection; +import com.azure.resourcemanager.batch.models.ProvisioningState; +import com.azure.resourcemanager.batch.models.PublicNetworkAccessType; +import com.azure.resourcemanager.batch.models.VirtualMachineFamilyCoreQuota; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class BatchAccountImpl implements BatchAccount, BatchAccount.Definition, BatchAccount.Update { + private BatchAccountInner innerObject; + + private final BatchManager 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 BatchAccountIdentity identity() { + return this.innerModel().identity(); + } + + public String accountEndpoint() { + return this.innerModel().accountEndpoint(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PoolAllocationMode poolAllocationMode() { + return this.innerModel().poolAllocationMode(); + } + + public KeyVaultReference keyVaultReference() { + return this.innerModel().keyVaultReference(); + } + + public PublicNetworkAccessType publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public AutoStorageProperties autoStorage() { + return this.innerModel().autoStorage(); + } + + public EncryptionProperties encryption() { + return this.innerModel().encryption(); + } + + public Integer dedicatedCoreQuota() { + return this.innerModel().dedicatedCoreQuota(); + } + + public Integer lowPriorityCoreQuota() { + return this.innerModel().lowPriorityCoreQuota(); + } + + public List dedicatedCoreQuotaPerVMFamily() { + List inner = this.innerModel().dedicatedCoreQuotaPerVMFamily(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean dedicatedCoreQuotaPerVMFamilyEnforced() { + return this.innerModel().dedicatedCoreQuotaPerVMFamilyEnforced(); + } + + public Integer poolQuota() { + return this.innerModel().poolQuota(); + } + + public Integer activeJobAndJobScheduleQuota() { + return this.innerModel().activeJobAndJobScheduleQuota(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public BatchAccountInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private BatchAccountCreateParameters createParameters; + + private BatchAccountUpdateParameters updateParameters; + + public BatchAccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public BatchAccount create() { + this.innerObject = + serviceManager + .serviceClient() + .getBatchAccounts() + .create(resourceGroupName, accountName, createParameters, Context.NONE); + return this; + } + + public BatchAccount create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBatchAccounts() + .create(resourceGroupName, accountName, createParameters, context); + return this; + } + + BatchAccountImpl(String name, BatchManager serviceManager) { + this.innerObject = new BatchAccountInner(); + this.serviceManager = serviceManager; + this.accountName = name; + this.createParameters = new BatchAccountCreateParameters(); + } + + public BatchAccountImpl update() { + this.updateParameters = new BatchAccountUpdateParameters(); + return this; + } + + public BatchAccount apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBatchAccounts() + .updateWithResponse(resourceGroupName, accountName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public BatchAccount apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBatchAccounts() + .updateWithResponse(resourceGroupName, accountName, updateParameters, context) + .getValue(); + return this; + } + + BatchAccountImpl(BatchAccountInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "batchAccounts"); + } + + public BatchAccount refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getBatchAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public BatchAccount refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBatchAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public BatchAccountImpl withRegion(Region location) { + this.createParameters.withLocation(location.toString()); + return this; + } + + public BatchAccountImpl withRegion(String location) { + this.createParameters.withLocation(location); + return this; + } + + public BatchAccountImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createParameters.withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public BatchAccountImpl withIdentity(BatchAccountIdentity identity) { + if (isInCreateMode()) { + this.createParameters.withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public BatchAccountImpl withAutoStorage(AutoStorageBaseProperties autoStorage) { + if (isInCreateMode()) { + this.createParameters.withAutoStorage(autoStorage); + return this; + } else { + this.updateParameters.withAutoStorage(autoStorage); + return this; + } + } + + public BatchAccountImpl withPoolAllocationMode(PoolAllocationMode poolAllocationMode) { + this.createParameters.withPoolAllocationMode(poolAllocationMode); + return this; + } + + public BatchAccountImpl withKeyVaultReference(KeyVaultReference keyVaultReference) { + this.createParameters.withKeyVaultReference(keyVaultReference); + return this; + } + + public BatchAccountImpl withPublicNetworkAccess(PublicNetworkAccessType publicNetworkAccess) { + this.createParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + public BatchAccountImpl withEncryption(EncryptionProperties encryption) { + if (isInCreateMode()) { + this.createParameters.withEncryption(encryption); + return this; + } else { + this.updateParameters.withEncryption(encryption); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountKeysImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountKeysImpl.java new file mode 100644 index 0000000000000..ed6ab02a4b851 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountKeysImpl.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.batch.implementation; + +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountKeysInner; +import com.azure.resourcemanager.batch.models.BatchAccountKeys; + +public final class BatchAccountKeysImpl implements BatchAccountKeys { + private BatchAccountKeysInner innerObject; + + private final BatchManager serviceManager; + + BatchAccountKeysImpl(BatchAccountKeysInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public String primary() { + return this.innerModel().primary(); + } + + public String secondary() { + return this.innerModel().secondary(); + } + + public BatchAccountKeysInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountsClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountsClientImpl.java new file mode 100644 index 0000000000000..fda2c3ea44845 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountsClientImpl.java @@ -0,0 +1,1989 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.batch.fluent.BatchAccountsClient; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountInner; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountKeysInner; +import com.azure.resourcemanager.batch.models.BatchAccountCreateParameters; +import com.azure.resourcemanager.batch.models.BatchAccountListResult; +import com.azure.resourcemanager.batch.models.BatchAccountRegenerateKeyParameters; +import com.azure.resourcemanager.batch.models.BatchAccountUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BatchAccountsClient. */ +public final class BatchAccountsClientImpl implements BatchAccountsClient { + private final ClientLogger logger = new ClientLogger(BatchAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BatchAccountsService service; + + /** The service client containing this operation class. */ + private final BatchManagementImpl client; + + /** + * Initializes an instance of BatchAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BatchAccountsClientImpl(BatchManagementImpl client) { + this.service = + RestProxy.create(BatchAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementBatchAccounts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementBatch") + private interface BatchAccountsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}") + @ExpectedResponses({200, 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") BatchAccountCreateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}") + @ExpectedResponses({200}) + @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") BatchAccountUpdateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{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.Batch/batchAccounts" + + "/{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}/providers/Microsoft.Batch/batchAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch" + + "/batchAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/syncAutoStorageKeys") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> synchronizeAutoStorageKeys( + @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.Batch/batchAccounts" + + "/{accountName}/regenerateKeys") + @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") BatchAccountRegenerateKeyParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/listKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getKeys( + @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("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String accountName, BatchAccountCreateParameters 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 + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String accountName, BatchAccountCreateParameters 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 + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BatchAccountInner> beginCreateAsync( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + Mono>> mono = createWithResponseAsync(resourceGroupName, accountName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), BatchAccountInner.class, BatchAccountInner.class, Context.NONE); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BatchAccountInner> beginCreateAsync( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, accountName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), BatchAccountInner.class, BatchAccountInner.class, context); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BatchAccountInner> beginCreate( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + return beginCreateAsync(resourceGroupName, accountName, parameters).getSyncPoller(); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BatchAccountInner> beginCreate( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters, Context context) { + return beginCreateAsync(resourceGroupName, accountName, parameters, context).getSyncPoller(); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + return beginCreateAsync(resourceGroupName, accountName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters, Context context) { + return beginCreateAsync(resourceGroupName, accountName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BatchAccountInner create( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters) { + return createAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Creates a new Batch account with the specified parameters. Existing accounts cannot be updated with this API and + * should instead be updated with the Update Batch Account API. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName A name for the Batch account which must be unique within the region. Batch account names must + * be between 3 and 24 characters in length and must use only numbers and lowercase letters. This name is used + * as part of the DNS name that is used to access the Batch service in the region in which the account is + * created. For example: http://accountname.region.batch.azure.com/. + * @param parameters Additional parameters for account creation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BatchAccountInner create( + String resourceGroupName, String accountName, BatchAccountCreateParameters parameters, Context context) { + return createAsync(resourceGroupName, accountName, parameters, context).block(); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters Additional parameters for account update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, BatchAccountUpdateParameters 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 + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters Additional parameters for account update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String accountName, BatchAccountUpdateParameters 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 + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters Additional parameters for account update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters) { + return updateWithResponseAsync(resourceGroupName, accountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters Additional parameters for account update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BatchAccountInner update( + String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters) { + return updateAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Updates the properties of an existing Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters Additional parameters for account update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about an Azure Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String accountName, BatchAccountUpdateParameters parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, accountName, parameters, context).block(); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String accountName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName) { + return beginDeleteAsync(resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context).getSyncPoller(); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 beginDeleteAsync(resourceGroupName, accountName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 deleteAsync(String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, Context context) { + deleteAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + @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()))); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + @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); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + @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(); + } + }); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BatchAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupAsync(resourceGroupName, accountName).block(); + } + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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> synchronizeAutoStorageKeysWithResponseAsync( + 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 + .synchronizeAutoStorageKeys( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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> synchronizeAutoStorageKeysWithResponseAsync( + 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 + .synchronizeAutoStorageKeys( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 synchronizeAutoStorageKeysAsync(String resourceGroupName, String accountName) { + return synchronizeAutoStorageKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 synchronizeAutoStorageKeys(String resourceGroupName, String accountName) { + synchronizeAutoStorageKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 synchronizeAutoStorageKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return synchronizeAutoStorageKeysWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeyWithResponseAsync( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters 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 Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeyWithResponseAsync( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters 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 Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters 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 Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BatchAccountKeysInner regenerateKey( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters parameters) { + return regenerateKeyAsync(resourceGroupName, accountName, parameters).block(); + } + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateKeyWithResponse( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters parameters, Context context) { + return regenerateKeyWithResponseAsync(resourceGroupName, accountName, parameters, context).block(); + } + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getKeysWithResponseAsync( + 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 + .getKeys( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getKeysWithResponseAsync( + 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 + .getKeys( + this.client.getEndpoint(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getKeysAsync(String resourceGroupName, String accountName) { + return getKeysWithResponseAsync(resourceGroupName, accountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BatchAccountKeysInner getKeys(String resourceGroupName, String accountName) { + return getKeysAsync(resourceGroupName, accountName).block(); + } + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return getKeysWithResponseAsync(resourceGroupName, accountName, 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 values returned by the List operation. + */ + @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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountsImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountsImpl.java new file mode 100644 index 0000000000000..e168af97eeaf1 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchAccountsImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.BatchAccountsClient; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountInner; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountKeysInner; +import com.azure.resourcemanager.batch.models.BatchAccount; +import com.azure.resourcemanager.batch.models.BatchAccountKeys; +import com.azure.resourcemanager.batch.models.BatchAccountRegenerateKeyParameters; +import com.azure.resourcemanager.batch.models.BatchAccounts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BatchAccountsImpl implements BatchAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountsImpl.class); + + private final BatchAccountsClient innerClient; + + private final BatchManager serviceManager; + + public BatchAccountsImpl(BatchAccountsClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public void delete(String resourceGroupName, String accountName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, context); + } + + public BatchAccount getByResourceGroup(String resourceGroupName, String accountName) { + BatchAccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new BatchAccountImpl(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 BatchAccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new BatchAccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new BatchAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new BatchAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new BatchAccountImpl(inner1, this.manager())); + } + + public void synchronizeAutoStorageKeys(String resourceGroupName, String accountName) { + this.serviceClient().synchronizeAutoStorageKeys(resourceGroupName, accountName); + } + + public Response synchronizeAutoStorageKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + return this.serviceClient().synchronizeAutoStorageKeysWithResponse(resourceGroupName, accountName, context); + } + + public BatchAccountKeys regenerateKey( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters parameters) { + BatchAccountKeysInner inner = this.serviceClient().regenerateKey(resourceGroupName, accountName, parameters); + if (inner != null) { + return new BatchAccountKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateKeyWithResponse( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters 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 BatchAccountKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BatchAccountKeys getKeys(String resourceGroupName, String accountName) { + BatchAccountKeysInner inner = this.serviceClient().getKeys(resourceGroupName, accountName); + if (inner != null) { + return new BatchAccountKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getKeysWithResponse( + String resourceGroupName, String accountName, Context context) { + Response inner = + this.serviceClient().getKeysWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BatchAccountKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BatchAccount 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, context); + } + + private BatchAccountsClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } + + public BatchAccountImpl define(String name) { + return new BatchAccountImpl(name, this.manager()); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchLocationQuotaImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchLocationQuotaImpl.java new file mode 100644 index 0000000000000..68d91e454561a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchLocationQuotaImpl.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.batch.implementation; + +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.BatchLocationQuotaInner; +import com.azure.resourcemanager.batch.models.BatchLocationQuota; + +public final class BatchLocationQuotaImpl implements BatchLocationQuota { + private BatchLocationQuotaInner innerObject; + + private final BatchManager serviceManager; + + BatchLocationQuotaImpl(BatchLocationQuotaInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer accountQuota() { + return this.innerModel().accountQuota(); + } + + public BatchLocationQuotaInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchManagementBuilder.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchManagementBuilder.java new file mode 100644 index 0000000000000..4330caf2ccbcf --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchManagementBuilder.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 BatchManagementImpl type. */ +@ServiceClientBuilder(serviceClients = {BatchManagementImpl.class}) +public final class BatchManagementBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the BatchManagementBuilder. + */ + public BatchManagementBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the BatchManagementBuilder. + */ + public BatchManagementBuilder 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 BatchManagementBuilder. + */ + public BatchManagementBuilder 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 BatchManagementBuilder. + */ + public BatchManagementBuilder 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 BatchManagementBuilder. + */ + public BatchManagementBuilder 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 BatchManagementBuilder. + */ + public BatchManagementBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of BatchManagementImpl with the provided parameters. + * + * @return an instance of BatchManagementImpl. + */ + public BatchManagementImpl 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(); + } + BatchManagementImpl client = + new BatchManagementImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchManagementImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchManagementImpl.java new file mode 100644 index 0000000000000..e899a0405fe1a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/BatchManagementImpl.java @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.fluent.ApplicationPackagesClient; +import com.azure.resourcemanager.batch.fluent.ApplicationsClient; +import com.azure.resourcemanager.batch.fluent.BatchAccountsClient; +import com.azure.resourcemanager.batch.fluent.BatchManagement; +import com.azure.resourcemanager.batch.fluent.CertificatesClient; +import com.azure.resourcemanager.batch.fluent.LocationsClient; +import com.azure.resourcemanager.batch.fluent.OperationsClient; +import com.azure.resourcemanager.batch.fluent.PoolsClient; +import com.azure.resourcemanager.batch.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.batch.fluent.PrivateLinkResourcesClient; +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 BatchManagementImpl type. */ +@ServiceClient(builder = BatchManagementBuilder.class) +public final class BatchManagementImpl implements BatchManagement { + private final ClientLogger logger = new ClientLogger(BatchManagementImpl.class); + + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @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 BatchAccountsClient object to access its operations. */ + private final BatchAccountsClient batchAccounts; + + /** + * Gets the BatchAccountsClient object to access its operations. + * + * @return the BatchAccountsClient object. + */ + public BatchAccountsClient getBatchAccounts() { + return this.batchAccounts; + } + + /** The ApplicationPackagesClient object to access its operations. */ + private final ApplicationPackagesClient applicationPackages; + + /** + * Gets the ApplicationPackagesClient object to access its operations. + * + * @return the ApplicationPackagesClient object. + */ + public ApplicationPackagesClient getApplicationPackages() { + return this.applicationPackages; + } + + /** The ApplicationsClient object to access its operations. */ + private final ApplicationsClient applications; + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + public ApplicationsClient getApplications() { + return this.applications; + } + + /** The LocationsClient object to access its operations. */ + private final LocationsClient locations; + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + public LocationsClient getLocations() { + return this.locations; + } + + /** 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 CertificatesClient object to access its operations. */ + private final CertificatesClient certificates; + + /** + * Gets the CertificatesClient object to access its operations. + * + * @return the CertificatesClient object. + */ + public CertificatesClient getCertificates() { + return this.certificates; + } + + /** 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; + } + + /** 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 PoolsClient object to access its operations. */ + private final PoolsClient pools; + + /** + * Gets the PoolsClient object to access its operations. + * + * @return the PoolsClient object. + */ + public PoolsClient getPools() { + return this.pools; + } + + /** + * Initializes an instance of BatchManagement 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 Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + BatchManagementImpl( + 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 = "2021-01-01"; + this.batchAccounts = new BatchAccountsClientImpl(this); + this.applicationPackages = new ApplicationPackagesClientImpl(this); + this.applications = new ApplicationsClientImpl(this); + this.locations = new LocationsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.certificates = new CertificatesClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.pools = new PoolsClientImpl(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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificateImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificateImpl.java new file mode 100644 index 0000000000000..c549b9730e083 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificateImpl.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.batch.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; +import com.azure.resourcemanager.batch.models.Certificate; +import com.azure.resourcemanager.batch.models.CertificateCreateOrUpdateParameters; +import com.azure.resourcemanager.batch.models.CertificateFormat; +import com.azure.resourcemanager.batch.models.CertificateProvisioningState; +import com.azure.resourcemanager.batch.models.DeleteCertificateError; +import java.time.OffsetDateTime; + +public final class CertificateImpl implements Certificate, Certificate.Definition, Certificate.Update { + private CertificateInner innerObject; + + private final BatchManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String thumbprintAlgorithm() { + return this.innerModel().thumbprintAlgorithm(); + } + + public String thumbprint() { + return this.innerModel().thumbprint(); + } + + public CertificateFormat format() { + return this.innerModel().format(); + } + + public CertificateProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime provisioningStateTransitionTime() { + return this.innerModel().provisioningStateTransitionTime(); + } + + public CertificateProvisioningState previousProvisioningState() { + return this.innerModel().previousProvisioningState(); + } + + public OffsetDateTime previousProvisioningStateTransitionTime() { + return this.innerModel().previousProvisioningStateTransitionTime(); + } + + public String publicData() { + return this.innerModel().publicData(); + } + + public DeleteCertificateError deleteCertificateError() { + return this.innerModel().deleteCertificateError(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public CertificateInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String certificateName; + + private String createIfMatch; + + private String createIfNoneMatch; + + private CertificateCreateOrUpdateParameters createParameters; + + private String updateIfMatch; + + private CertificateCreateOrUpdateParameters updateParameters; + + public CertificateImpl withExistingBatchAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public Certificate create() { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .createWithResponse( + resourceGroupName, + accountName, + certificateName, + createParameters, + createIfMatch, + createIfNoneMatch, + Context.NONE) + .getValue(); + return this; + } + + public Certificate create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .createWithResponse( + resourceGroupName, + accountName, + certificateName, + createParameters, + createIfMatch, + createIfNoneMatch, + context) + .getValue(); + return this; + } + + CertificateImpl(String name, BatchManager serviceManager) { + this.innerObject = new CertificateInner(); + this.serviceManager = serviceManager; + this.certificateName = name; + this.createIfMatch = null; + this.createIfNoneMatch = null; + this.createParameters = new CertificateCreateOrUpdateParameters(); + } + + public CertificateImpl update() { + this.updateIfMatch = null; + this.updateParameters = new CertificateCreateOrUpdateParameters(); + return this; + } + + public Certificate apply() { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .updateWithResponse( + resourceGroupName, accountName, certificateName, updateParameters, updateIfMatch, Context.NONE) + .getValue(); + return this; + } + + public Certificate apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .updateWithResponse( + resourceGroupName, accountName, certificateName, updateParameters, updateIfMatch, context) + .getValue(); + return this; + } + + CertificateImpl(CertificateInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "batchAccounts"); + this.certificateName = Utils.getValueFromIdByName(innerObject.id(), "certificates"); + } + + public Certificate refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .getWithResponse(resourceGroupName, accountName, certificateName, Context.NONE) + .getValue(); + return this; + } + + public Certificate refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getCertificates() + .getWithResponse(resourceGroupName, accountName, certificateName, context) + .getValue(); + return this; + } + + public CertificateImpl withThumbprintAlgorithm(String thumbprintAlgorithm) { + if (isInCreateMode()) { + this.createParameters.withThumbprintAlgorithm(thumbprintAlgorithm); + return this; + } else { + this.updateParameters.withThumbprintAlgorithm(thumbprintAlgorithm); + return this; + } + } + + public CertificateImpl withThumbprint(String thumbprint) { + if (isInCreateMode()) { + this.createParameters.withThumbprint(thumbprint); + return this; + } else { + this.updateParameters.withThumbprint(thumbprint); + return this; + } + } + + public CertificateImpl withFormat(CertificateFormat format) { + if (isInCreateMode()) { + this.createParameters.withFormat(format); + return this; + } else { + this.updateParameters.withFormat(format); + return this; + } + } + + public CertificateImpl withData(String data) { + if (isInCreateMode()) { + this.createParameters.withData(data); + return this; + } else { + this.updateParameters.withData(data); + return this; + } + } + + public CertificateImpl withPassword(String password) { + if (isInCreateMode()) { + this.createParameters.withPassword(password); + return this; + } else { + this.updateParameters.withPassword(password); + return this; + } + } + + public CertificateImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.createIfMatch = ifMatch; + return this; + } else { + this.updateIfMatch = ifMatch; + return this; + } + } + + public CertificateImpl withIfNoneMatch(String ifNoneMatch) { + this.createIfNoneMatch = ifNoneMatch; + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificatesClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificatesClientImpl.java new file mode 100644 index 0000000000000..943b9c95b3dbe --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificatesClientImpl.java @@ -0,0 +1,1661 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.batch.fluent.CertificatesClient; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; +import com.azure.resourcemanager.batch.models.CertificateCreateOrUpdateParameters; +import com.azure.resourcemanager.batch.models.CertificatesCancelDeletionResponse; +import com.azure.resourcemanager.batch.models.CertificatesCreateResponse; +import com.azure.resourcemanager.batch.models.CertificatesGetResponse; +import com.azure.resourcemanager.batch.models.CertificatesUpdateResponse; +import com.azure.resourcemanager.batch.models.ListCertificatesResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CertificatesClient. */ +public final class CertificatesClientImpl implements CertificatesClient { + private final ClientLogger logger = new ClientLogger(CertificatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CertificatesService service; + + /** The service client containing this operation class. */ + private final BatchManagementImpl client; + + /** + * Initializes an instance of CertificatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CertificatesClientImpl(BatchManagementImpl client) { + this.service = + RestProxy.create(CertificatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementCertificates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementCerti") + private interface CertificatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/certificates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBatchAccount( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("maxresults") Integer maxresults, + @QueryParam("$select") String select, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CertificateCreateOrUpdateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("certificateName") String certificateName, + @HeaderParam("If-Match") String ifMatch, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CertificateCreateOrUpdateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/certificates/{certificateName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("certificateName") String certificateName, + @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.Batch/batchAccounts" + + "/{accountName}/certificates/{certificateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("certificateName") String certificateName, + @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.Batch/batchAccounts" + + "/{accountName}/certificates/{certificateName}/cancelDelete") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono cancelDeletion( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("certificateName") String certificateName, + @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> listByBatchAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are "properties/provisioningState", + * "properties/provisioningStateTransitionTime", "name". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountSinglePageAsync( + String resourceGroupName, String accountName, Integer maxresults, String select, 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 + .listByBatchAccount( + this.client.getEndpoint(), + resourceGroupName, + accountName, + maxresults, + select, + filter, + 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()))); + } + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are "properties/provisioningState", + * "properties/provisioningStateTransitionTime", "name". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountSinglePageAsync( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + 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 + .listByBatchAccount( + this.client.getEndpoint(), + resourceGroupName, + accountName, + maxresults, + select, + filter, + 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)); + } + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are "properties/provisioningState", + * "properties/provisioningStateTransitionTime", "name". + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, String accountName, Integer maxresults, String select, String filter) { + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults, select, filter), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync(String resourceGroupName, String accountName) { + final Integer maxresults = null; + final String select = null; + final String filter = null; + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults, select, filter), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are "properties/provisioningState", + * "properties/provisioningStateTransitionTime", "name". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults, select, filter, context), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBatchAccount(String resourceGroupName, String accountName) { + final Integer maxresults = null; + final String select = null; + final String filter = null; + return new PagedIterable<>(listByBatchAccountAsync(resourceGroupName, accountName, maxresults, select, filter)); + } + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are "properties/provisioningState", + * "properties/provisioningStateTransitionTime", "name". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBatchAccount( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context) { + return new PagedIterable<>( + listByBatchAccountAsync(resourceGroupName, accountName, maxresults, select, filter, context)); + } + + /** + * Creates a new certificate inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Additional parameters for certificate creation. + * @param ifMatch The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply + * the operation only if the certificate already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new certificate to be created, but to prevent updating an existing + * certificate. Other values will be ignored. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createWithResponseAsync( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch, + String ifNoneMatch) { + 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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 + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + certificateName, + ifMatch, + ifNoneMatch, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new certificate inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Additional parameters for certificate creation. + * @param ifMatch The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply + * the operation only if the certificate already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new certificate to be created, but to prevent updating an existing + * certificate. Other values will be ignored. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createWithResponseAsync( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch, + String ifNoneMatch, + 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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 + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + certificateName, + ifMatch, + ifNoneMatch, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates a new certificate inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Additional parameters for certificate creation. + * @param ifMatch The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply + * the operation only if the certificate already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new certificate to be created, but to prevent updating an existing + * certificate. Other values will be ignored. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch, + String ifNoneMatch) { + return createWithResponseAsync( + resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch) + .flatMap( + (CertificatesCreateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new certificate inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Additional parameters for certificate creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters) { + final String ifMatch = null; + final String ifNoneMatch = null; + return createWithResponseAsync( + resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch) + .flatMap( + (CertificatesCreateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new certificate inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Additional parameters for certificate creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateInner create( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters) { + final String ifMatch = null; + final String ifNoneMatch = null; + return createAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch).block(); + } + + /** + * Creates a new certificate inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Additional parameters for certificate creation. + * @param ifMatch The entity state (ETag) version of the certificate to update. A value of "*" can be used to apply + * the operation only if the certificate already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new certificate to be created, but to prevent updating an existing + * certificate. Other values will be ignored. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch, + String ifNoneMatch, + Context context) { + return createWithResponseAsync( + resourceGroupName, accountName, certificateName, parameters, ifMatch, ifNoneMatch, context) + .block(); + } + + /** + * Updates the properties of an existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Certificate entity to update. + * @param ifMatch The entity state (ETag) version of the certificate to update. This value can be omitted or set to + * "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateWithResponseAsync( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch) { + 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + certificateName, + ifMatch, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates the properties of an existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Certificate entity to update. + * @param ifMatch The entity state (ETag) version of the certificate to update. This value can be omitted or set to + * "*" to apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateWithResponseAsync( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch, + 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + certificateName, + ifMatch, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates the properties of an existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Certificate entity to update. + * @param ifMatch The entity state (ETag) version of the certificate to update. This value can be omitted or set to + * "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch) { + return updateWithResponseAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch) + .flatMap( + (CertificatesUpdateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of an existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Certificate entity to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters) { + final String ifMatch = null; + return updateWithResponseAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch) + .flatMap( + (CertificatesUpdateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of an existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Certificate entity to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateInner update( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters) { + final String ifMatch = null; + return updateAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch).block(); + } + + /** + * Updates the properties of an existing certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param parameters Certificate entity to update. + * @param ifMatch The entity state (ETag) version of the certificate to update. This value can be omitted or set to + * "*" to apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String accountName, + String certificateName, + CertificateCreateOrUpdateParameters parameters, + String ifMatch, + Context context) { + return updateWithResponseAsync(resourceGroupName, accountName, certificateName, parameters, ifMatch, context) + .block(); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 certificateName) { + 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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, + certificateName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 certificateName, 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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, + certificateName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String certificateName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, certificateName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String certificateName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, certificateName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String certificateName) { + return beginDeleteAsync(resourceGroupName, accountName, certificateName).getSyncPoller(); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String certificateName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, certificateName, context).getSyncPoller(); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 certificateName) { + return beginDeleteAsync(resourceGroupName, accountName, certificateName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 certificateName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, certificateName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 certificateName) { + deleteAsync(resourceGroupName, accountName, certificateName).block(); + } + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 certificateName, Context context) { + deleteAsync(resourceGroupName, accountName, certificateName, context).block(); + } + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync( + String resourceGroupName, String accountName, String certificateName) { + 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + certificateName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync( + String resourceGroupName, String accountName, String certificateName, 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + certificateName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String certificateName) { + return getWithResponseAsync(resourceGroupName, accountName, certificateName) + .flatMap( + (CertificatesGetResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateInner get(String resourceGroupName, String accountName, String certificateName) { + return getAsync(resourceGroupName, accountName, certificateName).block(); + } + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String certificateName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, certificateName, context).block(); + } + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelDeletionWithResponseAsync( + String resourceGroupName, String accountName, String certificateName) { + 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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 + .cancelDeletion( + this.client.getEndpoint(), + resourceGroupName, + accountName, + certificateName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelDeletionWithResponseAsync( + String resourceGroupName, String accountName, String certificateName, 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 (certificateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter certificateName 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 + .cancelDeletion( + this.client.getEndpoint(), + resourceGroupName, + accountName, + certificateName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelDeletionAsync( + String resourceGroupName, String accountName, String certificateName) { + return cancelDeletionWithResponseAsync(resourceGroupName, accountName, certificateName) + .flatMap( + (CertificatesCancelDeletionResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateInner cancelDeletion(String resourceGroupName, String accountName, String certificateName) { + return cancelDeletionAsync(resourceGroupName, accountName, certificateName).block(); + } + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelDeletionWithResponse( + String resourceGroupName, String accountName, String certificateName, Context context) { + return cancelDeletionWithResponseAsync(resourceGroupName, accountName, certificateName, 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountNextSinglePageAsync(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.listByBatchAccountNext(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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountNextSinglePageAsync( + 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 + .listByBatchAccountNext(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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificatesImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificatesImpl.java new file mode 100644 index 0000000000000..734304e71573d --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CertificatesImpl.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.CertificatesClient; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; +import com.azure.resourcemanager.batch.models.Certificate; +import com.azure.resourcemanager.batch.models.Certificates; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CertificatesImpl implements Certificates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificatesImpl.class); + + private final CertificatesClient innerClient; + + private final BatchManager serviceManager; + + public CertificatesImpl(CertificatesClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBatchAccount(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listByBatchAccount(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new CertificateImpl(inner1, this.manager())); + } + + public PagedIterable listByBatchAccount( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByBatchAccount(resourceGroupName, accountName, maxresults, select, filter, context); + return inner.mapPage(inner1 -> new CertificateImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String accountName, String certificateName) { + this.serviceClient().delete(resourceGroupName, accountName, certificateName); + } + + public void delete(String resourceGroupName, String accountName, String certificateName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, certificateName, context); + } + + public Certificate get(String resourceGroupName, String accountName, String certificateName) { + CertificateInner inner = this.serviceClient().get(resourceGroupName, accountName, certificateName); + if (inner != null) { + return new CertificateImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String certificateName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, certificateName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Certificate cancelDeletion(String resourceGroupName, String accountName, String certificateName) { + CertificateInner inner = this.serviceClient().cancelDeletion(resourceGroupName, accountName, certificateName); + if (inner != null) { + return new CertificateImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelDeletionWithResponse( + String resourceGroupName, String accountName, String certificateName, Context context) { + Response inner = + this.serviceClient().cancelDeletionWithResponse(resourceGroupName, accountName, certificateName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CertificateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Certificate 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, certificateName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, certificateName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", id))); + } + this.delete(resourceGroupName, accountName, certificateName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String certificateName = Utils.getValueFromIdByName(id, "certificates"); + if (certificateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificates'.", id))); + } + this.delete(resourceGroupName, accountName, certificateName, context); + } + + private CertificatesClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } + + public CertificateImpl define(String name) { + return new CertificateImpl(name, this.manager()); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CheckNameAvailabilityResultImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 0000000000000..9b6519e81e3d7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/CheckNameAvailabilityResultImpl.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.batch.implementation; + +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.batch.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.batch.models.NameAvailabilityReason; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final BatchManager serviceManager; + + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public NameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/LocationsClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/LocationsClientImpl.java new file mode 100644 index 0000000000000..a0558e6df47aa --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/LocationsClientImpl.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.LocationsClient; +import com.azure.resourcemanager.batch.fluent.models.BatchLocationQuotaInner; +import com.azure.resourcemanager.batch.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.batch.models.CheckNameAvailabilityParameters; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public final class LocationsClientImpl implements LocationsClient { + private final ClientLogger logger = new ClientLogger(LocationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LocationsService service; + + /** The service client containing this operation class. */ + private final BatchManagementImpl client; + + /** + * Initializes an instance of LocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationsClientImpl(BatchManagementImpl client) { + this.service = + RestProxy.create(LocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementLocations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementLocat") + private interface LocationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/quotas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getQuotas( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Batch/locations/{locationName}/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CheckNameAvailabilityParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Batch service quotas for the specified subscription at the given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getQuotasWithResponseAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName 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 + .getQuotas( + this.client.getEndpoint(), + locationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Batch service quotas for the specified subscription at the given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getQuotasWithResponseAsync(String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName 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 + .getQuotas( + this.client.getEndpoint(), + locationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Batch service quotas for the specified subscription at the given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getQuotasAsync(String locationName) { + return getQuotasWithResponseAsync(locationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Batch service quotas for the specified subscription at the given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BatchLocationQuotaInner getQuotas(String locationName) { + return getQuotasAsync(locationName).block(); + } + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Batch service quotas for the specified subscription at the given location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getQuotasWithResponse(String locationName, Context context) { + return getQuotasWithResponseAsync(locationName, context).block(); + } + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String locationName, CheckNameAvailabilityParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName 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 + .checkNameAvailability( + this.client.getEndpoint(), + locationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String locationName, CheckNameAvailabilityParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName 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 + .checkNameAvailability( + this.client.getEndpoint(), + locationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + String locationName, CheckNameAvailabilityParameters parameters) { + return checkNameAvailabilityWithResponseAsync(locationName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResultInner checkNameAvailability( + String locationName, CheckNameAvailabilityParameters parameters) { + return checkNameAvailabilityAsync(locationName, parameters).block(); + } + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + String locationName, CheckNameAvailabilityParameters parameters, Context context) { + return checkNameAvailabilityWithResponseAsync(locationName, parameters, context).block(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/LocationsImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/LocationsImpl.java new file mode 100644 index 0000000000000..3796baa77be6d --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/LocationsImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.LocationsClient; +import com.azure.resourcemanager.batch.fluent.models.BatchLocationQuotaInner; +import com.azure.resourcemanager.batch.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.batch.models.BatchLocationQuota; +import com.azure.resourcemanager.batch.models.CheckNameAvailabilityParameters; +import com.azure.resourcemanager.batch.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.batch.models.Locations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationsImpl implements Locations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationsImpl.class); + + private final LocationsClient innerClient; + + private final BatchManager serviceManager; + + public LocationsImpl(LocationsClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public BatchLocationQuota getQuotas(String locationName) { + BatchLocationQuotaInner inner = this.serviceClient().getQuotas(locationName); + if (inner != null) { + return new BatchLocationQuotaImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getQuotasWithResponse(String locationName, Context context) { + Response inner = this.serviceClient().getQuotasWithResponse(locationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BatchLocationQuotaImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResult checkNameAvailability( + String locationName, CheckNameAvailabilityParameters parameters) { + CheckNameAvailabilityResultInner inner = this.serviceClient().checkNameAvailability(locationName, parameters); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + String locationName, CheckNameAvailabilityParameters parameters, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(locationName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private LocationsClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationImpl.java new file mode 100644 index 0000000000000..6c15b7b6e47c6 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationImpl.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.batch.implementation; + +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.OperationInner; +import com.azure.resourcemanager.batch.models.Operation; +import com.azure.resourcemanager.batch.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final BatchManager serviceManager; + + OperationImpl(OperationInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationsClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..42b7f7a300138 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/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.batch.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.batch.fluent.OperationsClient; +import com.azure.resourcemanager.batch.fluent.models.OperationInner; +import com.azure.resourcemanager.batch.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final BatchManagementImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(BatchManagementImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementOpera") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Batch/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 available operations for the Microsoft.Batch provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationsImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..8541235b1aa52 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/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.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.OperationsClient; +import com.azure.resourcemanager.batch.fluent.models.OperationInner; +import com.azure.resourcemanager.batch.models.Operation; +import com.azure.resourcemanager.batch.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 BatchManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolImpl.java new file mode 100644 index 0000000000000..0ec912c2a041e --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolImpl.java @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; +import com.azure.resourcemanager.batch.models.AllocationState; +import com.azure.resourcemanager.batch.models.ApplicationPackageReference; +import com.azure.resourcemanager.batch.models.AutoScaleRun; +import com.azure.resourcemanager.batch.models.BatchPoolIdentity; +import com.azure.resourcemanager.batch.models.CertificateReference; +import com.azure.resourcemanager.batch.models.DeploymentConfiguration; +import com.azure.resourcemanager.batch.models.InterNodeCommunicationState; +import com.azure.resourcemanager.batch.models.MetadataItem; +import com.azure.resourcemanager.batch.models.MountConfiguration; +import com.azure.resourcemanager.batch.models.NetworkConfiguration; +import com.azure.resourcemanager.batch.models.Pool; +import com.azure.resourcemanager.batch.models.PoolProvisioningState; +import com.azure.resourcemanager.batch.models.ResizeOperationStatus; +import com.azure.resourcemanager.batch.models.ScaleSettings; +import com.azure.resourcemanager.batch.models.StartTask; +import com.azure.resourcemanager.batch.models.TaskSchedulingPolicy; +import com.azure.resourcemanager.batch.models.UserAccount; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class PoolImpl implements Pool, Pool.Definition, Pool.Update { + private PoolInner innerObject; + + private final BatchManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public BatchPoolIdentity identity() { + return this.innerModel().identity(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public OffsetDateTime lastModified() { + return this.innerModel().lastModified(); + } + + public OffsetDateTime creationTime() { + return this.innerModel().creationTime(); + } + + public PoolProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public OffsetDateTime provisioningStateTransitionTime() { + return this.innerModel().provisioningStateTransitionTime(); + } + + public AllocationState allocationState() { + return this.innerModel().allocationState(); + } + + public OffsetDateTime allocationStateTransitionTime() { + return this.innerModel().allocationStateTransitionTime(); + } + + public String vmSize() { + return this.innerModel().vmSize(); + } + + public DeploymentConfiguration deploymentConfiguration() { + return this.innerModel().deploymentConfiguration(); + } + + public Integer currentDedicatedNodes() { + return this.innerModel().currentDedicatedNodes(); + } + + public Integer currentLowPriorityNodes() { + return this.innerModel().currentLowPriorityNodes(); + } + + public ScaleSettings scaleSettings() { + return this.innerModel().scaleSettings(); + } + + public AutoScaleRun autoScaleRun() { + return this.innerModel().autoScaleRun(); + } + + public InterNodeCommunicationState interNodeCommunication() { + return this.innerModel().interNodeCommunication(); + } + + public NetworkConfiguration networkConfiguration() { + return this.innerModel().networkConfiguration(); + } + + public Integer taskSlotsPerNode() { + return this.innerModel().taskSlotsPerNode(); + } + + public TaskSchedulingPolicy taskSchedulingPolicy() { + return this.innerModel().taskSchedulingPolicy(); + } + + public List userAccounts() { + List inner = this.innerModel().userAccounts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List metadata() { + List inner = this.innerModel().metadata(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public StartTask startTask() { + return this.innerModel().startTask(); + } + + public List certificates() { + List inner = this.innerModel().certificates(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List applicationPackages() { + List inner = this.innerModel().applicationPackages(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List applicationLicenses() { + List inner = this.innerModel().applicationLicenses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResizeOperationStatus resizeOperationStatus() { + return this.innerModel().resizeOperationStatus(); + } + + public List mountConfiguration() { + List inner = this.innerModel().mountConfiguration(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public PoolInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String poolName; + + private String createIfMatch; + + private String createIfNoneMatch; + + private String updateIfMatch; + + public PoolImpl withExistingBatchAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public Pool create() { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .createWithResponse( + resourceGroupName, + accountName, + poolName, + this.innerModel(), + createIfMatch, + createIfNoneMatch, + Context.NONE) + .getValue(); + return this; + } + + public Pool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .createWithResponse( + resourceGroupName, + accountName, + poolName, + this.innerModel(), + createIfMatch, + createIfNoneMatch, + context) + .getValue(); + return this; + } + + PoolImpl(String name, BatchManager serviceManager) { + this.innerObject = new PoolInner(); + this.serviceManager = serviceManager; + this.poolName = name; + this.createIfMatch = null; + this.createIfNoneMatch = null; + } + + public PoolImpl update() { + this.updateIfMatch = null; + return this; + } + + public Pool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .updateWithResponse( + resourceGroupName, accountName, poolName, this.innerModel(), updateIfMatch, Context.NONE) + .getValue(); + return this; + } + + public Pool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .updateWithResponse(resourceGroupName, accountName, poolName, this.innerModel(), updateIfMatch, context) + .getValue(); + return this; + } + + PoolImpl(PoolInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = Utils.getValueFromIdByName(innerObject.id(), "batchAccounts"); + this.poolName = Utils.getValueFromIdByName(innerObject.id(), "pools"); + } + + public Pool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .getWithResponse(resourceGroupName, accountName, poolName, Context.NONE) + .getValue(); + return this; + } + + public Pool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPools() + .getWithResponse(resourceGroupName, accountName, poolName, context) + .getValue(); + return this; + } + + public PoolImpl withIdentity(BatchPoolIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public PoolImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public PoolImpl withVmSize(String vmSize) { + this.innerModel().withVmSize(vmSize); + return this; + } + + public PoolImpl withDeploymentConfiguration(DeploymentConfiguration deploymentConfiguration) { + this.innerModel().withDeploymentConfiguration(deploymentConfiguration); + return this; + } + + public PoolImpl withScaleSettings(ScaleSettings scaleSettings) { + this.innerModel().withScaleSettings(scaleSettings); + return this; + } + + public PoolImpl withInterNodeCommunication(InterNodeCommunicationState interNodeCommunication) { + this.innerModel().withInterNodeCommunication(interNodeCommunication); + return this; + } + + public PoolImpl withNetworkConfiguration(NetworkConfiguration networkConfiguration) { + this.innerModel().withNetworkConfiguration(networkConfiguration); + return this; + } + + public PoolImpl withTaskSlotsPerNode(Integer taskSlotsPerNode) { + this.innerModel().withTaskSlotsPerNode(taskSlotsPerNode); + return this; + } + + public PoolImpl withTaskSchedulingPolicy(TaskSchedulingPolicy taskSchedulingPolicy) { + this.innerModel().withTaskSchedulingPolicy(taskSchedulingPolicy); + return this; + } + + public PoolImpl withUserAccounts(List userAccounts) { + this.innerModel().withUserAccounts(userAccounts); + return this; + } + + public PoolImpl withMetadata(List metadata) { + this.innerModel().withMetadata(metadata); + return this; + } + + public PoolImpl withStartTask(StartTask startTask) { + this.innerModel().withStartTask(startTask); + return this; + } + + public PoolImpl withCertificates(List certificates) { + this.innerModel().withCertificates(certificates); + return this; + } + + public PoolImpl withApplicationPackages(List applicationPackages) { + this.innerModel().withApplicationPackages(applicationPackages); + return this; + } + + public PoolImpl withApplicationLicenses(List applicationLicenses) { + this.innerModel().withApplicationLicenses(applicationLicenses); + return this; + } + + public PoolImpl withMountConfiguration(List mountConfiguration) { + this.innerModel().withMountConfiguration(mountConfiguration); + return this; + } + + public PoolImpl withIfMatch(String ifMatch) { + if (isInCreateMode()) { + this.createIfMatch = ifMatch; + return this; + } else { + this.updateIfMatch = ifMatch; + return this; + } + } + + public PoolImpl withIfNoneMatch(String ifNoneMatch) { + this.createIfNoneMatch = ifNoneMatch; + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolsClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolsClientImpl.java new file mode 100644 index 0000000000000..30f48324f144f --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolsClientImpl.java @@ -0,0 +1,1787 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.batch.fluent.PoolsClient; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; +import com.azure.resourcemanager.batch.models.ListPoolsResult; +import com.azure.resourcemanager.batch.models.PoolsCreateResponse; +import com.azure.resourcemanager.batch.models.PoolsDisableAutoScaleResponse; +import com.azure.resourcemanager.batch.models.PoolsGetResponse; +import com.azure.resourcemanager.batch.models.PoolsStopResizeResponse; +import com.azure.resourcemanager.batch.models.PoolsUpdateResponse; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PoolsClient. */ +public final class PoolsClientImpl implements PoolsClient { + private final ClientLogger logger = new ClientLogger(PoolsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PoolsService service; + + /** The service client containing this operation class. */ + private final BatchManagementImpl client; + + /** + * Initializes an instance of PoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PoolsClientImpl(BatchManagementImpl client) { + this.service = RestProxy.create(PoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementPools to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementPools") + private interface PoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/pools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBatchAccount( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("maxresults") Integer maxresults, + @QueryParam("$select") String select, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/pools/{poolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("poolName") String poolName, + @HeaderParam("If-Match") String ifMatch, + @HeaderParam("If-None-Match") String ifNoneMatch, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") PoolInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/pools/{poolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("poolName") String poolName, + @HeaderParam("If-Match") String ifMatch, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") PoolInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/pools/{poolName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("poolName") String poolName, + @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.Batch/batchAccounts" + + "/{accountName}/pools/{poolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("poolName") String poolName, + @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.Batch/batchAccounts" + + "/{accountName}/pools/{poolName}/disableAutoScale") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono disableAutoScale( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("poolName") String poolName, + @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.Batch/batchAccounts" + + "/{accountName}/pools/{poolName}/stopResize") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono stopResize( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("poolName") String poolName, + @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> listByBatchAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are: + *

name properties/allocationState properties/allocationStateTransitionTime properties/creationTime + * properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified + * properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale + * properties/scaleSettings/fixedScale. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountSinglePageAsync( + String resourceGroupName, String accountName, Integer maxresults, String select, 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 + .listByBatchAccount( + this.client.getEndpoint(), + resourceGroupName, + accountName, + maxresults, + select, + filter, + 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()))); + } + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are: + *

name properties/allocationState properties/allocationStateTransitionTime properties/creationTime + * properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified + * properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale + * properties/scaleSettings/fixedScale. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountSinglePageAsync( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + 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 + .listByBatchAccount( + this.client.getEndpoint(), + resourceGroupName, + accountName, + maxresults, + select, + filter, + 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)); + } + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are: + *

name properties/allocationState properties/allocationStateTransitionTime properties/creationTime + * properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified + * properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale + * properties/scaleSettings/fixedScale. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, String accountName, Integer maxresults, String select, String filter) { + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults, select, filter), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync(String resourceGroupName, String accountName) { + final Integer maxresults = null; + final String select = null; + final String filter = null; + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults, select, filter), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are: + *

name properties/allocationState properties/allocationStateTransitionTime properties/creationTime + * properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified + * properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale + * properties/scaleSettings/fixedScale. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults, select, filter, context), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBatchAccount(String resourceGroupName, String accountName) { + final Integer maxresults = null; + final String select = null; + final String filter = null; + return new PagedIterable<>(listByBatchAccountAsync(resourceGroupName, accountName, maxresults, select, filter)); + } + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are: + *

name properties/allocationState properties/allocationStateTransitionTime properties/creationTime + * properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified + * properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale + * properties/scaleSettings/fixedScale. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBatchAccount( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context) { + return new PagedIterable<>( + listByBatchAccountAsync(resourceGroupName, accountName, maxresults, select, filter, context)); + } + + /** + * Creates a new pool inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Additional parameters for pool creation. + * @param ifMatch The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the + * operation only if the pool already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other + * values will be ignored. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createWithResponseAsync( + String resourceGroupName, + String accountName, + String poolName, + PoolInner parameters, + String ifMatch, + String ifNoneMatch) { + 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName 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 + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + ifMatch, + ifNoneMatch, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new pool inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Additional parameters for pool creation. + * @param ifMatch The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the + * operation only if the pool already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other + * values will be ignored. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createWithResponseAsync( + String resourceGroupName, + String accountName, + String poolName, + PoolInner parameters, + String ifMatch, + String ifNoneMatch, + 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName 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 + .create( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + ifMatch, + ifNoneMatch, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates a new pool inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Additional parameters for pool creation. + * @param ifMatch The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the + * operation only if the pool already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other + * values will be ignored. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String accountName, + String poolName, + PoolInner parameters, + String ifMatch, + String ifNoneMatch) { + return createWithResponseAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch) + .flatMap( + (PoolsCreateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new pool inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Additional parameters for pool creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String accountName, String poolName, PoolInner parameters) { + final String ifMatch = null; + final String ifNoneMatch = null; + return createWithResponseAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch) + .flatMap( + (PoolsCreateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new pool inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Additional parameters for pool creation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner create(String resourceGroupName, String accountName, String poolName, PoolInner parameters) { + final String ifMatch = null; + final String ifNoneMatch = null; + return createAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch).block(); + } + + /** + * Creates a new pool inside the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Additional parameters for pool creation. + * @param ifMatch The entity state (ETag) version of the pool to update. A value of "*" can be used to apply the + * operation only if the pool already exists. If omitted, this operation will always be applied. + * @param ifNoneMatch Set to '*' to allow a new pool to be created, but to prevent updating an existing pool. Other + * values will be ignored. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String accountName, + String poolName, + PoolInner parameters, + String ifMatch, + String ifNoneMatch, + Context context) { + return createWithResponseAsync( + resourceGroupName, accountName, poolName, parameters, ifMatch, ifNoneMatch, context) + .block(); + } + + /** + * Updates the properties of an existing pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Pool properties that should be updated. Properties that are supplied will be updated, any + * property not supplied will be unchanged. + * @param ifMatch The entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to + * apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateWithResponseAsync( + String resourceGroupName, String accountName, String poolName, PoolInner parameters, String ifMatch) { + 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + ifMatch, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates the properties of an existing pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Pool properties that should be updated. Properties that are supplied will be updated, any + * property not supplied will be unchanged. + * @param ifMatch The entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to + * apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateWithResponseAsync( + String resourceGroupName, + String accountName, + String poolName, + PoolInner parameters, + String ifMatch, + 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + ifMatch, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Updates the properties of an existing pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Pool properties that should be updated. Properties that are supplied will be updated, any + * property not supplied will be unchanged. + * @param ifMatch The entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to + * apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, String poolName, PoolInner parameters, String ifMatch) { + return updateWithResponseAsync(resourceGroupName, accountName, poolName, parameters, ifMatch) + .flatMap( + (PoolsUpdateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of an existing pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Pool properties that should be updated. Properties that are supplied will be updated, any + * property not supplied will be unchanged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String accountName, String poolName, PoolInner parameters) { + final String ifMatch = null; + return updateWithResponseAsync(resourceGroupName, accountName, poolName, parameters, ifMatch) + .flatMap( + (PoolsUpdateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of an existing pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Pool properties that should be updated. Properties that are supplied will be updated, any + * property not supplied will be unchanged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner update(String resourceGroupName, String accountName, String poolName, PoolInner parameters) { + final String ifMatch = null; + return updateAsync(resourceGroupName, accountName, poolName, parameters, ifMatch).block(); + } + + /** + * Updates the properties of an existing pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the account. + * @param parameters Pool properties that should be updated. Properties that are supplied will be updated, any + * property not supplied will be unchanged. + * @param ifMatch The entity state (ETag) version of the pool to update. This value can be omitted or set to "*" to + * apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String accountName, + String poolName, + PoolInner parameters, + String ifMatch, + Context context) { + return updateWithResponseAsync(resourceGroupName, accountName, poolName, parameters, ifMatch, context).block(); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 poolName) { + 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName 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, + poolName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 poolName, 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName 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, + poolName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String poolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, poolName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String accountName, String poolName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, accountName, poolName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String poolName) { + return beginDeleteAsync(resourceGroupName, accountName, poolName).getSyncPoller(); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String accountName, String poolName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, poolName, context).getSyncPoller(); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 poolName) { + return beginDeleteAsync(resourceGroupName, accountName, poolName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 deleteAsync(String resourceGroupName, String accountName, String poolName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, poolName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 poolName) { + deleteAsync(resourceGroupName, accountName, poolName).block(); + } + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String poolName, Context context) { + deleteAsync(resourceGroupName, accountName, poolName, context).block(); + } + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync(String resourceGroupName, String accountName, String poolName) { + 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync( + String resourceGroupName, String accountName, String poolName, 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String poolName) { + return getWithResponseAsync(resourceGroupName, accountName, poolName) + .flatMap( + (PoolsGetResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner get(String resourceGroupName, String accountName, String poolName) { + return getAsync(resourceGroupName, accountName, poolName).block(); + } + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String poolName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, poolName, context).block(); + } + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAutoScaleWithResponseAsync( + String resourceGroupName, String accountName, String poolName) { + 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName 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 + .disableAutoScale( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAutoScaleWithResponseAsync( + String resourceGroupName, String accountName, String poolName, 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName 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 + .disableAutoScale( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAutoScaleAsync(String resourceGroupName, String accountName, String poolName) { + return disableAutoScaleWithResponseAsync(resourceGroupName, accountName, poolName) + .flatMap( + (PoolsDisableAutoScaleResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner disableAutoScale(String resourceGroupName, String accountName, String poolName) { + return disableAutoScaleAsync(resourceGroupName, accountName, poolName).block(); + } + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response disableAutoScaleWithResponse( + String resourceGroupName, String accountName, String poolName, Context context) { + return disableAutoScaleWithResponseAsync(resourceGroupName, accountName, poolName, context).block(); + } + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopResizeWithResponseAsync( + String resourceGroupName, String accountName, String poolName) { + 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName 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 + .stopResize( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopResizeWithResponseAsync( + String resourceGroupName, String accountName, String poolName, 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 (poolName == null) { + return Mono.error(new IllegalArgumentException("Parameter poolName 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 + .stopResize( + this.client.getEndpoint(), + resourceGroupName, + accountName, + poolName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopResizeAsync(String resourceGroupName, String accountName, String poolName) { + return stopResizeWithResponseAsync(resourceGroupName, accountName, poolName) + .flatMap( + (PoolsStopResizeResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PoolInner stopResize(String resourceGroupName, String accountName, String poolName) { + return stopResizeAsync(resourceGroupName, accountName, poolName).block(); + } + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopResizeWithResponse( + String resourceGroupName, String accountName, String poolName, Context context) { + return stopResizeWithResponseAsync(resourceGroupName, accountName, poolName, 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountNextSinglePageAsync(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.listByBatchAccountNext(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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountNextSinglePageAsync(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 + .listByBatchAccountNext(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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolsImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolsImpl.java new file mode 100644 index 0000000000000..f92efb73d20cd --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PoolsImpl.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.PoolsClient; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; +import com.azure.resourcemanager.batch.models.Pool; +import com.azure.resourcemanager.batch.models.Pools; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PoolsImpl implements Pools { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolsImpl.class); + + private final PoolsClient innerClient; + + private final BatchManager serviceManager; + + public PoolsImpl(PoolsClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBatchAccount(String resourceGroupName, String accountName) { + PagedIterable inner = this.serviceClient().listByBatchAccount(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new PoolImpl(inner1, this.manager())); + } + + public PagedIterable listByBatchAccount( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByBatchAccount(resourceGroupName, accountName, maxresults, select, filter, context); + return inner.mapPage(inner1 -> new PoolImpl(inner1, this.manager())); + } + + public void delete(String resourceGroupName, String accountName, String poolName) { + this.serviceClient().delete(resourceGroupName, accountName, poolName); + } + + public void delete(String resourceGroupName, String accountName, String poolName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, poolName, context); + } + + public Pool get(String resourceGroupName, String accountName, String poolName) { + PoolInner inner = this.serviceClient().get(resourceGroupName, accountName, poolName); + if (inner != null) { + return new PoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String poolName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, poolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Pool disableAutoScale(String resourceGroupName, String accountName, String poolName) { + PoolInner inner = this.serviceClient().disableAutoScale(resourceGroupName, accountName, poolName); + if (inner != null) { + return new PoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response disableAutoScaleWithResponse( + String resourceGroupName, String accountName, String poolName, Context context) { + Response inner = + this.serviceClient().disableAutoScaleWithResponse(resourceGroupName, accountName, poolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Pool stopResize(String resourceGroupName, String accountName, String poolName) { + PoolInner inner = this.serviceClient().stopResize(resourceGroupName, accountName, poolName); + if (inner != null) { + return new PoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response stopResizeWithResponse( + String resourceGroupName, String accountName, String poolName, Context context) { + Response inner = + this.serviceClient().stopResizeWithResponse(resourceGroupName, accountName, poolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Pool 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, poolName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, poolName, 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, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + this.delete(resourceGroupName, accountName, poolName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = Utils.getValueFromIdByName(id, "batchAccounts"); + if (accountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'batchAccounts'.", id))); + } + String poolName = Utils.getValueFromIdByName(id, "pools"); + if (poolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pools'.", id))); + } + this.delete(resourceGroupName, accountName, poolName, context); + } + + private PoolsClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } + + public PoolImpl define(String name) { + return new PoolImpl(name, this.manager()); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..ccdadf70bb29a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.batch.models.PrivateEndpoint; +import com.azure.resourcemanager.batch.models.PrivateEndpointConnection; +import com.azure.resourcemanager.batch.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.batch.models.PrivateLinkServiceConnectionState; + +public final class PrivateEndpointConnectionImpl implements PrivateEndpointConnection { + private PrivateEndpointConnectionInner innerObject; + + private final BatchManager serviceManager; + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..cd7cbdca0f75a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1026 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.batch.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.batch.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.batch.models.ListPrivateEndpointConnectionsResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in 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 BatchManagementImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(BatchManagementImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementPrivateEndpointConnections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementPriva") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBatchAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("maxresults") Integer maxresults, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("If-Match") String ifMatch, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBatchAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountSinglePageAsync( + String resourceGroupName, String accountName, Integer maxresults) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBatchAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + maxresults, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountSinglePageAsync( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBatchAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + maxresults, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, String accountName, Integer maxresults) { + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, String accountName) { + final Integer maxresults = null; + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults, context), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBatchAccount( + String resourceGroupName, String accountName) { + final Integer maxresults = null; + return new PagedIterable<>(listByBatchAccountAsync(resourceGroupName, accountName, maxresults)); + } + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBatchAccount( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + return new PagedIterable<>(listByBatchAccountAsync(resourceGroupName, accountName, maxresults, context)); + } + + /** + * Gets information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + @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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + privateEndpointConnectionName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + @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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName 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(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + privateEndpointConnectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + @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 information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, accountName, privateEndpointConnectionName).block(); + } + + /** + * Gets information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, context).block(); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + privateEndpointConnectionName, + this.client.getApiVersion(), + ifMatch, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + privateEndpointConnectionName, + this.client.getApiVersion(), + ifMatch, + parameters, + accept, + context); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch) { + return beginUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch) + .getSyncPoller(); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdate( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context) { + return beginUpdateAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch, context) + .getSyncPoller(); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch) { + return beginUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + final String ifMatch = null; + return beginUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context) { + return beginUpdateAsync( + resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch) { + return updateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch).block(); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + final String ifMatch = null; + return updateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch).block(); + } + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context) { + return updateAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch, 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountNextSinglePageAsync(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.listByBatchAccountNext(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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountNextSinglePageAsync( + 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 + .listByBatchAccountNext(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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionsImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..439d030afe2d9 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateEndpointConnectionsImpl.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.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.batch.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.batch.models.PrivateEndpointConnection; +import com.azure.resourcemanager.batch.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 BatchManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBatchAccount(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByBatchAccount(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByBatchAccount( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + PagedIterable inner = + this.serviceClient().listByBatchAccount(resourceGroupName, accountName, maxresults, context); + return inner.mapPage(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + 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 PrivateEndpointConnection update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .update(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + PrivateEndpointConnectionInner inner = + this.serviceClient().update(resourceGroupName, accountName, privateEndpointConnectionName, parameters); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context) { + PrivateEndpointConnectionInner inner = + this + .serviceClient() + .update(resourceGroupName, accountName, privateEndpointConnectionName, parameters, ifMatch, context); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourceImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..939cdd6fe52ba --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.resourcemanager.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.batch.models.PrivateLinkResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final BatchManager serviceManager; + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, BatchManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String groupId() { + return this.innerModel().groupId(); + } + + public List requiredMembers() { + List inner = this.innerModel().requiredMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requiredZoneNames() { + List inner = this.innerModel().requiredZoneNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourcesClientImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..d8327d5a41cfc --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,552 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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.batch.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.batch.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.batch.models.ListPrivateLinkResourcesResult; +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 BatchManagementImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(BatchManagementImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BatchManagementPrivateLinkResources to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BatchManagementPriva") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBatchAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("maxresults") Integer maxresults, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Batch/batchAccounts" + + "/{accountName}/privateLinkResources/{privateLinkResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("accountName") String accountName, + @PathParam("privateLinkResourceName") String privateLinkResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBatchAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountSinglePageAsync( + String resourceGroupName, String accountName, Integer maxresults) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBatchAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + maxresults, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountSinglePageAsync( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBatchAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + this.client.getApiVersion(), + maxresults, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, String accountName, Integer maxresults) { + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync(String resourceGroupName, String accountName) { + final Integer maxresults = null; + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBatchAccountAsync( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + return new PagedFlux<>( + () -> listByBatchAccountSinglePageAsync(resourceGroupName, accountName, maxresults, context), + nextLink -> listByBatchAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBatchAccount(String resourceGroupName, String accountName) { + final Integer maxresults = null; + return new PagedIterable<>(listByBatchAccountAsync(resourceGroupName, accountName, maxresults)); + } + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBatchAccount( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + return new PagedIterable<>(listByBatchAccountAsync(resourceGroupName, accountName, maxresults, context)); + } + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String privateLinkResourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateLinkResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter privateLinkResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + privateLinkResourceName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String accountName, String privateLinkResourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (privateLinkResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter privateLinkResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + accountName, + privateLinkResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String accountName, String privateLinkResourceName) { + return getWithResponseAsync(resourceGroupName, accountName, privateLinkResourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String accountName, String privateLinkResourceName) { + return getAsync(resourceGroupName, accountName, privateLinkResourceName).block(); + } + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String accountName, String privateLinkResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, privateLinkResourceName, 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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountNextSinglePageAsync(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.listByBatchAccountNext(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 values returned by the List operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBatchAccountNextSinglePageAsync( + 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 + .listByBatchAccountNext(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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourcesImpl.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..4d93136eaaca3 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/PrivateLinkResourcesImpl.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.batch.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.batch.BatchManager; +import com.azure.resourcemanager.batch.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.batch.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.batch.models.PrivateLinkResource; +import com.azure.resourcemanager.batch.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 BatchManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, BatchManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBatchAccount(String resourceGroupName, String accountName) { + PagedIterable inner = + this.serviceClient().listByBatchAccount(resourceGroupName, accountName); + return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByBatchAccount( + String resourceGroupName, String accountName, Integer maxresults, Context context) { + PagedIterable inner = + this.serviceClient().listByBatchAccount(resourceGroupName, accountName, maxresults, context); + return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PrivateLinkResource get(String resourceGroupName, String accountName, String privateLinkResourceName) { + PrivateLinkResourceInner inner = + this.serviceClient().get(resourceGroupName, accountName, privateLinkResourceName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String accountName, String privateLinkResourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, accountName, privateLinkResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private BatchManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/Utils.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/Utils.java new file mode 100644 index 0000000000000..7ad60e0b0e9f4 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/Utils.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.implementation; + +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/package-info.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/package-info.java new file mode 100644 index 0000000000000..744890726c4d2 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for BatchManagement. null. */ +package com.azure.resourcemanager.batch.implementation; diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AccountKeyType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AccountKeyType.java new file mode 100644 index 0000000000000..13a40cce924a0 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AccountKeyType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AccountKeyType. */ +public enum AccountKeyType { + /** Enum value Primary. */ + PRIMARY("Primary"), + + /** Enum value Secondary. */ + SECONDARY("Secondary"); + + /** The actual serialized value for a AccountKeyType instance. */ + private final String value; + + AccountKeyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccountKeyType instance. + * + * @param value the serialized value to parse. + * @return the parsed AccountKeyType object, or null if unable to parse. + */ + @JsonCreator + public static AccountKeyType fromString(String value) { + AccountKeyType[] items = AccountKeyType.values(); + for (AccountKeyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ActivateApplicationPackageParameters.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ActivateApplicationPackageParameters.java new file mode 100644 index 0000000000000..bf47e8248b2af --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ActivateApplicationPackageParameters.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Parameters for an activating an application package. */ +@Fluent +public final class ActivateApplicationPackageParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActivateApplicationPackageParameters.class); + + /* + * The format of the application package binary file. + */ + @JsonProperty(value = "format", required = true) + private String format; + + /** + * Get the format property: The format of the application package binary file. + * + * @return the format value. + */ + public String format() { + return this.format; + } + + /** + * Set the format property: The format of the application package binary file. + * + * @param format the format value to set. + * @return the ActivateApplicationPackageParameters object itself. + */ + public ActivateApplicationPackageParameters withFormat(String format) { + this.format = format; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (format() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property format in model ActivateApplicationPackageParameters")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AllocationState.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AllocationState.java new file mode 100644 index 0000000000000..e1102204ef49c --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AllocationState.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AllocationState. */ +public enum AllocationState { + /** Enum value Steady. */ + STEADY("Steady"), + + /** Enum value Resizing. */ + RESIZING("Resizing"), + + /** Enum value Stopping. */ + STOPPING("Stopping"); + + /** The actual serialized value for a AllocationState instance. */ + private final String value; + + AllocationState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AllocationState instance. + * + * @param value the serialized value to parse. + * @return the parsed AllocationState object, or null if unable to parse. + */ + @JsonCreator + public static AllocationState fromString(String value) { + AllocationState[] items = AllocationState.values(); + for (AllocationState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Application.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Application.java new file mode 100644 index 0000000000000..a425fd7ddc43b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Application.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.fluent.models.ApplicationInner; + +/** An immutable client-side representation of Application. */ +public interface Application { + /** + * 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 displayName property: The display name for the application. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the allowUpdates property: A value indicating whether packages within the application may be overwritten + * using the same version string. + * + * @return the allowUpdates value. + */ + Boolean allowUpdates(); + + /** + * Gets the defaultVersion property: The package to use if a client requests the application but does not specify a + * version. This property can only be set to the name of an existing package. + * + * @return the defaultVersion value. + */ + String defaultVersion(); + + /** + * Gets the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.ApplicationInner object. + * + * @return the inner object. + */ + ApplicationInner innerModel(); + + /** The entirety of the Application definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Application definition stages. */ + interface DefinitionStages { + /** The first stage of the Application definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Application definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @return the next definition stage. + */ + WithCreate withExistingBatchAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the Application 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.WithDisplayName, + DefinitionStages.WithAllowUpdates, + DefinitionStages.WithDefaultVersion { + /** + * Executes the create request. + * + * @return the created resource. + */ + Application create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Application create(Context context); + } + /** The stage of the Application definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name for the application.. + * + * @param displayName The display name for the application. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the Application definition allowing to specify allowUpdates. */ + interface WithAllowUpdates { + /** + * Specifies the allowUpdates property: A value indicating whether packages within the application may be + * overwritten using the same version string.. + * + * @param allowUpdates A value indicating whether packages within the application may be overwritten using + * the same version string. + * @return the next definition stage. + */ + WithCreate withAllowUpdates(Boolean allowUpdates); + } + /** The stage of the Application definition allowing to specify defaultVersion. */ + interface WithDefaultVersion { + /** + * Specifies the defaultVersion property: The package to use if a client requests the application but does + * not specify a version. This property can only be set to the name of an existing package.. + * + * @param defaultVersion The package to use if a client requests the application but does not specify a + * version. This property can only be set to the name of an existing package. + * @return the next definition stage. + */ + WithCreate withDefaultVersion(String defaultVersion); + } + } + /** + * Begins update for the Application resource. + * + * @return the stage of resource update. + */ + Application.Update update(); + + /** The template for Application update. */ + interface Update + extends UpdateStages.WithDisplayName, UpdateStages.WithAllowUpdates, UpdateStages.WithDefaultVersion { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Application apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Application apply(Context context); + } + /** The Application update stages. */ + interface UpdateStages { + /** The stage of the Application update allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name for the application.. + * + * @param displayName The display name for the application. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + /** The stage of the Application update allowing to specify allowUpdates. */ + interface WithAllowUpdates { + /** + * Specifies the allowUpdates property: A value indicating whether packages within the application may be + * overwritten using the same version string.. + * + * @param allowUpdates A value indicating whether packages within the application may be overwritten using + * the same version string. + * @return the next definition stage. + */ + Update withAllowUpdates(Boolean allowUpdates); + } + /** The stage of the Application update allowing to specify defaultVersion. */ + interface WithDefaultVersion { + /** + * Specifies the defaultVersion property: The package to use if a client requests the application but does + * not specify a version. This property can only be set to the name of an existing package.. + * + * @param defaultVersion The package to use if a client requests the application but does not specify a + * version. This property can only be set to the name of an existing package. + * @return the next definition stage. + */ + Update withDefaultVersion(String defaultVersion); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Application refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Application refresh(Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackage.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackage.java new file mode 100644 index 0000000000000..7ba17e979aecc --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackage.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.fluent.models.ApplicationPackageInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ApplicationPackage. */ +public interface ApplicationPackage { + /** + * 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 state property: The current state of the application package. + * + * @return the state value. + */ + PackageState state(); + + /** + * Gets the format property: The format of the application package, if the package is active. + * + * @return the format value. + */ + String format(); + + /** + * Gets the storageUrl property: The URL for the application package in Azure Storage. + * + * @return the storageUrl value. + */ + String storageUrl(); + + /** + * Gets the storageUrlExpiry property: The UTC time at which the Azure Storage URL will expire. + * + * @return the storageUrlExpiry value. + */ + OffsetDateTime storageUrlExpiry(); + + /** + * Gets the lastActivationTime property: The time at which the package was last activated, if the package is active. + * + * @return the lastActivationTime value. + */ + OffsetDateTime lastActivationTime(); + + /** + * Gets the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.ApplicationPackageInner object. + * + * @return the inner object. + */ + ApplicationPackageInner innerModel(); + + /** The entirety of the ApplicationPackage definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ApplicationPackage definition stages. */ + interface DefinitionStages { + /** The first stage of the ApplicationPackage definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ApplicationPackage definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName, applicationName. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @return the next definition stage. + */ + WithCreate withExistingApplication(String resourceGroupName, String accountName, String applicationName); + } + /** + * The stage of the ApplicationPackage 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 { + /** + * Executes the create request. + * + * @return the created resource. + */ + ApplicationPackage create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ApplicationPackage create(Context context); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ApplicationPackage refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ApplicationPackage refresh(Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackageReference.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackageReference.java new file mode 100644 index 0000000000000..6ff9200869121 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackageReference.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Link to an application package inside the batch account. */ +@Fluent +public final class ApplicationPackageReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPackageReference.class); + + /* + * The ID of the application package to install. This must be inside the + * same batch account as the pool. This can either be a reference to a + * specific version or the default version if one exists. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * If this is omitted, and no default version is specified for this + * application, the request fails with the error code + * InvalidApplicationPackageReferences. If you are calling the REST API + * directly, the HTTP status code is 409. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the id property: The ID of the application package to install. This must be inside the same batch account as + * the pool. This can either be a reference to a specific version or the default version if one exists. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ID of the application package to install. This must be inside the same batch account as + * the pool. This can either be a reference to a specific version or the default version if one exists. + * + * @param id the id value to set. + * @return the ApplicationPackageReference object itself. + */ + public ApplicationPackageReference withId(String id) { + this.id = id; + return this; + } + + /** + * Get the version property: If this is omitted, and no default version is specified for this application, the + * request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, + * the HTTP status code is 409. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: If this is omitted, and no default version is specified for this application, the + * request fails with the error code InvalidApplicationPackageReferences. If you are calling the REST API directly, + * the HTTP status code is 409. + * + * @param version the version value to set. + * @return the ApplicationPackageReference object itself. + */ + public ApplicationPackageReference withVersion(String version) { + this.version = version; + 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 ApplicationPackageReference")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackages.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackages.java new file mode 100644 index 0000000000000..2513c5eb225b5 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ApplicationPackages.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 ApplicationPackages. */ +public interface ApplicationPackages { + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application package which represents a particular version of an application. + */ + ApplicationPackage activate( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters); + + /** + * Activates the specified application package. This should be done after the `ApplicationPackage` was created and + * uploaded. This needs to be done before an `ApplicationPackage` can be used on Pools or Tasks. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @param parameters The parameters for the request. + * @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 an application package which represents a particular version of an application. + */ + Response activateWithResponse( + String resourceGroupName, + String accountName, + String applicationName, + String versionName, + ActivateApplicationPackageParameters parameters, + Context context); + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 applicationName, String versionName); + + /** + * Deletes an application package record and its associated binary file. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @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 applicationName, String versionName, Context context); + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified application package. + */ + ApplicationPackage get(String resourceGroupName, String accountName, String applicationName, String versionName); + + /** + * Gets information about the specified application package. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param versionName The version of the application. + * @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 information about the specified application package. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String applicationName, String versionName, Context context); + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 result of performing list application packages. + */ + PagedIterable list(String resourceGroupName, String accountName, String applicationName); + + /** + * Lists all of the application packages in the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the account. + * @param maxresults The maximum number of items to return in the response. + * @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 result of performing list application packages. + */ + PagedIterable list( + String resourceGroupName, String accountName, String applicationName, Integer maxresults, Context context); + + /** + * Gets information about the specified application package. + * + * @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 information about the specified application package. + */ + ApplicationPackage getById(String id); + + /** + * Gets information about the specified application package. + * + * @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 information about the specified application package. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an application package record and its associated binary file. + * + * @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 an application package record and its associated binary file. + * + * @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 ApplicationPackage resource. + * + * @param name resource name. + * @return the first stage of the new ApplicationPackage definition. + */ + ApplicationPackage.DefinitionStages.Blank define(String name); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Applications.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Applications.java new file mode 100644 index 0000000000000..4a499425a83cc --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Applications.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.batch.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 Applications. */ +public interface Applications { + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName); + + /** + * Deletes an application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 applicationName, Context context); + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + Application get(String resourceGroupName, String accountName, String applicationName); + + /** + * Gets information about the specified application. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param applicationName The name of the application. This must be unique within the 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 information about the specified application. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String applicationName, Context context); + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 result of performing list applications. + */ + PagedIterable list(String resourceGroupName, String accountName); + + /** + * Lists all of the applications in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @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 result of performing list applications. + */ + PagedIterable list(String resourceGroupName, String accountName, Integer maxresults, Context context); + + /** + * Gets information about the specified application. + * + * @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 information about the specified application. + */ + Application getById(String id); + + /** + * Gets information about the specified application. + * + * @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 information about the specified application. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an application. + * + * @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 an application. + * + * @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 Application resource. + * + * @param name resource name. + * @return the first stage of the new Application definition. + */ + Application.DefinitionStages.Blank define(String name); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleRun.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleRun.java new file mode 100644 index 0000000000000..657eb5cc1cd42 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleRun.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The results and errors from an execution of a pool autoscale formula. */ +@Fluent +public final class AutoScaleRun { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoScaleRun.class); + + /* + * The time at which the autoscale formula was last evaluated. + */ + @JsonProperty(value = "evaluationTime", required = true) + private OffsetDateTime evaluationTime; + + /* + * Each variable value is returned in the form $variable=value, and + * variables are separated by semicolons. + */ + @JsonProperty(value = "results") + private String results; + + /* + * An error that occurred when autoscaling a pool. + */ + @JsonProperty(value = "error") + private AutoScaleRunError error; + + /** + * Get the evaluationTime property: The time at which the autoscale formula was last evaluated. + * + * @return the evaluationTime value. + */ + public OffsetDateTime evaluationTime() { + return this.evaluationTime; + } + + /** + * Set the evaluationTime property: The time at which the autoscale formula was last evaluated. + * + * @param evaluationTime the evaluationTime value to set. + * @return the AutoScaleRun object itself. + */ + public AutoScaleRun withEvaluationTime(OffsetDateTime evaluationTime) { + this.evaluationTime = evaluationTime; + return this; + } + + /** + * Get the results property: Each variable value is returned in the form $variable=value, and variables are + * separated by semicolons. + * + * @return the results value. + */ + public String results() { + return this.results; + } + + /** + * Set the results property: Each variable value is returned in the form $variable=value, and variables are + * separated by semicolons. + * + * @param results the results value to set. + * @return the AutoScaleRun object itself. + */ + public AutoScaleRun withResults(String results) { + this.results = results; + return this; + } + + /** + * Get the error property: An error that occurred when autoscaling a pool. + * + * @return the error value. + */ + public AutoScaleRunError error() { + return this.error; + } + + /** + * Set the error property: An error that occurred when autoscaling a pool. + * + * @param error the error value to set. + * @return the AutoScaleRun object itself. + */ + public AutoScaleRun withError(AutoScaleRunError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (evaluationTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property evaluationTime in model AutoScaleRun")); + } + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleRunError.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleRunError.java new file mode 100644 index 0000000000000..362ab52a3ed62 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleRunError.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** An error that occurred when autoscaling a pool. */ +@Fluent +public final class AutoScaleRunError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoScaleRunError.class); + + /* + * An identifier for the error. Codes are invariant and are intended to be + * consumed programmatically. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /* + * A message describing the error, intended to be suitable for display in a + * user interface. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /* + * Additional details about the error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the code property: An identifier for the error. Codes are invariant and are intended to be consumed + * programmatically. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: An identifier for the error. Codes are invariant and are intended to be consumed + * programmatically. + * + * @param code the code value to set. + * @return the AutoScaleRunError object itself. + */ + public AutoScaleRunError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: A message describing the error, intended to be suitable for display in a user + * interface. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: A message describing the error, intended to be suitable for display in a user + * interface. + * + * @param message the message value to set. + * @return the AutoScaleRunError object itself. + */ + public AutoScaleRunError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details property: Additional details about the error. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: Additional details about the error. + * + * @param details the details value to set. + * @return the AutoScaleRunError object itself. + */ + public AutoScaleRunError withDetails(List details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (code() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property code in model AutoScaleRunError")); + } + if (message() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property message in model AutoScaleRunError")); + } + if (details() != null) { + details().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleSettings.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleSettings.java new file mode 100644 index 0000000000000..2c21df1ed6c09 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoScaleSettings.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** AutoScale settings for the pool. */ +@Fluent +public final class AutoScaleSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoScaleSettings.class); + + /* + * A formula for the desired number of compute nodes in the pool. + */ + @JsonProperty(value = "formula", required = true) + private String formula; + + /* + * If omitted, the default value is 15 minutes (PT15M). + */ + @JsonProperty(value = "evaluationInterval") + private Duration evaluationInterval; + + /** + * Get the formula property: A formula for the desired number of compute nodes in the pool. + * + * @return the formula value. + */ + public String formula() { + return this.formula; + } + + /** + * Set the formula property: A formula for the desired number of compute nodes in the pool. + * + * @param formula the formula value to set. + * @return the AutoScaleSettings object itself. + */ + public AutoScaleSettings withFormula(String formula) { + this.formula = formula; + return this; + } + + /** + * Get the evaluationInterval property: If omitted, the default value is 15 minutes (PT15M). + * + * @return the evaluationInterval value. + */ + public Duration evaluationInterval() { + return this.evaluationInterval; + } + + /** + * Set the evaluationInterval property: If omitted, the default value is 15 minutes (PT15M). + * + * @param evaluationInterval the evaluationInterval value to set. + * @return the AutoScaleSettings object itself. + */ + public AutoScaleSettings withEvaluationInterval(Duration evaluationInterval) { + this.evaluationInterval = evaluationInterval; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (formula() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property formula in model AutoScaleSettings")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoStorageBaseProperties.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoStorageBaseProperties.java new file mode 100644 index 0000000000000..490036fdfa7cb --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoStorageBaseProperties.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 properties related to the auto-storage account. */ +@Fluent +public class AutoStorageBaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoStorageBaseProperties.class); + + /* + * The resource ID of the storage account to be used for auto-storage + * account. + */ + @JsonProperty(value = "storageAccountId", required = true) + private String storageAccountId; + + /** + * Get the storageAccountId property: The resource ID of the storage account to be used for auto-storage account. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: The resource ID of the storage account to be used for auto-storage account. + * + * @param storageAccountId the storageAccountId value to set. + * @return the AutoStorageBaseProperties object itself. + */ + public AutoStorageBaseProperties withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageAccountId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageAccountId in model AutoStorageBaseProperties")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoStorageProperties.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoStorageProperties.java new file mode 100644 index 0000000000000..b4a834295adba --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoStorageProperties.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Contains information about the auto-storage account associated with a Batch account. */ +@Fluent +public final class AutoStorageProperties extends AutoStorageBaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoStorageProperties.class); + + /* + * The UTC time at which storage keys were last synchronized with the Batch + * account. + */ + @JsonProperty(value = "lastKeySync", required = true) + private OffsetDateTime lastKeySync; + + /** + * Get the lastKeySync property: The UTC time at which storage keys were last synchronized with the Batch account. + * + * @return the lastKeySync value. + */ + public OffsetDateTime lastKeySync() { + return this.lastKeySync; + } + + /** + * Set the lastKeySync property: The UTC time at which storage keys were last synchronized with the Batch account. + * + * @param lastKeySync the lastKeySync value to set. + * @return the AutoStorageProperties object itself. + */ + public AutoStorageProperties withLastKeySync(OffsetDateTime lastKeySync) { + this.lastKeySync = lastKeySync; + return this; + } + + /** {@inheritDoc} */ + @Override + public AutoStorageProperties withStorageAccountId(String storageAccountId) { + super.withStorageAccountId(storageAccountId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (lastKeySync() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property lastKeySync in model AutoStorageProperties")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoUserScope.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoUserScope.java new file mode 100644 index 0000000000000..5cc6b24d205b4 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoUserScope.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AutoUserScope. */ +public enum AutoUserScope { + /** Enum value Task. */ + TASK("Task"), + + /** Enum value Pool. */ + POOL("Pool"); + + /** The actual serialized value for a AutoUserScope instance. */ + private final String value; + + AutoUserScope(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AutoUserScope instance. + * + * @param value the serialized value to parse. + * @return the parsed AutoUserScope object, or null if unable to parse. + */ + @JsonCreator + public static AutoUserScope fromString(String value) { + AutoUserScope[] items = AutoUserScope.values(); + for (AutoUserScope item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoUserSpecification.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoUserSpecification.java new file mode 100644 index 0000000000000..b2e9ddad2d250 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AutoUserSpecification.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Specifies the parameters for the auto user that runs a task on the Batch service. */ +@Fluent +public final class AutoUserSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoUserSpecification.class); + + /* + * The default value is Pool. If the pool is running Windows a value of + * Task should be specified if stricter isolation between tasks is + * required. For example, if the task mutates the registry in a way which + * could impact other tasks, or if certificates have been specified on the + * pool which should not be accessible by normal tasks but should be + * accessible by start tasks. + */ + @JsonProperty(value = "scope") + private AutoUserScope scope; + + /* + * The default value is nonAdmin. + */ + @JsonProperty(value = "elevationLevel") + private ElevationLevel elevationLevel; + + /** + * Get the scope property: The default value is Pool. If the pool is running Windows a value of Task should be + * specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way + * which could impact other tasks, or if certificates have been specified on the pool which should not be accessible + * by normal tasks but should be accessible by start tasks. + * + * @return the scope value. + */ + public AutoUserScope scope() { + return this.scope; + } + + /** + * Set the scope property: The default value is Pool. If the pool is running Windows a value of Task should be + * specified if stricter isolation between tasks is required. For example, if the task mutates the registry in a way + * which could impact other tasks, or if certificates have been specified on the pool which should not be accessible + * by normal tasks but should be accessible by start tasks. + * + * @param scope the scope value to set. + * @return the AutoUserSpecification object itself. + */ + public AutoUserSpecification withScope(AutoUserScope scope) { + this.scope = scope; + return this; + } + + /** + * Get the elevationLevel property: The default value is nonAdmin. + * + * @return the elevationLevel value. + */ + public ElevationLevel elevationLevel() { + return this.elevationLevel; + } + + /** + * Set the elevationLevel property: The default value is nonAdmin. + * + * @param elevationLevel the elevationLevel value to set. + * @return the AutoUserSpecification object itself. + */ + public AutoUserSpecification withElevationLevel(ElevationLevel elevationLevel) { + this.elevationLevel = elevationLevel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AzureBlobFileSystemConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AzureBlobFileSystemConfiguration.java new file mode 100644 index 0000000000000..d31dec1735209 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AzureBlobFileSystemConfiguration.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Information used to connect to an Azure Storage Container using Blobfuse. */ +@Fluent +public final class AzureBlobFileSystemConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBlobFileSystemConfiguration.class); + + /* + * The Azure Storage Account name. + */ + @JsonProperty(value = "accountName", required = true) + private String accountName; + + /* + * The Azure Blob Storage Container name. + */ + @JsonProperty(value = "containerName", required = true) + private String containerName; + + /* + * This property is mutually exclusive with sasKey and one must be + * specified. + */ + @JsonProperty(value = "accountKey") + private String accountKey; + + /* + * This property is mutually exclusive with accountKey and one must be + * specified. + */ + @JsonProperty(value = "sasKey") + private String sasKey; + + /* + * These are 'net use' options in Windows and 'mount' options in Linux. + */ + @JsonProperty(value = "blobfuseOptions") + private String blobfuseOptions; + + /* + * All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + */ + @JsonProperty(value = "relativeMountPath", required = true) + private String relativeMountPath; + + /** + * Get the accountName property: The Azure Storage Account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: The Azure Storage Account name. + * + * @param accountName the accountName value to set. + * @return the AzureBlobFileSystemConfiguration object itself. + */ + public AzureBlobFileSystemConfiguration withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the containerName property: The Azure Blob Storage Container name. + * + * @return the containerName value. + */ + public String containerName() { + return this.containerName; + } + + /** + * Set the containerName property: The Azure Blob Storage Container name. + * + * @param containerName the containerName value to set. + * @return the AzureBlobFileSystemConfiguration object itself. + */ + public AzureBlobFileSystemConfiguration withContainerName(String containerName) { + this.containerName = containerName; + return this; + } + + /** + * Get the accountKey property: This property is mutually exclusive with sasKey and one must be specified. + * + * @return the accountKey value. + */ + public String accountKey() { + return this.accountKey; + } + + /** + * Set the accountKey property: This property is mutually exclusive with sasKey and one must be specified. + * + * @param accountKey the accountKey value to set. + * @return the AzureBlobFileSystemConfiguration object itself. + */ + public AzureBlobFileSystemConfiguration withAccountKey(String accountKey) { + this.accountKey = accountKey; + return this; + } + + /** + * Get the sasKey property: This property is mutually exclusive with accountKey and one must be specified. + * + * @return the sasKey value. + */ + public String sasKey() { + return this.sasKey; + } + + /** + * Set the sasKey property: This property is mutually exclusive with accountKey and one must be specified. + * + * @param sasKey the sasKey value to set. + * @return the AzureBlobFileSystemConfiguration object itself. + */ + public AzureBlobFileSystemConfiguration withSasKey(String sasKey) { + this.sasKey = sasKey; + return this; + } + + /** + * Get the blobfuseOptions property: These are 'net use' options in Windows and 'mount' options in Linux. + * + * @return the blobfuseOptions value. + */ + public String blobfuseOptions() { + return this.blobfuseOptions; + } + + /** + * Set the blobfuseOptions property: These are 'net use' options in Windows and 'mount' options in Linux. + * + * @param blobfuseOptions the blobfuseOptions value to set. + * @return the AzureBlobFileSystemConfiguration object itself. + */ + public AzureBlobFileSystemConfiguration withBlobfuseOptions(String blobfuseOptions) { + this.blobfuseOptions = blobfuseOptions; + return this; + } + + /** + * Get the relativeMountPath property: All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + * + * @return the relativeMountPath value. + */ + public String relativeMountPath() { + return this.relativeMountPath; + } + + /** + * Set the relativeMountPath property: All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + * + * @param relativeMountPath the relativeMountPath value to set. + * @return the AzureBlobFileSystemConfiguration object itself. + */ + public AzureBlobFileSystemConfiguration withRelativeMountPath(String relativeMountPath) { + this.relativeMountPath = relativeMountPath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accountName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property accountName in model AzureBlobFileSystemConfiguration")); + } + if (containerName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property containerName in model AzureBlobFileSystemConfiguration")); + } + if (relativeMountPath() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property relativeMountPath in model AzureBlobFileSystemConfiguration")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AzureFileShareConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AzureFileShareConfiguration.java new file mode 100644 index 0000000000000..30357e5553f5b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/AzureFileShareConfiguration.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Information used to connect to an Azure Fileshare. */ +@Fluent +public final class AzureFileShareConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureFileShareConfiguration.class); + + /* + * The Azure Storage account name. + */ + @JsonProperty(value = "accountName", required = true) + private String accountName; + + /* + * This is of the form 'https://{account}.file.core.windows.net/'. + */ + @JsonProperty(value = "azureFileUrl", required = true) + private String azureFileUrl; + + /* + * The Azure Storage account key. + */ + @JsonProperty(value = "accountKey", required = true) + private String accountKey; + + /* + * All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + */ + @JsonProperty(value = "relativeMountPath", required = true) + private String relativeMountPath; + + /* + * These are 'net use' options in Windows and 'mount' options in Linux. + */ + @JsonProperty(value = "mountOptions") + private String mountOptions; + + /** + * Get the accountName property: The Azure Storage account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: The Azure Storage account name. + * + * @param accountName the accountName value to set. + * @return the AzureFileShareConfiguration object itself. + */ + public AzureFileShareConfiguration withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the azureFileUrl property: This is of the form 'https://{account}.file.core.windows.net/'. + * + * @return the azureFileUrl value. + */ + public String azureFileUrl() { + return this.azureFileUrl; + } + + /** + * Set the azureFileUrl property: This is of the form 'https://{account}.file.core.windows.net/'. + * + * @param azureFileUrl the azureFileUrl value to set. + * @return the AzureFileShareConfiguration object itself. + */ + public AzureFileShareConfiguration withAzureFileUrl(String azureFileUrl) { + this.azureFileUrl = azureFileUrl; + return this; + } + + /** + * Get the accountKey property: The Azure Storage account key. + * + * @return the accountKey value. + */ + public String accountKey() { + return this.accountKey; + } + + /** + * Set the accountKey property: The Azure Storage account key. + * + * @param accountKey the accountKey value to set. + * @return the AzureFileShareConfiguration object itself. + */ + public AzureFileShareConfiguration withAccountKey(String accountKey) { + this.accountKey = accountKey; + return this; + } + + /** + * Get the relativeMountPath property: All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + * + * @return the relativeMountPath value. + */ + public String relativeMountPath() { + return this.relativeMountPath; + } + + /** + * Set the relativeMountPath property: All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + * + * @param relativeMountPath the relativeMountPath value to set. + * @return the AzureFileShareConfiguration object itself. + */ + public AzureFileShareConfiguration withRelativeMountPath(String relativeMountPath) { + this.relativeMountPath = relativeMountPath; + return this; + } + + /** + * Get the mountOptions property: These are 'net use' options in Windows and 'mount' options in Linux. + * + * @return the mountOptions value. + */ + public String mountOptions() { + return this.mountOptions; + } + + /** + * Set the mountOptions property: These are 'net use' options in Windows and 'mount' options in Linux. + * + * @param mountOptions the mountOptions value to set. + * @return the AzureFileShareConfiguration object itself. + */ + public AzureFileShareConfiguration withMountOptions(String mountOptions) { + this.mountOptions = mountOptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accountName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property accountName in model AzureFileShareConfiguration")); + } + if (azureFileUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property azureFileUrl in model AzureFileShareConfiguration")); + } + if (accountKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property accountKey in model AzureFileShareConfiguration")); + } + if (relativeMountPath() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property relativeMountPath in model AzureFileShareConfiguration")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccount.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccount.java new file mode 100644 index 0000000000000..e4172ef418d9a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccount.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of BatchAccount. */ +public interface BatchAccount { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The identity of the Batch account. + * + * @return the identity value. + */ + BatchAccountIdentity identity(); + + /** + * Gets the accountEndpoint property: The account endpoint used to interact with the Batch service. + * + * @return the accountEndpoint value. + */ + String accountEndpoint(); + + /** + * Gets the provisioningState property: The provisioned state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the poolAllocationMode property: The allocation mode for creating pools in the Batch account. + * + * @return the poolAllocationMode value. + */ + PoolAllocationMode poolAllocationMode(); + + /** + * Gets the keyVaultReference property: Identifies the Azure key vault associated with a Batch account. + * + * @return the keyVaultReference value. + */ + KeyVaultReference keyVaultReference(); + + /** + * Gets the publicNetworkAccess property: If not specified, the default value is 'enabled'. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccessType publicNetworkAccess(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections associated with the Batch + * account. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the autoStorage property: Contains information about the auto-storage account associated with a Batch + * account. + * + * @return the autoStorage value. + */ + AutoStorageProperties autoStorage(); + + /** + * Gets the encryption property: Configures how customer data is encrypted inside the Batch account. By default, + * accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used + * instead. + * + * @return the encryption value. + */ + EncryptionProperties encryption(); + + /** + * Gets the dedicatedCoreQuota property: For accounts with PoolAllocationMode set to UserSubscription, quota is + * managed on the subscription so this value is not returned. + * + * @return the dedicatedCoreQuota value. + */ + Integer dedicatedCoreQuota(); + + /** + * Gets the lowPriorityCoreQuota property: For accounts with PoolAllocationMode set to UserSubscription, quota is + * managed on the subscription so this value is not returned. + * + * @return the lowPriorityCoreQuota value. + */ + Integer lowPriorityCoreQuota(); + + /** + * Gets the dedicatedCoreQuotaPerVMFamily property: A list of the dedicated core quota per Virtual Machine family + * for the Batch account. For accounts with PoolAllocationMode set to UserSubscription, quota is managed on the + * subscription so this value is not returned. + * + * @return the dedicatedCoreQuotaPerVMFamily value. + */ + List dedicatedCoreQuotaPerVMFamily(); + + /** + * Gets the dedicatedCoreQuotaPerVMFamilyEnforced property: Batch is transitioning its core quota system for + * dedicated cores to be enforced per Virtual Machine family. During this transitional phase, the dedicated core + * quota per Virtual Machine family may not yet be enforced. If this flag is false, dedicated core quota is enforced + * via the old dedicatedCoreQuota property on the account and does not consider Virtual Machine family. If this flag + * is true, dedicated core quota is enforced via the dedicatedCoreQuotaPerVMFamily property on the account, and the + * old dedicatedCoreQuota does not apply. + * + * @return the dedicatedCoreQuotaPerVMFamilyEnforced value. + */ + Boolean dedicatedCoreQuotaPerVMFamilyEnforced(); + + /** + * Gets the poolQuota property: The pool quota for the Batch account. + * + * @return the poolQuota value. + */ + Integer poolQuota(); + + /** + * Gets the activeJobAndJobScheduleQuota property: The active job and job schedule quota for the Batch account. + * + * @return the activeJobAndJobScheduleQuota value. + */ + Integer activeJobAndJobScheduleQuota(); + + /** + * 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.batch.fluent.models.BatchAccountInner object. + * + * @return the inner object. + */ + BatchAccountInner innerModel(); + + /** The entirety of the BatchAccount definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The BatchAccount definition stages. */ + interface DefinitionStages { + /** The first stage of the BatchAccount definition. */ + interface Blank extends WithLocation { + } + /** The stage of the BatchAccount definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The region in which to create the account. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The region in which to create the account. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the BatchAccount definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the BatchAccount definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithAutoStorage, + DefinitionStages.WithPoolAllocationMode, + DefinitionStages.WithKeyVaultReference, + DefinitionStages.WithPublicNetworkAccess, + DefinitionStages.WithEncryption { + /** + * Executes the create request. + * + * @return the created resource. + */ + BatchAccount create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BatchAccount create(Context context); + } + /** The stage of the BatchAccount definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The user-specified tags associated with the account.. + * + * @param tags The user-specified tags associated with the account. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the BatchAccount definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the Batch account.. + * + * @param identity The identity of the Batch account. + * @return the next definition stage. + */ + WithCreate withIdentity(BatchAccountIdentity identity); + } + /** The stage of the BatchAccount definition allowing to specify autoStorage. */ + interface WithAutoStorage { + /** + * Specifies the autoStorage property: The properties related to the auto-storage account.. + * + * @param autoStorage The properties related to the auto-storage account. + * @return the next definition stage. + */ + WithCreate withAutoStorage(AutoStorageBaseProperties autoStorage); + } + /** The stage of the BatchAccount definition allowing to specify poolAllocationMode. */ + interface WithPoolAllocationMode { + /** + * Specifies the poolAllocationMode property: The pool allocation mode also affects how clients may + * authenticate to the Batch Service API. If the mode is BatchService, clients may authenticate using access + * keys or Azure Active Directory. If the mode is UserSubscription, clients must use Azure Active Directory. + * The default is BatchService.. + * + * @param poolAllocationMode The pool allocation mode also affects how clients may authenticate to the Batch + * Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active + * Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is + * BatchService. + * @return the next definition stage. + */ + WithCreate withPoolAllocationMode(PoolAllocationMode poolAllocationMode); + } + /** The stage of the BatchAccount definition allowing to specify keyVaultReference. */ + interface WithKeyVaultReference { + /** + * Specifies the keyVaultReference property: A reference to the Azure key vault associated with the Batch + * account.. + * + * @param keyVaultReference A reference to the Azure key vault associated with the Batch account. + * @return the next definition stage. + */ + WithCreate withKeyVaultReference(KeyVaultReference keyVaultReference); + } + /** The stage of the BatchAccount definition allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: If not specified, the default value is 'enabled'.. + * + * @param publicNetworkAccess If not specified, the default value is 'enabled'. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(PublicNetworkAccessType publicNetworkAccess); + } + /** The stage of the BatchAccount definition allowing to specify encryption. */ + interface WithEncryption { + /** + * Specifies the encryption property: Configures how customer data is encrypted inside the Batch account. By + * default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed + * key can be used instead.. + * + * @param encryption Configures how customer data is encrypted inside the Batch account. By default, + * accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key + * can be used instead. + * @return the next definition stage. + */ + WithCreate withEncryption(EncryptionProperties encryption); + } + } + /** + * Begins update for the BatchAccount resource. + * + * @return the stage of resource update. + */ + BatchAccount.Update update(); + + /** The template for BatchAccount update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithAutoStorage, + UpdateStages.WithEncryption { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BatchAccount apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BatchAccount apply(Context context); + } + /** The BatchAccount update stages. */ + interface UpdateStages { + /** The stage of the BatchAccount update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The user-specified tags associated with the account.. + * + * @param tags The user-specified tags associated with the account. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the BatchAccount update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the Batch account.. + * + * @param identity The identity of the Batch account. + * @return the next definition stage. + */ + Update withIdentity(BatchAccountIdentity identity); + } + /** The stage of the BatchAccount update allowing to specify autoStorage. */ + interface WithAutoStorage { + /** + * Specifies the autoStorage property: The properties related to the auto-storage account.. + * + * @param autoStorage The properties related to the auto-storage account. + * @return the next definition stage. + */ + Update withAutoStorage(AutoStorageBaseProperties autoStorage); + } + /** The stage of the BatchAccount update allowing to specify encryption. */ + interface WithEncryption { + /** + * Specifies the encryption property: Configures how customer data is encrypted inside the Batch account. By + * default, accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed + * key can be used instead.. + * + * @param encryption Configures how customer data is encrypted inside the Batch account. By default, + * accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key + * can be used instead. + * @return the next definition stage. + */ + Update withEncryption(EncryptionProperties encryption); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BatchAccount refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BatchAccount refresh(Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountCreateParameters.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountCreateParameters.java new file mode 100644 index 0000000000000..1ccb7975edb41 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountCreateParameters.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters supplied to the Create operation. */ +@JsonFlatten +@Fluent +public class BatchAccountCreateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountCreateParameters.class); + + /* + * The region in which to create the account. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * The user-specified tags associated with the account. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The identity of the Batch account. + */ + @JsonProperty(value = "identity") + private BatchAccountIdentity identity; + + /* + * The properties related to the auto-storage account. + */ + @JsonProperty(value = "properties.autoStorage") + private AutoStorageBaseProperties autoStorage; + + /* + * The pool allocation mode also affects how clients may authenticate to + * the Batch Service API. If the mode is BatchService, clients may + * authenticate using access keys or Azure Active Directory. If the mode is + * UserSubscription, clients must use Azure Active Directory. The default + * is BatchService. + */ + @JsonProperty(value = "properties.poolAllocationMode") + private PoolAllocationMode poolAllocationMode; + + /* + * A reference to the Azure key vault associated with the Batch account. + */ + @JsonProperty(value = "properties.keyVaultReference") + private KeyVaultReference keyVaultReference; + + /* + * If not specified, the default value is 'enabled'. + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private PublicNetworkAccessType publicNetworkAccess; + + /* + * Configures how customer data is encrypted inside the Batch account. By + * default, accounts are encrypted using a Microsoft managed key. For + * additional control, a customer-managed key can be used instead. + */ + @JsonProperty(value = "properties.encryption") + private EncryptionProperties encryption; + + /** + * Get the location property: The region in which to create the account. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The region in which to create the account. + * + * @param location the location value to set. + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: The user-specified tags associated with the account. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The user-specified tags associated with the account. + * + * @param tags the tags value to set. + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: The identity of the Batch account. + * + * @return the identity value. + */ + public BatchAccountIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the Batch account. + * + * @param identity the identity value to set. + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withIdentity(BatchAccountIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the autoStorage property: The properties related to the auto-storage account. + * + * @return the autoStorage value. + */ + public AutoStorageBaseProperties autoStorage() { + return this.autoStorage; + } + + /** + * Set the autoStorage property: The properties related to the auto-storage account. + * + * @param autoStorage the autoStorage value to set. + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withAutoStorage(AutoStorageBaseProperties autoStorage) { + this.autoStorage = autoStorage; + return this; + } + + /** + * Get the poolAllocationMode property: The pool allocation mode also affects how clients may authenticate to the + * Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active + * Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. + * + * @return the poolAllocationMode value. + */ + public PoolAllocationMode poolAllocationMode() { + return this.poolAllocationMode; + } + + /** + * Set the poolAllocationMode property: The pool allocation mode also affects how clients may authenticate to the + * Batch Service API. If the mode is BatchService, clients may authenticate using access keys or Azure Active + * Directory. If the mode is UserSubscription, clients must use Azure Active Directory. The default is BatchService. + * + * @param poolAllocationMode the poolAllocationMode value to set. + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withPoolAllocationMode(PoolAllocationMode poolAllocationMode) { + this.poolAllocationMode = poolAllocationMode; + return this; + } + + /** + * Get the keyVaultReference property: A reference to the Azure key vault associated with the Batch account. + * + * @return the keyVaultReference value. + */ + public KeyVaultReference keyVaultReference() { + return this.keyVaultReference; + } + + /** + * Set the keyVaultReference property: A reference to the Azure key vault associated with the Batch account. + * + * @param keyVaultReference the keyVaultReference value to set. + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withKeyVaultReference(KeyVaultReference keyVaultReference) { + this.keyVaultReference = keyVaultReference; + return this; + } + + /** + * Get the publicNetworkAccess property: If not specified, the default value is 'enabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessType publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: If not specified, the default value is 'enabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withPublicNetworkAccess(PublicNetworkAccessType publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the encryption property: Configures how customer data is encrypted inside the Batch account. By default, + * accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used + * instead. + * + * @return the encryption value. + */ + public EncryptionProperties encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Configures how customer data is encrypted inside the Batch account. By default, + * accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used + * instead. + * + * @param encryption the encryption value to set. + * @return the BatchAccountCreateParameters object itself. + */ + public BatchAccountCreateParameters withEncryption(EncryptionProperties encryption) { + this.encryption = encryption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property location in model BatchAccountCreateParameters")); + } + if (identity() != null) { + identity().validate(); + } + if (autoStorage() != null) { + autoStorage().validate(); + } + if (keyVaultReference() != null) { + keyVaultReference().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountIdentity.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountIdentity.java new file mode 100644 index 0000000000000..bd923b5b27ace --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountIdentity.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** + * The identity of the Batch account, if configured. This is only used when the user specifies 'Microsoft.KeyVault' as + * their Batch account encryption configuration. + */ +@Fluent +public class BatchAccountIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountIdentity.class); + + /* + * The principal id of the Batch account. This property will only be + * provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id associated with the Batch account. This property will only + * be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the Batch account. + */ + @JsonProperty(value = "type", required = true) + private ResourceIdentityType type; + + /* + * The list of user identities associated with the Batch account. 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 principalId property: The principal id of the Batch account. This property will only be provided for a + * system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id associated with the Batch account. This property will only be provided + * for a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of identity used for the Batch account. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the Batch account. + * + * @param type the type value to set. + * @return the BatchAccountIdentity object itself. + */ + public BatchAccountIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the Batch account. 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 identities associated with the Batch account. 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 BatchAccountIdentity object itself. + */ + public BatchAccountIdentity withUserAssignedIdentities( + Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model BatchAccountIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountIdentityUserAssignedIdentities.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountIdentityUserAssignedIdentities.java new file mode 100644 index 0000000000000..0af19ff176e48 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountIdentityUserAssignedIdentities.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.batch.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 BatchAccountIdentityUserAssignedIdentities model. */ +@Immutable +public final class BatchAccountIdentityUserAssignedIdentities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountIdentityUserAssignedIdentities.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountKeys.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountKeys.java new file mode 100644 index 0000000000000..e6461f867aec7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountKeys.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.resourcemanager.batch.fluent.models.BatchAccountKeysInner; + +/** An immutable client-side representation of BatchAccountKeys. */ +public interface BatchAccountKeys { + /** + * Gets the accountName property: The Batch account name. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the primary property: The primary key associated with the account. + * + * @return the primary value. + */ + String primary(); + + /** + * Gets the secondary property: The secondary key associated with the account. + * + * @return the secondary value. + */ + String secondary(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.BatchAccountKeysInner object. + * + * @return the inner object. + */ + BatchAccountKeysInner innerModel(); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountListResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountListResult.java new file mode 100644 index 0000000000000..05536c29340c9 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountListResult.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Values returned by the List operation. */ +@Fluent +public final class BatchAccountListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountListResult.class); + + /* + * The collection of Batch accounts returned by the listing operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The continuation token. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The collection of Batch accounts returned by the listing operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of Batch accounts returned by the listing operation. + * + * @param value the value value to set. + * @return the BatchAccountListResult object itself. + */ + public BatchAccountListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The continuation token. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The continuation token. + * + * @param nextLink the nextLink value to set. + * @return the BatchAccountListResult object itself. + */ + public BatchAccountListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountRegenerateKeyParameters.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountRegenerateKeyParameters.java new file mode 100644 index 0000000000000..9f380b10a75ff --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountRegenerateKeyParameters.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Parameters supplied to the RegenerateKey operation. */ +@Fluent +public final class BatchAccountRegenerateKeyParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountRegenerateKeyParameters.class); + + /* + * The type of account key to regenerate. + */ + @JsonProperty(value = "keyName", required = true) + private AccountKeyType keyName; + + /** + * Get the keyName property: The type of account key to regenerate. + * + * @return the keyName value. + */ + public AccountKeyType keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The type of account key to regenerate. + * + * @param keyName the keyName value to set. + * @return the BatchAccountRegenerateKeyParameters object itself. + */ + public BatchAccountRegenerateKeyParameters withKeyName(AccountKeyType 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 BatchAccountRegenerateKeyParameters")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountUpdateParameters.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountUpdateParameters.java new file mode 100644 index 0000000000000..619a7a1759ea2 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountUpdateParameters.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters for updating an Azure Batch account. */ +@JsonFlatten +@Fluent +public class BatchAccountUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountUpdateParameters.class); + + /* + * The user-specified tags associated with the account. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The identity of the Batch account. + */ + @JsonProperty(value = "identity") + private BatchAccountIdentity identity; + + /* + * The properties related to the auto-storage account. + */ + @JsonProperty(value = "properties.autoStorage") + private AutoStorageBaseProperties autoStorage; + + /* + * Configures how customer data is encrypted inside the Batch account. By + * default, accounts are encrypted using a Microsoft managed key. For + * additional control, a customer-managed key can be used instead. + */ + @JsonProperty(value = "properties.encryption") + private EncryptionProperties encryption; + + /** + * Get the tags property: The user-specified tags associated with the account. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The user-specified tags associated with the account. + * + * @param tags the tags value to set. + * @return the BatchAccountUpdateParameters object itself. + */ + public BatchAccountUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: The identity of the Batch account. + * + * @return the identity value. + */ + public BatchAccountIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the Batch account. + * + * @param identity the identity value to set. + * @return the BatchAccountUpdateParameters object itself. + */ + public BatchAccountUpdateParameters withIdentity(BatchAccountIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the autoStorage property: The properties related to the auto-storage account. + * + * @return the autoStorage value. + */ + public AutoStorageBaseProperties autoStorage() { + return this.autoStorage; + } + + /** + * Set the autoStorage property: The properties related to the auto-storage account. + * + * @param autoStorage the autoStorage value to set. + * @return the BatchAccountUpdateParameters object itself. + */ + public BatchAccountUpdateParameters withAutoStorage(AutoStorageBaseProperties autoStorage) { + this.autoStorage = autoStorage; + return this; + } + + /** + * Get the encryption property: Configures how customer data is encrypted inside the Batch account. By default, + * accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used + * instead. + * + * @return the encryption value. + */ + public EncryptionProperties encryption() { + return this.encryption; + } + + /** + * Set the encryption property: Configures how customer data is encrypted inside the Batch account. By default, + * accounts are encrypted using a Microsoft managed key. For additional control, a customer-managed key can be used + * instead. + * + * @param encryption the encryption value to set. + * @return the BatchAccountUpdateParameters object itself. + */ + public BatchAccountUpdateParameters withEncryption(EncryptionProperties encryption) { + this.encryption = encryption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (autoStorage() != null) { + autoStorage().validate(); + } + if (encryption() != null) { + encryption().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccounts.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccounts.java new file mode 100644 index 0000000000000..e1801d8c05b07 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccounts.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 BatchAccounts. */ +public interface BatchAccounts { + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 deleteByResourceGroup(String resourceGroupName, String accountName); + + /** + * Deletes the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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. + */ + void delete(String resourceGroupName, String accountName, Context context); + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + BatchAccount getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Gets information about the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 information about the specified Batch account. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + PagedIterable list(); + + /** + * Gets information about the Batch accounts associated with the 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 information about the Batch accounts associated with the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets information about the Batch accounts associated with the specified resource group. + * + * @param resourceGroupName The name of the resource group that contains the Batch 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 information about the Batch accounts associated with the specified resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 synchronizeAutoStorageKeys(String resourceGroupName, String accountName); + + /** + * Synchronizes access keys for the auto-storage account configured for the specified Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 synchronizeAutoStorageKeysWithResponse( + String resourceGroupName, String accountName, Context context); + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + BatchAccountKeys regenerateKey( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters parameters); + + /** + * Regenerates the specified account key for the Batch account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param parameters The type of key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a set of Azure Batch account keys. + */ + Response regenerateKeyWithResponse( + String resourceGroupName, String accountName, BatchAccountRegenerateKeyParameters parameters, Context context); + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + BatchAccountKeys getKeys(String resourceGroupName, String accountName); + + /** + * This operation applies only to Batch accounts created with a poolAllocationMode of 'BatchService'. If the Batch + * account was created with a poolAllocationMode of 'UserSubscription', clients cannot use access to keys to + * authenticate, and must use Azure Active Directory instead. In this case, getting the keys will fail. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 a set of Azure Batch account keys. + */ + Response getKeysWithResponse(String resourceGroupName, String accountName, Context context); + + /** + * Gets information about the specified Batch 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 information about the specified Batch account. + */ + BatchAccount getById(String id); + + /** + * Gets information about the specified Batch 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 information about the specified Batch account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified Batch 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 Batch 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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new BatchAccount resource. + * + * @param name resource name. + * @return the first stage of the new BatchAccount definition. + */ + BatchAccount.DefinitionStages.Blank define(String name); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsCreateHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsCreateHeaders.java new file mode 100644 index 0000000000000..dca4c194d0167 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsCreateHeaders.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.batch.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 BatchAccountsCreateHeaders model. */ +@Fluent +public final class BatchAccountsCreateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountsCreateHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BatchAccountsCreateHeaders object itself. + */ + public BatchAccountsCreateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BatchAccountsCreateHeaders object itself. + */ + public BatchAccountsCreateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsCreateResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsCreateResponse.java new file mode 100644 index 0000000000000..3f39d82422d7e --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsCreateResponse.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.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.BatchAccountInner; + +/** Contains all response data for the create operation. */ +public final class BatchAccountsCreateResponse extends ResponseBase { + /** + * Creates an instance of BatchAccountsCreateResponse. + * + * @param request the request which resulted in this BatchAccountsCreateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BatchAccountsCreateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + BatchAccountInner value, + BatchAccountsCreateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public BatchAccountInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsDeleteHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsDeleteHeaders.java new file mode 100644 index 0000000000000..8387d62382eec --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsDeleteHeaders.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.batch.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 BatchAccountsDeleteHeaders model. */ +@Fluent +public final class BatchAccountsDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchAccountsDeleteHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BatchAccountsDeleteHeaders object itself. + */ + public BatchAccountsDeleteHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BatchAccountsDeleteHeaders object itself. + */ + public BatchAccountsDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsDeleteResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsDeleteResponse.java new file mode 100644 index 0000000000000..7fb616d19e8b0 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchAccountsDeleteResponse.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.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class BatchAccountsDeleteResponse extends ResponseBase { + /** + * Creates an instance of BatchAccountsDeleteResponse. + * + * @param request the request which resulted in this BatchAccountsDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BatchAccountsDeleteResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BatchAccountsDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchLocationQuota.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchLocationQuota.java new file mode 100644 index 0000000000000..f1328bf07fc31 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchLocationQuota.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.batch.models; + +import com.azure.resourcemanager.batch.fluent.models.BatchLocationQuotaInner; + +/** An immutable client-side representation of BatchLocationQuota. */ +public interface BatchLocationQuota { + /** + * Gets the accountQuota property: The number of Batch accounts that may be created under the subscription in the + * specified region. + * + * @return the accountQuota value. + */ + Integer accountQuota(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.BatchLocationQuotaInner object. + * + * @return the inner object. + */ + BatchLocationQuotaInner innerModel(); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchPoolIdentity.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchPoolIdentity.java new file mode 100644 index 0000000000000..1cdf96f53ab84 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchPoolIdentity.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.batch.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; + +/** + * The identity of the Batch pool, if configured. If the pool identity is updated during update an existing pool, only + * the new vms which are created after the pool shrinks to 0 will have the updated identities. + */ +@Fluent +public class BatchPoolIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchPoolIdentity.class); + + /* + * The type of identity used for the Batch Pool. + */ + @JsonProperty(value = "type", required = true) + private PoolIdentityType type; + + /* + * The list of user identities associated with the Batch pool. 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: The type of identity used for the Batch Pool. + * + * @return the type value. + */ + public PoolIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the Batch Pool. + * + * @param type the type value to set. + * @return the BatchPoolIdentity object itself. + */ + public BatchPoolIdentity withType(PoolIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the Batch pool. 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 identities associated with the Batch pool. 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 BatchPoolIdentity object itself. + */ + public BatchPoolIdentity withUserAssignedIdentities( + Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model BatchPoolIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchPoolIdentityUserAssignedIdentities.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchPoolIdentityUserAssignedIdentities.java new file mode 100644 index 0000000000000..cf6676e611aa4 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchPoolIdentityUserAssignedIdentities.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.batch.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 BatchPoolIdentityUserAssignedIdentities model. */ +@Immutable +public final class BatchPoolIdentityUserAssignedIdentities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BatchPoolIdentityUserAssignedIdentities.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CachingType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CachingType.java new file mode 100644 index 0000000000000..b23941a5b2310 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CachingType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CachingType. */ +public enum CachingType { + /** Enum value None. */ + NONE("None"), + + /** Enum value ReadOnly. */ + READ_ONLY("ReadOnly"), + + /** Enum value ReadWrite. */ + READ_WRITE("ReadWrite"); + + /** The actual serialized value for a CachingType instance. */ + private final String value; + + CachingType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CachingType instance. + * + * @param value the serialized value to parse. + * @return the parsed CachingType object, or null if unable to parse. + */ + @JsonCreator + public static CachingType fromString(String value) { + CachingType[] items = CachingType.values(); + for (CachingType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificate.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificate.java new file mode 100644 index 0000000000000..c134f4c680ab0 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificate.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Certificate. */ +public interface Certificate { + /** + * 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 thumbprintAlgorithm property: This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + * + * @return the thumbprintAlgorithm value. + */ + String thumbprintAlgorithm(); + + /** + * Gets the thumbprint property: This must match the thumbprint from the name. + * + * @return the thumbprint value. + */ + String thumbprint(); + + /** + * Gets the format property: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * + * @return the format value. + */ + CertificateFormat format(); + + /** + * Gets the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + CertificateProvisioningState provisioningState(); + + /** + * Gets the provisioningStateTransitionTime property: The time at which the certificate entered its current state. + * + * @return the provisioningStateTransitionTime value. + */ + OffsetDateTime provisioningStateTransitionTime(); + + /** + * Gets the previousProvisioningState property: The previous provisioned state of the resource. + * + * @return the previousProvisioningState value. + */ + CertificateProvisioningState previousProvisioningState(); + + /** + * Gets the previousProvisioningStateTransitionTime property: The time at which the certificate entered its previous + * state. + * + * @return the previousProvisioningStateTransitionTime value. + */ + OffsetDateTime previousProvisioningStateTransitionTime(); + + /** + * Gets the publicData property: The public key of the certificate. + * + * @return the publicData value. + */ + String publicData(); + + /** + * Gets the deleteCertificateError property: This is only returned when the certificate provisioningState is + * 'Failed'. + * + * @return the deleteCertificateError value. + */ + DeleteCertificateError deleteCertificateError(); + + /** + * Gets the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.CertificateInner object. + * + * @return the inner object. + */ + CertificateInner innerModel(); + + /** The entirety of the Certificate definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Certificate definition stages. */ + interface DefinitionStages { + /** The first stage of the Certificate definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Certificate definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @return the next definition stage. + */ + WithCreate withExistingBatchAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the Certificate 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.WithThumbprintAlgorithm, + DefinitionStages.WithThumbprint, + DefinitionStages.WithFormat, + DefinitionStages.WithData, + DefinitionStages.WithPassword, + DefinitionStages.WithIfMatch, + DefinitionStages.WithIfNoneMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + Certificate create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Certificate create(Context context); + } + /** The stage of the Certificate definition allowing to specify thumbprintAlgorithm. */ + interface WithThumbprintAlgorithm { + /** + * Specifies the thumbprintAlgorithm property: This must match the first portion of the certificate name. + * Currently required to be 'SHA1'.. + * + * @param thumbprintAlgorithm This must match the first portion of the certificate name. Currently required + * to be 'SHA1'. + * @return the next definition stage. + */ + WithCreate withThumbprintAlgorithm(String thumbprintAlgorithm); + } + /** The stage of the Certificate definition allowing to specify thumbprint. */ + interface WithThumbprint { + /** + * Specifies the thumbprint property: This must match the thumbprint from the name.. + * + * @param thumbprint This must match the thumbprint from the name. + * @return the next definition stage. + */ + WithCreate withThumbprint(String thumbprint); + } + /** The stage of the Certificate definition allowing to specify format. */ + interface WithFormat { + /** + * Specifies the format property: The format of the certificate - either Pfx or Cer. If omitted, the default + * is Pfx.. + * + * @param format The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * @return the next definition stage. + */ + WithCreate withFormat(CertificateFormat format); + } + /** The stage of the Certificate definition allowing to specify data. */ + interface WithData { + /** + * Specifies the data property: The maximum size is 10KB.. + * + * @param data The maximum size is 10KB. + * @return the next definition stage. + */ + WithCreate withData(String data); + } + /** The stage of the Certificate definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: This must not be specified if the certificate format is Cer.. + * + * @param password This must not be specified if the certificate format is Cer. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + /** The stage of the Certificate definition allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: The entity state (ETag) version of the certificate to update. A value of + * "*" can be used to apply the operation only if the certificate already exists. If omitted, this operation + * will always be applied.. + * + * @param ifMatch The entity state (ETag) version of the certificate to update. A value of "*" can be used + * to apply the operation only if the certificate already exists. If omitted, this operation will always + * be applied. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + /** The stage of the Certificate definition allowing to specify ifNoneMatch. */ + interface WithIfNoneMatch { + /** + * Specifies the ifNoneMatch property: Set to '*' to allow a new certificate to be created, but to prevent + * updating an existing certificate. Other values will be ignored.. + * + * @param ifNoneMatch Set to '*' to allow a new certificate to be created, but to prevent updating an + * existing certificate. Other values will be ignored. + * @return the next definition stage. + */ + WithCreate withIfNoneMatch(String ifNoneMatch); + } + } + /** + * Begins update for the Certificate resource. + * + * @return the stage of resource update. + */ + Certificate.Update update(); + + /** The template for Certificate update. */ + interface Update + extends UpdateStages.WithThumbprintAlgorithm, + UpdateStages.WithThumbprint, + UpdateStages.WithFormat, + UpdateStages.WithData, + UpdateStages.WithPassword, + UpdateStages.WithIfMatch { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Certificate apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Certificate apply(Context context); + } + /** The Certificate update stages. */ + interface UpdateStages { + /** The stage of the Certificate update allowing to specify thumbprintAlgorithm. */ + interface WithThumbprintAlgorithm { + /** + * Specifies the thumbprintAlgorithm property: This must match the first portion of the certificate name. + * Currently required to be 'SHA1'.. + * + * @param thumbprintAlgorithm This must match the first portion of the certificate name. Currently required + * to be 'SHA1'. + * @return the next definition stage. + */ + Update withThumbprintAlgorithm(String thumbprintAlgorithm); + } + /** The stage of the Certificate update allowing to specify thumbprint. */ + interface WithThumbprint { + /** + * Specifies the thumbprint property: This must match the thumbprint from the name.. + * + * @param thumbprint This must match the thumbprint from the name. + * @return the next definition stage. + */ + Update withThumbprint(String thumbprint); + } + /** The stage of the Certificate update allowing to specify format. */ + interface WithFormat { + /** + * Specifies the format property: The format of the certificate - either Pfx or Cer. If omitted, the default + * is Pfx.. + * + * @param format The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * @return the next definition stage. + */ + Update withFormat(CertificateFormat format); + } + /** The stage of the Certificate update allowing to specify data. */ + interface WithData { + /** + * Specifies the data property: The maximum size is 10KB.. + * + * @param data The maximum size is 10KB. + * @return the next definition stage. + */ + Update withData(String data); + } + /** The stage of the Certificate update allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: This must not be specified if the certificate format is Cer.. + * + * @param password This must not be specified if the certificate format is Cer. + * @return the next definition stage. + */ + Update withPassword(String password); + } + /** The stage of the Certificate update allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: The entity state (ETag) version of the certificate to update. This value + * can be omitted or set to "*" to apply the operation unconditionally.. + * + * @param ifMatch The entity state (ETag) version of the certificate to update. This value can be omitted or + * set to "*" to apply the operation unconditionally. + * @return the next definition stage. + */ + Update withIfMatch(String ifMatch); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Certificate refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Certificate refresh(Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateBaseProperties.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateBaseProperties.java new file mode 100644 index 0000000000000..1d683a016353e --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateBaseProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 CertificateBaseProperties model. */ +@Fluent +public class CertificateBaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateBaseProperties.class); + + /* + * This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + */ + @JsonProperty(value = "thumbprintAlgorithm") + private String thumbprintAlgorithm; + + /* + * This must match the thumbprint from the name. + */ + @JsonProperty(value = "thumbprint") + private String thumbprint; + + /* + * The format of the certificate - either Pfx or Cer. If omitted, the + * default is Pfx. + */ + @JsonProperty(value = "format") + private CertificateFormat format; + + /** + * Get the thumbprintAlgorithm property: This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + * + * @return the thumbprintAlgorithm value. + */ + public String thumbprintAlgorithm() { + return this.thumbprintAlgorithm; + } + + /** + * Set the thumbprintAlgorithm property: This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + * + * @param thumbprintAlgorithm the thumbprintAlgorithm value to set. + * @return the CertificateBaseProperties object itself. + */ + public CertificateBaseProperties withThumbprintAlgorithm(String thumbprintAlgorithm) { + this.thumbprintAlgorithm = thumbprintAlgorithm; + return this; + } + + /** + * Get the thumbprint property: This must match the thumbprint from the name. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: This must match the thumbprint from the name. + * + * @param thumbprint the thumbprint value to set. + * @return the CertificateBaseProperties object itself. + */ + public CertificateBaseProperties withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the format property: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * + * @return the format value. + */ + public CertificateFormat format() { + return this.format; + } + + /** + * Set the format property: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * + * @param format the format value to set. + * @return the CertificateBaseProperties object itself. + */ + public CertificateBaseProperties withFormat(CertificateFormat format) { + this.format = format; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateCreateOrUpdateParameters.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateCreateOrUpdateParameters.java new file mode 100644 index 0000000000000..12849ed623d14 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateCreateOrUpdateParameters.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Contains information about a certificate. */ +@JsonFlatten +@Fluent +public class CertificateCreateOrUpdateParameters extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateCreateOrUpdateParameters.class); + + /* + * This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + */ + @JsonProperty(value = "properties.thumbprintAlgorithm") + private String thumbprintAlgorithm; + + /* + * This must match the thumbprint from the name. + */ + @JsonProperty(value = "properties.thumbprint") + private String thumbprint; + + /* + * The format of the certificate - either Pfx or Cer. If omitted, the + * default is Pfx. + */ + @JsonProperty(value = "properties.format") + private CertificateFormat format; + + /* + * The maximum size is 10KB. + */ + @JsonProperty(value = "properties.data") + private String data; + + /* + * This must not be specified if the certificate format is Cer. + */ + @JsonProperty(value = "properties.password") + private String password; + + /* + * The ETag of the resource, used for concurrency statements. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the thumbprintAlgorithm property: This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + * + * @return the thumbprintAlgorithm value. + */ + public String thumbprintAlgorithm() { + return this.thumbprintAlgorithm; + } + + /** + * Set the thumbprintAlgorithm property: This must match the first portion of the certificate name. Currently + * required to be 'SHA1'. + * + * @param thumbprintAlgorithm the thumbprintAlgorithm value to set. + * @return the CertificateCreateOrUpdateParameters object itself. + */ + public CertificateCreateOrUpdateParameters withThumbprintAlgorithm(String thumbprintAlgorithm) { + this.thumbprintAlgorithm = thumbprintAlgorithm; + return this; + } + + /** + * Get the thumbprint property: This must match the thumbprint from the name. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: This must match the thumbprint from the name. + * + * @param thumbprint the thumbprint value to set. + * @return the CertificateCreateOrUpdateParameters object itself. + */ + public CertificateCreateOrUpdateParameters withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the format property: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * + * @return the format value. + */ + public CertificateFormat format() { + return this.format; + } + + /** + * Set the format property: The format of the certificate - either Pfx or Cer. If omitted, the default is Pfx. + * + * @param format the format value to set. + * @return the CertificateCreateOrUpdateParameters object itself. + */ + public CertificateCreateOrUpdateParameters withFormat(CertificateFormat format) { + this.format = format; + return this; + } + + /** + * Get the data property: The maximum size is 10KB. + * + * @return the data value. + */ + public String data() { + return this.data; + } + + /** + * Set the data property: The maximum size is 10KB. + * + * @param data the data value to set. + * @return the CertificateCreateOrUpdateParameters object itself. + */ + public CertificateCreateOrUpdateParameters withData(String data) { + this.data = data; + return this; + } + + /** + * Get the password property: This must not be specified if the certificate format is Cer. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: This must not be specified if the certificate format is Cer. + * + * @param password the password value to set. + * @return the CertificateCreateOrUpdateParameters object itself. + */ + public CertificateCreateOrUpdateParameters withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateCreateOrUpdateProperties.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateCreateOrUpdateProperties.java new file mode 100644 index 0000000000000..fcfe3fb1182df --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateCreateOrUpdateProperties.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Certificate properties for create operations. */ +@Fluent +public final class CertificateCreateOrUpdateProperties extends CertificateBaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateCreateOrUpdateProperties.class); + + /* + * The maximum size is 10KB. + */ + @JsonProperty(value = "data", required = true) + private String data; + + /* + * This must not be specified if the certificate format is Cer. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the data property: The maximum size is 10KB. + * + * @return the data value. + */ + public String data() { + return this.data; + } + + /** + * Set the data property: The maximum size is 10KB. + * + * @param data the data value to set. + * @return the CertificateCreateOrUpdateProperties object itself. + */ + public CertificateCreateOrUpdateProperties withData(String data) { + this.data = data; + return this; + } + + /** + * Get the password property: This must not be specified if the certificate format is Cer. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: This must not be specified if the certificate format is Cer. + * + * @param password the password value to set. + * @return the CertificateCreateOrUpdateProperties object itself. + */ + public CertificateCreateOrUpdateProperties withPassword(String password) { + this.password = password; + return this; + } + + /** {@inheritDoc} */ + @Override + public CertificateCreateOrUpdateProperties withThumbprintAlgorithm(String thumbprintAlgorithm) { + super.withThumbprintAlgorithm(thumbprintAlgorithm); + return this; + } + + /** {@inheritDoc} */ + @Override + public CertificateCreateOrUpdateProperties withThumbprint(String thumbprint) { + super.withThumbprint(thumbprint); + return this; + } + + /** {@inheritDoc} */ + @Override + public CertificateCreateOrUpdateProperties withFormat(CertificateFormat format) { + super.withFormat(format); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (data() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property data in model CertificateCreateOrUpdateProperties")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateFormat.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateFormat.java new file mode 100644 index 0000000000000..001cb27180e2c --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateFormat.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CertificateFormat. */ +public enum CertificateFormat { + /** Enum value Pfx. */ + PFX("Pfx"), + + /** Enum value Cer. */ + CER("Cer"); + + /** The actual serialized value for a CertificateFormat instance. */ + private final String value; + + CertificateFormat(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CertificateFormat instance. + * + * @param value the serialized value to parse. + * @return the parsed CertificateFormat object, or null if unable to parse. + */ + @JsonCreator + public static CertificateFormat fromString(String value) { + CertificateFormat[] items = CertificateFormat.values(); + for (CertificateFormat item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateProperties.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateProperties.java new file mode 100644 index 0000000000000..419e1b7b996cd --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateProperties.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Certificate properties. */ +@Immutable +public final class CertificateProperties extends CertificateBaseProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateProperties.class); + + /* + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private CertificateProvisioningState provisioningState; + + /* + * The time at which the certificate entered its current state. + */ + @JsonProperty(value = "provisioningStateTransitionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime provisioningStateTransitionTime; + + /* + * The previous provisioned state of the resource + */ + @JsonProperty(value = "previousProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private CertificateProvisioningState previousProvisioningState; + + /* + * The time at which the certificate entered its previous state. + */ + @JsonProperty(value = "previousProvisioningStateTransitionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime previousProvisioningStateTransitionTime; + + /* + * The public key of the certificate. + */ + @JsonProperty(value = "publicData", access = JsonProperty.Access.WRITE_ONLY) + private String publicData; + + /* + * This is only returned when the certificate provisioningState is + * 'Failed'. + */ + @JsonProperty(value = "deleteCertificateError", access = JsonProperty.Access.WRITE_ONLY) + private DeleteCertificateError deleteCertificateError; + + /** + * Get the provisioningState property: The provisioningState property. + * + * @return the provisioningState value. + */ + public CertificateProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisioningStateTransitionTime property: The time at which the certificate entered its current state. + * + * @return the provisioningStateTransitionTime value. + */ + public OffsetDateTime provisioningStateTransitionTime() { + return this.provisioningStateTransitionTime; + } + + /** + * Get the previousProvisioningState property: The previous provisioned state of the resource. + * + * @return the previousProvisioningState value. + */ + public CertificateProvisioningState previousProvisioningState() { + return this.previousProvisioningState; + } + + /** + * Get the previousProvisioningStateTransitionTime property: The time at which the certificate entered its previous + * state. + * + * @return the previousProvisioningStateTransitionTime value. + */ + public OffsetDateTime previousProvisioningStateTransitionTime() { + return this.previousProvisioningStateTransitionTime; + } + + /** + * Get the publicData property: The public key of the certificate. + * + * @return the publicData value. + */ + public String publicData() { + return this.publicData; + } + + /** + * Get the deleteCertificateError property: This is only returned when the certificate provisioningState is + * 'Failed'. + * + * @return the deleteCertificateError value. + */ + public DeleteCertificateError deleteCertificateError() { + return this.deleteCertificateError; + } + + /** {@inheritDoc} */ + @Override + public CertificateProperties withThumbprintAlgorithm(String thumbprintAlgorithm) { + super.withThumbprintAlgorithm(thumbprintAlgorithm); + return this; + } + + /** {@inheritDoc} */ + @Override + public CertificateProperties withThumbprint(String thumbprint) { + super.withThumbprint(thumbprint); + return this; + } + + /** {@inheritDoc} */ + @Override + public CertificateProperties withFormat(CertificateFormat format) { + super.withFormat(format); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (deleteCertificateError() != null) { + deleteCertificateError().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateProvisioningState.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateProvisioningState.java new file mode 100644 index 0000000000000..eed1603e9e6bc --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateProvisioningState.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CertificateProvisioningState. */ +public enum CertificateProvisioningState { + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Deleting. */ + DELETING("Deleting"), + + /** Enum value Failed. */ + FAILED("Failed"); + + /** The actual serialized value for a CertificateProvisioningState instance. */ + private final String value; + + CertificateProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CertificateProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed CertificateProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static CertificateProvisioningState fromString(String value) { + CertificateProvisioningState[] items = CertificateProvisioningState.values(); + for (CertificateProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateReference.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateReference.java new file mode 100644 index 0000000000000..f013f7d80da28 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateReference.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 reference to a certificate to be installed on compute nodes in a pool. This must exist inside the same account as + * the pool. + */ +@Fluent +public final class CertificateReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificateReference.class); + + /* + * The fully qualified ID of the certificate to install on the pool. This + * must be inside the same batch account as the pool. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The default value is currentUser. This property is applicable only for + * pools configured with Windows nodes (that is, created with + * cloudServiceConfiguration, or with virtualMachineConfiguration using a + * Windows image reference). For Linux compute nodes, the certificates are + * stored in a directory inside the task working directory and an + * environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task + * to query for this location. For certificates with visibility of + * 'remoteUser', a 'certs' directory is created in the user's home + * directory (e.g., /home/{user-name}/certs) and certificates are placed in + * that directory. + */ + @JsonProperty(value = "storeLocation") + private CertificateStoreLocation storeLocation; + + /* + * This property is applicable only for pools configured with Windows nodes + * (that is, created with cloudServiceConfiguration, or with + * virtualMachineConfiguration using a Windows image reference). Common + * store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, + * TrustedPublisher, AuthRoot, AddressBook, but any custom store name can + * also be used. The default value is My. + */ + @JsonProperty(value = "storeName") + private String storeName; + + /* + * Which user accounts on the compute node should have access to the + * private data of the certificate. + */ + @JsonProperty(value = "visibility") + private List visibility; + + /** + * Get the id property: The fully qualified ID of the certificate to install on the pool. This must be inside the + * same batch account as the pool. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The fully qualified ID of the certificate to install on the pool. This must be inside the + * same batch account as the pool. + * + * @param id the id value to set. + * @return the CertificateReference object itself. + */ + public CertificateReference withId(String id) { + this.id = id; + return this; + } + + /** + * Get the storeLocation property: The default value is currentUser. This property is applicable only for pools + * configured with Windows nodes (that is, created with cloudServiceConfiguration, or with + * virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are + * stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is + * supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' + * directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in + * that directory. + * + * @return the storeLocation value. + */ + public CertificateStoreLocation storeLocation() { + return this.storeLocation; + } + + /** + * Set the storeLocation property: The default value is currentUser. This property is applicable only for pools + * configured with Windows nodes (that is, created with cloudServiceConfiguration, or with + * virtualMachineConfiguration using a Windows image reference). For Linux compute nodes, the certificates are + * stored in a directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is + * supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a 'certs' + * directory is created in the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in + * that directory. + * + * @param storeLocation the storeLocation value to set. + * @return the CertificateReference object itself. + */ + public CertificateReference withStoreLocation(CertificateStoreLocation storeLocation) { + this.storeLocation = storeLocation; + return this; + } + + /** + * Get the storeName property: This property is applicable only for pools configured with Windows nodes (that is, + * created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). + * Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, + * AddressBook, but any custom store name can also be used. The default value is My. + * + * @return the storeName value. + */ + public String storeName() { + return this.storeName; + } + + /** + * Set the storeName property: This property is applicable only for pools configured with Windows nodes (that is, + * created with cloudServiceConfiguration, or with virtualMachineConfiguration using a Windows image reference). + * Common store names include: My, Root, CA, Trust, Disallowed, TrustedPeople, TrustedPublisher, AuthRoot, + * AddressBook, but any custom store name can also be used. The default value is My. + * + * @param storeName the storeName value to set. + * @return the CertificateReference object itself. + */ + public CertificateReference withStoreName(String storeName) { + this.storeName = storeName; + return this; + } + + /** + * Get the visibility property: Which user accounts on the compute node should have access to the private data of + * the certificate. + * + * @return the visibility value. + */ + public List visibility() { + return this.visibility; + } + + /** + * Set the visibility property: Which user accounts on the compute node should have access to the private data of + * the certificate. + * + * @param visibility the visibility value to set. + * @return the CertificateReference object itself. + */ + public CertificateReference withVisibility(List visibility) { + this.visibility = visibility; + 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 CertificateReference")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateStoreLocation.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateStoreLocation.java new file mode 100644 index 0000000000000..aed52f92e5da6 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateStoreLocation.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CertificateStoreLocation. */ +public enum CertificateStoreLocation { + /** Enum value CurrentUser. */ + CURRENT_USER("CurrentUser"), + + /** Enum value LocalMachine. */ + LOCAL_MACHINE("LocalMachine"); + + /** The actual serialized value for a CertificateStoreLocation instance. */ + private final String value; + + CertificateStoreLocation(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CertificateStoreLocation instance. + * + * @param value the serialized value to parse. + * @return the parsed CertificateStoreLocation object, or null if unable to parse. + */ + @JsonCreator + public static CertificateStoreLocation fromString(String value) { + CertificateStoreLocation[] items = CertificateStoreLocation.values(); + for (CertificateStoreLocation item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateVisibility.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateVisibility.java new file mode 100644 index 0000000000000..9dd85eb59f06f --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificateVisibility.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CertificateVisibility. */ +public enum CertificateVisibility { + /** Enum value StartTask. */ + START_TASK("StartTask"), + + /** Enum value Task. */ + TASK("Task"), + + /** Enum value RemoteUser. */ + REMOTE_USER("RemoteUser"); + + /** The actual serialized value for a CertificateVisibility instance. */ + private final String value; + + CertificateVisibility(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CertificateVisibility instance. + * + * @param value the serialized value to parse. + * @return the parsed CertificateVisibility object, or null if unable to parse. + */ + @JsonCreator + public static CertificateVisibility fromString(String value) { + CertificateVisibility[] items = CertificateVisibility.values(); + for (CertificateVisibility item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificates.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificates.java new file mode 100644 index 0000000000000..c8452e3cc71ec --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Certificates.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 Certificates. */ +public interface Certificates { + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + PagedIterable listByBatchAccount(String resourceGroupName, String accountName); + + /** + * Lists all of the certificates in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are "properties/provisioningState", + * "properties/provisioningStateTransitionTime", "name". + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation. + */ + PagedIterable listByBatchAccount( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context); + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 certificateName); + + /** + * Deletes the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String certificateName, Context context); + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the specified certificate. + */ + Certificate get(String resourceGroupName, String accountName, String certificateName); + + /** + * Gets information about the specified certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @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 information about the specified certificate. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String certificateName, Context context); + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a certificate. + */ + Certificate cancelDeletion(String resourceGroupName, String accountName, String certificateName); + + /** + * If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate + * changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this + * operation to set the status of the certificate back to active. If you intend to delete the certificate, you do + * not need to run this operation after the deletion failed. You must make sure that the certificate is not being + * used by any resources, and then you can try again to delete the certificate. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param certificateName The identifier for the certificate. This must be made up of algorithm and thumbprint + * separated by a dash, and must match the certificate data in the request. For example SHA1-a3d1c5. + * @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 contains information about a certificate. + */ + Response cancelDeletionWithResponse( + String resourceGroupName, String accountName, String certificateName, Context context); + + /** + * Gets information about the specified certificate. + * + * @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 information about the specified certificate. + */ + Certificate getById(String id); + + /** + * Gets information about the specified certificate. + * + * @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 information about the specified certificate. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified certificate. + * + * @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 certificate. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Certificate resource. + * + * @param name resource name. + * @return the first stage of the new Certificate definition. + */ + Certificate.DefinitionStages.Blank define(String name); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCancelDeletionHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCancelDeletionHeaders.java new file mode 100644 index 0000000000000..85cef9b2138a6 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCancelDeletionHeaders.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.batch.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 CertificatesCancelDeletionHeaders model. */ +@Fluent +public final class CertificatesCancelDeletionHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificatesCancelDeletionHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the CertificatesCancelDeletionHeaders object itself. + */ + public CertificatesCancelDeletionHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCancelDeletionResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCancelDeletionResponse.java new file mode 100644 index 0000000000000..c1a1b17048fcf --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCancelDeletionResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; + +/** Contains all response data for the cancelDeletion operation. */ +public final class CertificatesCancelDeletionResponse + extends ResponseBase { + /** + * Creates an instance of CertificatesCancelDeletionResponse. + * + * @param request the request which resulted in this CertificatesCancelDeletionResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CertificatesCancelDeletionResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + CertificateInner value, + CertificatesCancelDeletionHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public CertificateInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCreateHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCreateHeaders.java new file mode 100644 index 0000000000000..e96a9b56bca44 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCreateHeaders.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.batch.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 CertificatesCreateHeaders model. */ +@Fluent +public final class CertificatesCreateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificatesCreateHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the CertificatesCreateHeaders object itself. + */ + public CertificatesCreateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCreateResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCreateResponse.java new file mode 100644 index 0000000000000..190b8bd054977 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesCreateResponse.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.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; + +/** Contains all response data for the create operation. */ +public final class CertificatesCreateResponse extends ResponseBase { + /** + * Creates an instance of CertificatesCreateResponse. + * + * @param request the request which resulted in this CertificatesCreateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CertificatesCreateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + CertificateInner value, + CertificatesCreateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public CertificateInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesDeleteHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesDeleteHeaders.java new file mode 100644 index 0000000000000..d7c494a6fc7b9 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesDeleteHeaders.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.batch.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 CertificatesDeleteHeaders model. */ +@Fluent +public final class CertificatesDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificatesDeleteHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the CertificatesDeleteHeaders object itself. + */ + public CertificatesDeleteHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the CertificatesDeleteHeaders object itself. + */ + public CertificatesDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesDeleteResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesDeleteResponse.java new file mode 100644 index 0000000000000..c4203bca66271 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesDeleteResponse.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.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class CertificatesDeleteResponse extends ResponseBase { + /** + * Creates an instance of CertificatesDeleteResponse. + * + * @param request the request which resulted in this CertificatesDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CertificatesDeleteResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, CertificatesDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesGetHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesGetHeaders.java new file mode 100644 index 0000000000000..f091b3bf10dc0 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesGetHeaders.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.batch.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 CertificatesGetHeaders model. */ +@Fluent +public final class CertificatesGetHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificatesGetHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the CertificatesGetHeaders object itself. + */ + public CertificatesGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesGetResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesGetResponse.java new file mode 100644 index 0000000000000..7f3da4712b337 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesGetResponse.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.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; + +/** Contains all response data for the get operation. */ +public final class CertificatesGetResponse extends ResponseBase { + /** + * Creates an instance of CertificatesGetResponse. + * + * @param request the request which resulted in this CertificatesGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CertificatesGetResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + CertificateInner value, + CertificatesGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public CertificateInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesUpdateHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesUpdateHeaders.java new file mode 100644 index 0000000000000..a3baadb87834b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesUpdateHeaders.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.batch.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 CertificatesUpdateHeaders model. */ +@Fluent +public final class CertificatesUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertificatesUpdateHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the CertificatesUpdateHeaders object itself. + */ + public CertificatesUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesUpdateResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesUpdateResponse.java new file mode 100644 index 0000000000000..6069707cc8943 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CertificatesUpdateResponse.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.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; + +/** Contains all response data for the update operation. */ +public final class CertificatesUpdateResponse extends ResponseBase { + /** + * Creates an instance of CertificatesUpdateResponse. + * + * @param request the request which resulted in this CertificatesUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public CertificatesUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + CertificateInner value, + CertificatesUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public CertificateInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CheckNameAvailabilityParameters.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CheckNameAvailabilityParameters.java new file mode 100644 index 0000000000000..acb696eb191b0 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CheckNameAvailabilityParameters.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Parameters for a check name availability request. */ +@Fluent +public final class CheckNameAvailabilityParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityParameters.class); + + /* + * The name to check for availability + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** Creates an instance of CheckNameAvailabilityParameters class. */ + public CheckNameAvailabilityParameters() { + type = "Microsoft.Batch/batchAccounts"; + } + + /** + * Get the name property: The name to check for availability. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name to check for availability. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityParameters object itself. + */ + public CheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityParameters object itself. + */ + public CheckNameAvailabilityParameters withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model CheckNameAvailabilityParameters")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CheckNameAvailabilityResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CheckNameAvailabilityResult.java new file mode 100644 index 0000000000000..644bce75d6488 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CheckNameAvailabilityResult.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.batch.models; + +import com.azure.resourcemanager.batch.fluent.models.CheckNameAvailabilityResultInner; + +/** An immutable client-side representation of CheckNameAvailabilityResult. */ +public interface CheckNameAvailabilityResult { + /** + * Gets the nameAvailable property: Gets a boolean value that indicates whether the name is available for you to + * use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Gets the reason that a Batch account name could not be used. The Reason element is only + * returned if NameAvailable is false. + * + * @return the reason value. + */ + NameAvailabilityReason reason(); + + /** + * Gets the message property: Gets an error message explaining the Reason value in more detail. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CifsMountConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CifsMountConfiguration.java new file mode 100644 index 0000000000000..6e63d4ab20fc1 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CifsMountConfiguration.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Information used to connect to a CIFS file system. */ +@Fluent +public final class CifsMountConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CifsMountConfiguration.class); + + /* + * The user to use for authentication against the CIFS file system. + */ + @JsonProperty(value = "username", required = true) + private String username; + + /* + * The URI of the file system to mount. + */ + @JsonProperty(value = "source", required = true) + private String source; + + /* + * All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + */ + @JsonProperty(value = "relativeMountPath", required = true) + private String relativeMountPath; + + /* + * These are 'net use' options in Windows and 'mount' options in Linux. + */ + @JsonProperty(value = "mountOptions") + private String mountOptions; + + /* + * The password to use for authentication against the CIFS file system. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** + * Get the username property: The user to use for authentication against the CIFS file system. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user to use for authentication against the CIFS file system. + * + * @param username the username value to set. + * @return the CifsMountConfiguration object itself. + */ + public CifsMountConfiguration withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the source property: The URI of the file system to mount. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: The URI of the file system to mount. + * + * @param source the source value to set. + * @return the CifsMountConfiguration object itself. + */ + public CifsMountConfiguration withSource(String source) { + this.source = source; + return this; + } + + /** + * Get the relativeMountPath property: All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + * + * @return the relativeMountPath value. + */ + public String relativeMountPath() { + return this.relativeMountPath; + } + + /** + * Set the relativeMountPath property: All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + * + * @param relativeMountPath the relativeMountPath value to set. + * @return the CifsMountConfiguration object itself. + */ + public CifsMountConfiguration withRelativeMountPath(String relativeMountPath) { + this.relativeMountPath = relativeMountPath; + return this; + } + + /** + * Get the mountOptions property: These are 'net use' options in Windows and 'mount' options in Linux. + * + * @return the mountOptions value. + */ + public String mountOptions() { + return this.mountOptions; + } + + /** + * Set the mountOptions property: These are 'net use' options in Windows and 'mount' options in Linux. + * + * @param mountOptions the mountOptions value to set. + * @return the CifsMountConfiguration object itself. + */ + public CifsMountConfiguration withMountOptions(String mountOptions) { + this.mountOptions = mountOptions; + return this; + } + + /** + * Get the password property: The password to use for authentication against the CIFS file system. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password to use for authentication against the CIFS file system. + * + * @param password the password value to set. + * @return the CifsMountConfiguration object itself. + */ + public CifsMountConfiguration withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (username() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property username in model CifsMountConfiguration")); + } + if (source() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property source in model CifsMountConfiguration")); + } + if (relativeMountPath() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property relativeMountPath in model CifsMountConfiguration")); + } + if (password() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property password in model CifsMountConfiguration")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CloudServiceConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CloudServiceConfiguration.java new file mode 100644 index 0000000000000..2989bf1bb9b52 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/CloudServiceConfiguration.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 configuration for nodes in a pool based on the Azure Cloud Services platform. */ +@Fluent +public final class CloudServiceConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CloudServiceConfiguration.class); + + /* + * Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 + * R2 SP1. 3 - OS Family 3, equivalent to Windows Server 2012. 4 - OS + * Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family 5, + * equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to + * Windows Server 2019. For more information, see Azure Guest OS Releases + * (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + */ + @JsonProperty(value = "osFamily", required = true) + private String osFamily; + + /* + * The default value is * which specifies the latest operating system + * version for the specified OS family. + */ + @JsonProperty(value = "osVersion") + private String osVersion; + + /** + * Get the osFamily property: Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS + * Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family + * 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, + * see Azure Guest OS Releases + * (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + * + * @return the osFamily value. + */ + public String osFamily() { + return this.osFamily; + } + + /** + * Set the osFamily property: Possible values are: 2 - OS Family 2, equivalent to Windows Server 2008 R2 SP1. 3 - OS + * Family 3, equivalent to Windows Server 2012. 4 - OS Family 4, equivalent to Windows Server 2012 R2. 5 - OS Family + * 5, equivalent to Windows Server 2016. 6 - OS Family 6, equivalent to Windows Server 2019. For more information, + * see Azure Guest OS Releases + * (https://azure.microsoft.com/documentation/articles/cloud-services-guestos-update-matrix/#releases). + * + * @param osFamily the osFamily value to set. + * @return the CloudServiceConfiguration object itself. + */ + public CloudServiceConfiguration withOsFamily(String osFamily) { + this.osFamily = osFamily; + return this; + } + + /** + * Get the osVersion property: The default value is * which specifies the latest operating system version for the + * specified OS family. + * + * @return the osVersion value. + */ + public String osVersion() { + return this.osVersion; + } + + /** + * Set the osVersion property: The default value is * which specifies the latest operating system version for the + * specified OS family. + * + * @param osVersion the osVersion value to set. + * @return the CloudServiceConfiguration object itself. + */ + public CloudServiceConfiguration withOsVersion(String osVersion) { + this.osVersion = osVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osFamily() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property osFamily in model CloudServiceConfiguration")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ComputeNodeDeallocationOption.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ComputeNodeDeallocationOption.java new file mode 100644 index 0000000000000..592739dcd6b6b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ComputeNodeDeallocationOption.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ComputeNodeDeallocationOption. */ +public enum ComputeNodeDeallocationOption { + /** Enum value Requeue. */ + REQUEUE("Requeue"), + + /** Enum value Terminate. */ + TERMINATE("Terminate"), + + /** Enum value TaskCompletion. */ + TASK_COMPLETION("TaskCompletion"), + + /** Enum value RetainedData. */ + RETAINED_DATA("RetainedData"); + + /** The actual serialized value for a ComputeNodeDeallocationOption instance. */ + private final String value; + + ComputeNodeDeallocationOption(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComputeNodeDeallocationOption instance. + * + * @param value the serialized value to parse. + * @return the parsed ComputeNodeDeallocationOption object, or null if unable to parse. + */ + @JsonCreator + public static ComputeNodeDeallocationOption fromString(String value) { + ComputeNodeDeallocationOption[] items = ComputeNodeDeallocationOption.values(); + for (ComputeNodeDeallocationOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ComputeNodeFillType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ComputeNodeFillType.java new file mode 100644 index 0000000000000..6b0a5bee7a350 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ComputeNodeFillType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ComputeNodeFillType. */ +public enum ComputeNodeFillType { + /** Enum value Spread. */ + SPREAD("Spread"), + + /** Enum value Pack. */ + PACK("Pack"); + + /** The actual serialized value for a ComputeNodeFillType instance. */ + private final String value; + + ComputeNodeFillType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComputeNodeFillType instance. + * + * @param value the serialized value to parse. + * @return the parsed ComputeNodeFillType object, or null if unable to parse. + */ + @JsonCreator + public static ComputeNodeFillType fromString(String value) { + ComputeNodeFillType[] items = ComputeNodeFillType.values(); + for (ComputeNodeFillType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerConfiguration.java new file mode 100644 index 0000000000000..394167a3b0c24 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerConfiguration.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The configuration for container-enabled pools. */ +@Fluent +public final class ContainerConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerConfiguration.class); + + /* + * The container technology to be used. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * This is the full image reference, as would be specified to "docker + * pull". An image will be sourced from the default Docker registry unless + * the image is fully qualified with an alternative registry. + */ + @JsonProperty(value = "containerImageNames") + private List containerImageNames; + + /* + * If any images must be downloaded from a private registry which requires + * credentials, then those credentials must be provided here. + */ + @JsonProperty(value = "containerRegistries") + private List containerRegistries; + + /** Creates an instance of ContainerConfiguration class. */ + public ContainerConfiguration() { + type = "DockerCompatible"; + } + + /** + * Get the type property: The container technology to be used. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The container technology to be used. + * + * @param type the type value to set. + * @return the ContainerConfiguration object itself. + */ + public ContainerConfiguration withType(String type) { + this.type = type; + return this; + } + + /** + * Get the containerImageNames property: This is the full image reference, as would be specified to "docker pull". + * An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative + * registry. + * + * @return the containerImageNames value. + */ + public List containerImageNames() { + return this.containerImageNames; + } + + /** + * Set the containerImageNames property: This is the full image reference, as would be specified to "docker pull". + * An image will be sourced from the default Docker registry unless the image is fully qualified with an alternative + * registry. + * + * @param containerImageNames the containerImageNames value to set. + * @return the ContainerConfiguration object itself. + */ + public ContainerConfiguration withContainerImageNames(List containerImageNames) { + this.containerImageNames = containerImageNames; + return this; + } + + /** + * Get the containerRegistries property: If any images must be downloaded from a private registry which requires + * credentials, then those credentials must be provided here. + * + * @return the containerRegistries value. + */ + public List containerRegistries() { + return this.containerRegistries; + } + + /** + * Set the containerRegistries property: If any images must be downloaded from a private registry which requires + * credentials, then those credentials must be provided here. + * + * @param containerRegistries the containerRegistries value to set. + * @return the ContainerConfiguration object itself. + */ + public ContainerConfiguration withContainerRegistries(List containerRegistries) { + this.containerRegistries = containerRegistries; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (containerRegistries() != null) { + containerRegistries().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerRegistry.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerRegistry.java new file mode 100644 index 0000000000000..9f82c2c013cf8 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerRegistry.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 private container registry. */ +@Fluent +public final class ContainerRegistry { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerRegistry.class); + + /* + * If omitted, the default is "docker.io". + */ + @JsonProperty(value = "registryServer") + private String registryServer; + + /* + * The user name to log into the registry server. + */ + @JsonProperty(value = "username", required = true) + private String username; + + /* + * The password to log into the registry server. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /** + * Get the registryServer property: If omitted, the default is "docker.io". + * + * @return the registryServer value. + */ + public String registryServer() { + return this.registryServer; + } + + /** + * Set the registryServer property: If omitted, the default is "docker.io". + * + * @param registryServer the registryServer value to set. + * @return the ContainerRegistry object itself. + */ + public ContainerRegistry withRegistryServer(String registryServer) { + this.registryServer = registryServer; + return this; + } + + /** + * Get the username property: The user name to log into the registry server. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The user name to log into the registry server. + * + * @param username the username value to set. + * @return the ContainerRegistry object itself. + */ + public ContainerRegistry withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password to log into the registry server. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password to log into the registry server. + * + * @param password the password value to set. + * @return the ContainerRegistry object itself. + */ + public ContainerRegistry withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (username() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property username in model ContainerRegistry")); + } + if (password() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property password in model ContainerRegistry")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerWorkingDirectory.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerWorkingDirectory.java new file mode 100644 index 0000000000000..e0defa22c5fbd --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ContainerWorkingDirectory.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ContainerWorkingDirectory. */ +public enum ContainerWorkingDirectory { + /** Enum value TaskWorkingDirectory. */ + TASK_WORKING_DIRECTORY("TaskWorkingDirectory"), + + /** Enum value ContainerImageDefault. */ + CONTAINER_IMAGE_DEFAULT("ContainerImageDefault"); + + /** The actual serialized value for a ContainerWorkingDirectory instance. */ + private final String value; + + ContainerWorkingDirectory(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ContainerWorkingDirectory instance. + * + * @param value the serialized value to parse. + * @return the parsed ContainerWorkingDirectory object, or null if unable to parse. + */ + @JsonCreator + public static ContainerWorkingDirectory fromString(String value) { + ContainerWorkingDirectory[] items = ContainerWorkingDirectory.values(); + for (ContainerWorkingDirectory item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DataDisk.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DataDisk.java new file mode 100644 index 0000000000000..3325e0f479aa1 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DataDisk.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Settings which will be used by the data disks associated to Compute Nodes in the Pool. When using attached data + * disks, you need to mount and format the disks from within a VM to use them. + */ +@Fluent +public final class DataDisk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataDisk.class); + + /* + * The lun is used to uniquely identify each data disk. If attaching + * multiple disks, each should have a distinct lun. The value must be + * between 0 and 63, inclusive. + */ + @JsonProperty(value = "lun", required = true) + private int lun; + + /* + * Values are: + * + * none - The caching mode for the disk is not enabled. + * readOnly - The caching mode for the disk is read only. + * readWrite - The caching mode for the disk is read and write. + * + * The default value for caching is none. For information about the caching + * options see: + * https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + */ + @JsonProperty(value = "caching") + private CachingType caching; + + /* + * The initial disk size in GB when creating new data disk. + */ + @JsonProperty(value = "diskSizeGB", required = true) + private int diskSizeGB; + + /* + * If omitted, the default is "Standard_LRS". Values are: + * + * Standard_LRS - The data disk should use standard locally redundant + * storage. + * Premium_LRS - The data disk should use premium locally redundant + * storage. + */ + @JsonProperty(value = "storageAccountType") + private StorageAccountType storageAccountType; + + /** + * Get the lun property: The lun is used to uniquely identify each data disk. If attaching multiple disks, each + * should have a distinct lun. The value must be between 0 and 63, inclusive. + * + * @return the lun value. + */ + public int lun() { + return this.lun; + } + + /** + * Set the lun property: The lun is used to uniquely identify each data disk. If attaching multiple disks, each + * should have a distinct lun. The value must be between 0 and 63, inclusive. + * + * @param lun the lun value to set. + * @return the DataDisk object itself. + */ + public DataDisk withLun(int lun) { + this.lun = lun; + return this; + } + + /** + * Get the caching property: Values are: + * + *

none - The caching mode for the disk is not enabled. readOnly - The caching mode for the disk is read only. + * readWrite - The caching mode for the disk is read and write. + * + *

The default value for caching is none. For information about the caching options see: + * https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + * + * @return the caching value. + */ + public CachingType caching() { + return this.caching; + } + + /** + * Set the caching property: Values are: + * + *

none - The caching mode for the disk is not enabled. readOnly - The caching mode for the disk is read only. + * readWrite - The caching mode for the disk is read and write. + * + *

The default value for caching is none. For information about the caching options see: + * https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/27/exploring-windows-azure-drives-disks-and-images/. + * + * @param caching the caching value to set. + * @return the DataDisk object itself. + */ + public DataDisk withCaching(CachingType caching) { + this.caching = caching; + return this; + } + + /** + * Get the diskSizeGB property: The initial disk size in GB when creating new data disk. + * + * @return the diskSizeGB value. + */ + public int diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: The initial disk size in GB when creating new data disk. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the DataDisk object itself. + */ + public DataDisk withDiskSizeGB(int diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the storageAccountType property: If omitted, the default is "Standard_LRS". Values are: + * + *

Standard_LRS - The data disk should use standard locally redundant storage. Premium_LRS - The data disk should + * use premium locally redundant storage. + * + * @return the storageAccountType value. + */ + public StorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: If omitted, the default is "Standard_LRS". Values are: + * + *

Standard_LRS - The data disk should use standard locally redundant storage. Premium_LRS - The data disk should + * use premium locally redundant storage. + * + * @param storageAccountType the storageAccountType value to set. + * @return the DataDisk object itself. + */ + public DataDisk withStorageAccountType(StorageAccountType storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DeleteCertificateError.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DeleteCertificateError.java new file mode 100644 index 0000000000000..dd5b0164b25fa --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DeleteCertificateError.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.batch.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; + +/** An error response from the Batch service. */ +@Fluent +public final class DeleteCertificateError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeleteCertificateError.class); + + /* + * An identifier for the error. Codes are invariant and are intended to be + * consumed programmatically. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /* + * A message describing the error, intended to be suitable for display in a + * user interface. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /* + * The target of the particular error. For example, the name of the + * property in error. + */ + @JsonProperty(value = "target") + private String target; + + /* + * A list of additional details about the error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the code property: An identifier for the error. Codes are invariant and are intended to be consumed + * programmatically. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: An identifier for the error. Codes are invariant and are intended to be consumed + * programmatically. + * + * @param code the code value to set. + * @return the DeleteCertificateError object itself. + */ + public DeleteCertificateError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: A message describing the error, intended to be suitable for display in a user + * interface. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: A message describing the error, intended to be suitable for display in a user + * interface. + * + * @param message the message value to set. + * @return the DeleteCertificateError object itself. + */ + public DeleteCertificateError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the target property: The target of the particular error. For example, the name of the property in error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The target of the particular error. For example, the name of the property in error. + * + * @param target the target value to set. + * @return the DeleteCertificateError object itself. + */ + public DeleteCertificateError withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the details property: A list of additional details about the error. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: A list of additional details about the error. + * + * @param details the details value to set. + * @return the DeleteCertificateError object itself. + */ + public DeleteCertificateError withDetails(List details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (code() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property code in model DeleteCertificateError")); + } + if (message() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property message in model DeleteCertificateError")); + } + if (details() != null) { + details().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DeploymentConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DeploymentConfiguration.java new file mode 100644 index 0000000000000..cbeaec59483e9 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DeploymentConfiguration.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Deployment configuration properties. */ +@Fluent +public final class DeploymentConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DeploymentConfiguration.class); + + /* + * This property and virtualMachineConfiguration are mutually exclusive and + * one of the properties must be specified. This property cannot be + * specified if the Batch account was created with its poolAllocationMode + * property set to 'UserSubscription'. + */ + @JsonProperty(value = "cloudServiceConfiguration") + private CloudServiceConfiguration cloudServiceConfiguration; + + /* + * This property and cloudServiceConfiguration are mutually exclusive and + * one of the properties must be specified. + */ + @JsonProperty(value = "virtualMachineConfiguration") + private VirtualMachineConfiguration virtualMachineConfiguration; + + /** + * Get the cloudServiceConfiguration property: This property and virtualMachineConfiguration are mutually exclusive + * and one of the properties must be specified. This property cannot be specified if the Batch account was created + * with its poolAllocationMode property set to 'UserSubscription'. + * + * @return the cloudServiceConfiguration value. + */ + public CloudServiceConfiguration cloudServiceConfiguration() { + return this.cloudServiceConfiguration; + } + + /** + * Set the cloudServiceConfiguration property: This property and virtualMachineConfiguration are mutually exclusive + * and one of the properties must be specified. This property cannot be specified if the Batch account was created + * with its poolAllocationMode property set to 'UserSubscription'. + * + * @param cloudServiceConfiguration the cloudServiceConfiguration value to set. + * @return the DeploymentConfiguration object itself. + */ + public DeploymentConfiguration withCloudServiceConfiguration(CloudServiceConfiguration cloudServiceConfiguration) { + this.cloudServiceConfiguration = cloudServiceConfiguration; + return this; + } + + /** + * Get the virtualMachineConfiguration property: This property and cloudServiceConfiguration are mutually exclusive + * and one of the properties must be specified. + * + * @return the virtualMachineConfiguration value. + */ + public VirtualMachineConfiguration virtualMachineConfiguration() { + return this.virtualMachineConfiguration; + } + + /** + * Set the virtualMachineConfiguration property: This property and cloudServiceConfiguration are mutually exclusive + * and one of the properties must be specified. + * + * @param virtualMachineConfiguration the virtualMachineConfiguration value to set. + * @return the DeploymentConfiguration object itself. + */ + public DeploymentConfiguration withVirtualMachineConfiguration( + VirtualMachineConfiguration virtualMachineConfiguration) { + this.virtualMachineConfiguration = virtualMachineConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (cloudServiceConfiguration() != null) { + cloudServiceConfiguration().validate(); + } + if (virtualMachineConfiguration() != null) { + virtualMachineConfiguration().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DiskEncryptionConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DiskEncryptionConfiguration.java new file mode 100644 index 0000000000000..95be06303a07d --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DiskEncryptionConfiguration.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The disk encryption configuration applied on compute nodes in the pool. Disk encryption configuration is not + * supported on Linux pool created with Virtual Machine Image or Shared Image Gallery Image. + */ +@Fluent +public final class DiskEncryptionConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiskEncryptionConfiguration.class); + + /* + * On Linux pool, only "TemporaryDisk" is supported; on Windows pool, + * "OsDisk" and "TemporaryDisk" must be specified. + */ + @JsonProperty(value = "targets") + private List targets; + + /** + * Get the targets property: On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and + * "TemporaryDisk" must be specified. + * + * @return the targets value. + */ + public List targets() { + return this.targets; + } + + /** + * Set the targets property: On Linux pool, only "TemporaryDisk" is supported; on Windows pool, "OsDisk" and + * "TemporaryDisk" must be specified. + * + * @param targets the targets value to set. + * @return the DiskEncryptionConfiguration object itself. + */ + public DiskEncryptionConfiguration withTargets(List targets) { + this.targets = targets; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DiskEncryptionTarget.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DiskEncryptionTarget.java new file mode 100644 index 0000000000000..f7704335025bc --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/DiskEncryptionTarget.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DiskEncryptionTarget. */ +public enum DiskEncryptionTarget { + /** Enum value OsDisk. */ + OS_DISK("OsDisk"), + + /** Enum value TemporaryDisk. */ + TEMPORARY_DISK("TemporaryDisk"); + + /** The actual serialized value for a DiskEncryptionTarget instance. */ + private final String value; + + DiskEncryptionTarget(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DiskEncryptionTarget instance. + * + * @param value the serialized value to parse. + * @return the parsed DiskEncryptionTarget object, or null if unable to parse. + */ + @JsonCreator + public static DiskEncryptionTarget fromString(String value) { + DiskEncryptionTarget[] items = DiskEncryptionTarget.values(); + for (DiskEncryptionTarget item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ElevationLevel.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ElevationLevel.java new file mode 100644 index 0000000000000..f5482daaf99ce --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ElevationLevel.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ElevationLevel. */ +public enum ElevationLevel { + /** Enum value NonAdmin. */ + NON_ADMIN("NonAdmin"), + + /** Enum value Admin. */ + ADMIN("Admin"); + + /** The actual serialized value for a ElevationLevel instance. */ + private final String value; + + ElevationLevel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ElevationLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed ElevationLevel object, or null if unable to parse. + */ + @JsonCreator + public static ElevationLevel fromString(String value) { + ElevationLevel[] items = ElevationLevel.values(); + for (ElevationLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/EncryptionProperties.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/EncryptionProperties.java new file mode 100644 index 0000000000000..5bf208fdab82c --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/EncryptionProperties.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** + * Configures how customer data is encrypted inside the Batch account. By default, accounts are encrypted using a + * Microsoft managed key. For additional control, a customer-managed key can be used instead. + */ +@Fluent +public final class EncryptionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionProperties.class); + + /* + * Type of the key source. + */ + @JsonProperty(value = "keySource") + private KeySource keySource; + + /* + * Additional details when using Microsoft.KeyVault + */ + @JsonProperty(value = "keyVaultProperties") + private KeyVaultProperties keyVaultProperties; + + /** + * Get the keySource property: Type of the key source. + * + * @return the keySource value. + */ + public KeySource keySource() { + return this.keySource; + } + + /** + * Set the keySource property: Type of the key source. + * + * @param keySource the keySource value to set. + * @return the EncryptionProperties object itself. + */ + public EncryptionProperties withKeySource(KeySource keySource) { + this.keySource = keySource; + return this; + } + + /** + * Get the keyVaultProperties property: Additional details when using Microsoft.KeyVault. + * + * @return the keyVaultProperties value. + */ + public KeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: Additional details when using Microsoft.KeyVault. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the EncryptionProperties object itself. + */ + public EncryptionProperties withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + 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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/EnvironmentSetting.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/EnvironmentSetting.java new file mode 100644 index 0000000000000..0ca106b4b34ad --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/EnvironmentSetting.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An environment variable to be set on a task process. */ +@Fluent +public final class EnvironmentSetting { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnvironmentSetting.class); + + /* + * The name of the environment variable. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The value of the environment variable. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The name of the environment variable. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the environment variable. + * + * @param name the name value to set. + * @return the EnvironmentSetting object itself. + */ + public EnvironmentSetting withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the environment variable. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the environment variable. + * + * @param value the value value to set. + * @return the EnvironmentSetting object itself. + */ + public EnvironmentSetting withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model EnvironmentSetting")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/FixedScaleSettings.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/FixedScaleSettings.java new file mode 100644 index 0000000000000..585c6b8cadc1c --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/FixedScaleSettings.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** Fixed scale settings for the pool. */ +@Fluent +public final class FixedScaleSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FixedScaleSettings.class); + + /* + * The default value is 15 minutes. Timeout values use ISO 8601 format. For + * example, use PT10M for 10 minutes. The minimum value is 5 minutes. If + * you specify a value less than 5 minutes, the Batch service rejects the + * request with an error; if you are calling the REST API directly, the + * HTTP status code is 400 (Bad Request). + */ + @JsonProperty(value = "resizeTimeout") + private Duration resizeTimeout; + + /* + * At least one of targetDedicatedNodes, targetLowPriorityNodes must be + * set. + */ + @JsonProperty(value = "targetDedicatedNodes") + private Integer targetDedicatedNodes; + + /* + * At least one of targetDedicatedNodes, targetLowPriorityNodes must be + * set. + */ + @JsonProperty(value = "targetLowPriorityNodes") + private Integer targetLowPriorityNodes; + + /* + * If omitted, the default value is Requeue. + */ + @JsonProperty(value = "nodeDeallocationOption") + private ComputeNodeDeallocationOption nodeDeallocationOption; + + /** + * Get the resizeTimeout property: The default value is 15 minutes. Timeout values use ISO 8601 format. For example, + * use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch + * service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 + * (Bad Request). + * + * @return the resizeTimeout value. + */ + public Duration resizeTimeout() { + return this.resizeTimeout; + } + + /** + * Set the resizeTimeout property: The default value is 15 minutes. Timeout values use ISO 8601 format. For example, + * use PT10M for 10 minutes. The minimum value is 5 minutes. If you specify a value less than 5 minutes, the Batch + * service rejects the request with an error; if you are calling the REST API directly, the HTTP status code is 400 + * (Bad Request). + * + * @param resizeTimeout the resizeTimeout value to set. + * @return the FixedScaleSettings object itself. + */ + public FixedScaleSettings withResizeTimeout(Duration resizeTimeout) { + this.resizeTimeout = resizeTimeout; + return this; + } + + /** + * Get the targetDedicatedNodes property: At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. + * + * @return the targetDedicatedNodes value. + */ + public Integer targetDedicatedNodes() { + return this.targetDedicatedNodes; + } + + /** + * Set the targetDedicatedNodes property: At least one of targetDedicatedNodes, targetLowPriorityNodes must be set. + * + * @param targetDedicatedNodes the targetDedicatedNodes value to set. + * @return the FixedScaleSettings object itself. + */ + public FixedScaleSettings withTargetDedicatedNodes(Integer targetDedicatedNodes) { + this.targetDedicatedNodes = targetDedicatedNodes; + return this; + } + + /** + * Get the targetLowPriorityNodes property: At least one of targetDedicatedNodes, targetLowPriorityNodes must be + * set. + * + * @return the targetLowPriorityNodes value. + */ + public Integer targetLowPriorityNodes() { + return this.targetLowPriorityNodes; + } + + /** + * Set the targetLowPriorityNodes property: At least one of targetDedicatedNodes, targetLowPriorityNodes must be + * set. + * + * @param targetLowPriorityNodes the targetLowPriorityNodes value to set. + * @return the FixedScaleSettings object itself. + */ + public FixedScaleSettings withTargetLowPriorityNodes(Integer targetLowPriorityNodes) { + this.targetLowPriorityNodes = targetLowPriorityNodes; + return this; + } + + /** + * Get the nodeDeallocationOption property: If omitted, the default value is Requeue. + * + * @return the nodeDeallocationOption value. + */ + public ComputeNodeDeallocationOption nodeDeallocationOption() { + return this.nodeDeallocationOption; + } + + /** + * Set the nodeDeallocationOption property: If omitted, the default value is Requeue. + * + * @param nodeDeallocationOption the nodeDeallocationOption value to set. + * @return the FixedScaleSettings object itself. + */ + public FixedScaleSettings withNodeDeallocationOption(ComputeNodeDeallocationOption nodeDeallocationOption) { + this.nodeDeallocationOption = nodeDeallocationOption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ImageReference.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ImageReference.java new file mode 100644 index 0000000000000..2e2c62485a874 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ImageReference.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 reference to an Azure Virtual Machines Marketplace image or the Azure Image resource of a custom Virtual Machine. + * To get the list of all imageReferences verified by Azure Batch, see the 'List supported node agent SKUs' operation. + */ +@Fluent +public final class ImageReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageReference.class); + + /* + * For example, Canonical or MicrosoftWindowsServer. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * For example, UbuntuServer or WindowsServer. + */ + @JsonProperty(value = "offer") + private String offer; + + /* + * For example, 18.04-LTS or 2019-Datacenter. + */ + @JsonProperty(value = "sku") + private String sku; + + /* + * A value of 'latest' can be specified to select the latest version of an + * image. If omitted, the default is 'latest'. + */ + @JsonProperty(value = "version") + private String version; + + /* + * This property is mutually exclusive with other properties. The Shared + * Image Gallery image must have replicas in the same region as the Azure + * Batch account. For information about the firewall settings for the Batch + * node agent to communicate with the Batch service see + * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the publisher property: For example, Canonical or MicrosoftWindowsServer. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: For example, Canonical or MicrosoftWindowsServer. + * + * @param publisher the publisher value to set. + * @return the ImageReference object itself. + */ + public ImageReference withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer property: For example, UbuntuServer or WindowsServer. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: For example, UbuntuServer or WindowsServer. + * + * @param offer the offer value to set. + * @return the ImageReference object itself. + */ + public ImageReference withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the sku property: For example, 18.04-LTS or 2019-Datacenter. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: For example, 18.04-LTS or 2019-Datacenter. + * + * @param sku the sku value to set. + * @return the ImageReference object itself. + */ + public ImageReference withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the version property: A value of 'latest' can be specified to select the latest version of an image. If + * omitted, the default is 'latest'. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: A value of 'latest' can be specified to select the latest version of an image. If + * omitted, the default is 'latest'. + * + * @param version the version value to set. + * @return the ImageReference object itself. + */ + public ImageReference withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the id property: This property is mutually exclusive with other properties. The Shared Image Gallery image + * must have replicas in the same region as the Azure Batch account. For information about the firewall settings for + * the Batch node agent to communicate with the Batch service see + * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: This property is mutually exclusive with other properties. The Shared Image Gallery image + * must have replicas in the same region as the Azure Batch account. For information about the firewall settings for + * the Batch node agent to communicate with the Batch service see + * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + * + * @param id the id value to set. + * @return the ImageReference object itself. + */ + public ImageReference withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InboundEndpointProtocol.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InboundEndpointProtocol.java new file mode 100644 index 0000000000000..00e1bd3663518 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InboundEndpointProtocol.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for InboundEndpointProtocol. */ +public enum InboundEndpointProtocol { + /** Enum value TCP. */ + TCP("TCP"), + + /** Enum value UDP. */ + UDP("UDP"); + + /** The actual serialized value for a InboundEndpointProtocol instance. */ + private final String value; + + InboundEndpointProtocol(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a InboundEndpointProtocol instance. + * + * @param value the serialized value to parse. + * @return the parsed InboundEndpointProtocol object, or null if unable to parse. + */ + @JsonCreator + public static InboundEndpointProtocol fromString(String value) { + InboundEndpointProtocol[] items = InboundEndpointProtocol.values(); + for (InboundEndpointProtocol item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InboundNatPool.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InboundNatPool.java new file mode 100644 index 0000000000000..9e0f1054508a1 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InboundNatPool.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.batch.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 inbound NAT pool that can be used to address specific ports on compute nodes in a Batch pool externally. */ +@Fluent +public final class InboundNatPool { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InboundNatPool.class); + + /* + * The name must be unique within a Batch pool, can contain letters, + * numbers, underscores, periods, and hyphens. Names must start with a + * letter or number, must end with a letter, number, or underscore, and + * cannot exceed 77 characters. If any invalid values are provided the + * request fails with HTTP status code 400. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The protocol of the endpoint. + */ + @JsonProperty(value = "protocol", required = true) + private InboundEndpointProtocol protocol; + + /* + * This must be unique within a Batch pool. Acceptable values are between 1 + * and 65535 except for 22, 3389, 29876 and 29877 as these are reserved. If + * any reserved values are provided the request fails with HTTP status code + * 400. + */ + @JsonProperty(value = "backendPort", required = true) + private int backendPort; + + /* + * Acceptable values range between 1 and 65534 except ports from 50000 to + * 55000 which are reserved. All ranges within a pool must be distinct and + * cannot overlap. If any reserved or overlapping values are provided the + * request fails with HTTP status code 400. + */ + @JsonProperty(value = "frontendPortRangeStart", required = true) + private int frontendPortRangeStart; + + /* + * Acceptable values range between 1 and 65534 except ports from 50000 to + * 55000 which are reserved by the Batch service. All ranges within a pool + * must be distinct and cannot overlap. If any reserved or overlapping + * values are provided the request fails with HTTP status code 400. + */ + @JsonProperty(value = "frontendPortRangeEnd", required = true) + private int frontendPortRangeEnd; + + /* + * The maximum number of rules that can be specified across all the + * endpoints on a Batch pool is 25. If no network security group rules are + * specified, a default rule will be created to allow inbound access to the + * specified backendPort. If the maximum number of network security group + * rules is exceeded the request fails with HTTP status code 400. + */ + @JsonProperty(value = "networkSecurityGroupRules") + private List networkSecurityGroupRules; + + /** + * Get the name property: The name must be unique within a Batch pool, can contain letters, numbers, underscores, + * periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, + * and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name must be unique within a Batch pool, can contain letters, numbers, underscores, + * periods, and hyphens. Names must start with a letter or number, must end with a letter, number, or underscore, + * and cannot exceed 77 characters. If any invalid values are provided the request fails with HTTP status code 400. + * + * @param name the name value to set. + * @return the InboundNatPool object itself. + */ + public InboundNatPool withName(String name) { + this.name = name; + return this; + } + + /** + * Get the protocol property: The protocol of the endpoint. + * + * @return the protocol value. + */ + public InboundEndpointProtocol protocol() { + return this.protocol; + } + + /** + * Set the protocol property: The protocol of the endpoint. + * + * @param protocol the protocol value to set. + * @return the InboundNatPool object itself. + */ + public InboundNatPool withProtocol(InboundEndpointProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the backendPort property: This must be unique within a Batch pool. Acceptable values are between 1 and 65535 + * except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails + * with HTTP status code 400. + * + * @return the backendPort value. + */ + public int backendPort() { + return this.backendPort; + } + + /** + * Set the backendPort property: This must be unique within a Batch pool. Acceptable values are between 1 and 65535 + * except for 22, 3389, 29876 and 29877 as these are reserved. If any reserved values are provided the request fails + * with HTTP status code 400. + * + * @param backendPort the backendPort value to set. + * @return the InboundNatPool object itself. + */ + public InboundNatPool withBackendPort(int backendPort) { + this.backendPort = backendPort; + return this; + } + + /** + * Get the frontendPortRangeStart property: Acceptable values range between 1 and 65534 except ports from 50000 to + * 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or + * overlapping values are provided the request fails with HTTP status code 400. + * + * @return the frontendPortRangeStart value. + */ + public int frontendPortRangeStart() { + return this.frontendPortRangeStart; + } + + /** + * Set the frontendPortRangeStart property: Acceptable values range between 1 and 65534 except ports from 50000 to + * 55000 which are reserved. All ranges within a pool must be distinct and cannot overlap. If any reserved or + * overlapping values are provided the request fails with HTTP status code 400. + * + * @param frontendPortRangeStart the frontendPortRangeStart value to set. + * @return the InboundNatPool object itself. + */ + public InboundNatPool withFrontendPortRangeStart(int frontendPortRangeStart) { + this.frontendPortRangeStart = frontendPortRangeStart; + return this; + } + + /** + * Get the frontendPortRangeEnd property: Acceptable values range between 1 and 65534 except ports from 50000 to + * 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If + * any reserved or overlapping values are provided the request fails with HTTP status code 400. + * + * @return the frontendPortRangeEnd value. + */ + public int frontendPortRangeEnd() { + return this.frontendPortRangeEnd; + } + + /** + * Set the frontendPortRangeEnd property: Acceptable values range between 1 and 65534 except ports from 50000 to + * 55000 which are reserved by the Batch service. All ranges within a pool must be distinct and cannot overlap. If + * any reserved or overlapping values are provided the request fails with HTTP status code 400. + * + * @param frontendPortRangeEnd the frontendPortRangeEnd value to set. + * @return the InboundNatPool object itself. + */ + public InboundNatPool withFrontendPortRangeEnd(int frontendPortRangeEnd) { + this.frontendPortRangeEnd = frontendPortRangeEnd; + return this; + } + + /** + * Get the networkSecurityGroupRules property: The maximum number of rules that can be specified across all the + * endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created + * to allow inbound access to the specified backendPort. If the maximum number of network security group rules is + * exceeded the request fails with HTTP status code 400. + * + * @return the networkSecurityGroupRules value. + */ + public List networkSecurityGroupRules() { + return this.networkSecurityGroupRules; + } + + /** + * Set the networkSecurityGroupRules property: The maximum number of rules that can be specified across all the + * endpoints on a Batch pool is 25. If no network security group rules are specified, a default rule will be created + * to allow inbound access to the specified backendPort. If the maximum number of network security group rules is + * exceeded the request fails with HTTP status code 400. + * + * @param networkSecurityGroupRules the networkSecurityGroupRules value to set. + * @return the InboundNatPool object itself. + */ + public InboundNatPool withNetworkSecurityGroupRules(List networkSecurityGroupRules) { + this.networkSecurityGroupRules = networkSecurityGroupRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model InboundNatPool")); + } + if (protocol() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property protocol in model InboundNatPool")); + } + if (networkSecurityGroupRules() != null) { + networkSecurityGroupRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InterNodeCommunicationState.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InterNodeCommunicationState.java new file mode 100644 index 0000000000000..a42644466d6f7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/InterNodeCommunicationState.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for InterNodeCommunicationState. */ +public enum InterNodeCommunicationState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a InterNodeCommunicationState instance. */ + private final String value; + + InterNodeCommunicationState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a InterNodeCommunicationState instance. + * + * @param value the serialized value to parse. + * @return the parsed InterNodeCommunicationState object, or null if unable to parse. + */ + @JsonCreator + public static InterNodeCommunicationState fromString(String value) { + InterNodeCommunicationState[] items = InterNodeCommunicationState.values(); + for (InterNodeCommunicationState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/IpAddressProvisioningType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/IpAddressProvisioningType.java new file mode 100644 index 0000000000000..a37b33c3dc989 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/IpAddressProvisioningType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for IpAddressProvisioningType. */ +public enum IpAddressProvisioningType { + /** Enum value BatchManaged. */ + BATCH_MANAGED("BatchManaged"), + + /** Enum value UserManaged. */ + USER_MANAGED("UserManaged"), + + /** Enum value NoPublicIPAddresses. */ + NO_PUBLIC_IPADDRESSES("NoPublicIPAddresses"); + + /** The actual serialized value for a IpAddressProvisioningType instance. */ + private final String value; + + IpAddressProvisioningType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IpAddressProvisioningType instance. + * + * @param value the serialized value to parse. + * @return the parsed IpAddressProvisioningType object, or null if unable to parse. + */ + @JsonCreator + public static IpAddressProvisioningType fromString(String value) { + IpAddressProvisioningType[] items = IpAddressProvisioningType.values(); + for (IpAddressProvisioningType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeySource.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeySource.java new file mode 100644 index 0000000000000..e5fcec5a99cf7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeySource.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for KeySource. */ +public enum KeySource { + /** Enum value Microsoft.Batch. */ + MICROSOFT_BATCH("Microsoft.Batch"), + + /** Enum value Microsoft.KeyVault. */ + MICROSOFT_KEY_VAULT("Microsoft.KeyVault"); + + /** The actual serialized value for a KeySource instance. */ + private final String value; + + KeySource(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeySource instance. + * + * @param value the serialized value to parse. + * @return the parsed KeySource object, or null if unable to parse. + */ + @JsonCreator + public static KeySource fromString(String value) { + KeySource[] items = KeySource.values(); + for (KeySource item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeyVaultProperties.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeyVaultProperties.java new file mode 100644 index 0000000000000..4beb295090f36 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeyVaultProperties.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** KeyVault configuration when using an encryption KeySource of Microsoft.KeyVault. */ +@Fluent +public final class KeyVaultProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultProperties.class); + + /* + * Full path to the versioned secret. Example + * https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. + * To be usable the following prerequisites must be met: + * + * The Batch Account has a System Assigned identity + * The account identity has been granted Key/Get, Key/Unwrap and Key/Wrap + * permissions + * The KeyVault has soft-delete and purge protection enabled + */ + @JsonProperty(value = "keyIdentifier") + private String keyIdentifier; + + /** + * Get the keyIdentifier property: Full path to the versioned secret. Example + * https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following + * prerequisites must be met: + * + *

The Batch Account has a System Assigned identity The account identity has been granted Key/Get, Key/Unwrap and + * Key/Wrap permissions The KeyVault has soft-delete and purge protection enabled. + * + * @return the keyIdentifier value. + */ + public String keyIdentifier() { + return this.keyIdentifier; + } + + /** + * Set the keyIdentifier property: Full path to the versioned secret. Example + * https://mykeyvault.vault.azure.net/keys/testkey/6e34a81fef704045975661e297a4c053. To be usable the following + * prerequisites must be met: + * + *

The Batch Account has a System Assigned identity The account identity has been granted Key/Get, Key/Unwrap and + * Key/Wrap permissions The KeyVault has soft-delete and purge protection enabled. + * + * @param keyIdentifier the keyIdentifier value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyIdentifier(String keyIdentifier) { + this.keyIdentifier = keyIdentifier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeyVaultReference.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeyVaultReference.java new file mode 100644 index 0000000000000..17e2bfda4b1ab --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/KeyVaultReference.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Identifies the Azure key vault associated with a Batch account. */ +@Fluent +public final class KeyVaultReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(KeyVaultReference.class); + + /* + * The resource ID of the Azure key vault associated with the Batch + * account. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The URL of the Azure key vault associated with the Batch account. + */ + @JsonProperty(value = "url", required = true) + private String url; + + /** + * Get the id property: The resource ID of the Azure key vault associated with the Batch account. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The resource ID of the Azure key vault associated with the Batch account. + * + * @param id the id value to set. + * @return the KeyVaultReference object itself. + */ + public KeyVaultReference withId(String id) { + this.id = id; + return this; + } + + /** + * Get the url property: The URL of the Azure key vault associated with the Batch account. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: The URL of the Azure key vault associated with the Batch account. + * + * @param url the url value to set. + * @return the KeyVaultReference object itself. + */ + public KeyVaultReference withUrl(String url) { + this.url = url; + 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 KeyVaultReference")); + } + if (url() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property url in model KeyVaultReference")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/LinuxUserConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/LinuxUserConfiguration.java new file mode 100644 index 0000000000000..665534a33faf8 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/LinuxUserConfiguration.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 used to create a user account on a Linux node. */ +@Fluent +public final class LinuxUserConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LinuxUserConfiguration.class); + + /* + * The uid and gid properties must be specified together or not at all. If + * not specified the underlying operating system picks the uid. + */ + @JsonProperty(value = "uid") + private Integer uid; + + /* + * The uid and gid properties must be specified together or not at all. If + * not specified the underlying operating system picks the gid. + */ + @JsonProperty(value = "gid") + private Integer gid; + + /* + * The private key must not be password protected. The private key is used + * to automatically configure asymmetric-key based authentication for SSH + * between nodes in a Linux pool when the pool's + * enableInterNodeCommunication property is true (it is ignored if + * enableInterNodeCommunication is false). It does this by placing the key + * pair into the user's .ssh directory. If not specified, password-less SSH + * is not configured between nodes (no modification of the user's .ssh + * directory is done). + */ + @JsonProperty(value = "sshPrivateKey") + private String sshPrivateKey; + + /** + * Get the uid property: The uid and gid properties must be specified together or not at all. If not specified the + * underlying operating system picks the uid. + * + * @return the uid value. + */ + public Integer uid() { + return this.uid; + } + + /** + * Set the uid property: The uid and gid properties must be specified together or not at all. If not specified the + * underlying operating system picks the uid. + * + * @param uid the uid value to set. + * @return the LinuxUserConfiguration object itself. + */ + public LinuxUserConfiguration withUid(Integer uid) { + this.uid = uid; + return this; + } + + /** + * Get the gid property: The uid and gid properties must be specified together or not at all. If not specified the + * underlying operating system picks the gid. + * + * @return the gid value. + */ + public Integer gid() { + return this.gid; + } + + /** + * Set the gid property: The uid and gid properties must be specified together or not at all. If not specified the + * underlying operating system picks the gid. + * + * @param gid the gid value to set. + * @return the LinuxUserConfiguration object itself. + */ + public LinuxUserConfiguration withGid(Integer gid) { + this.gid = gid; + return this; + } + + /** + * Get the sshPrivateKey property: The private key must not be password protected. The private key is used to + * automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's + * enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does + * this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not + * configured between nodes (no modification of the user's .ssh directory is done). + * + * @return the sshPrivateKey value. + */ + public String sshPrivateKey() { + return this.sshPrivateKey; + } + + /** + * Set the sshPrivateKey property: The private key must not be password protected. The private key is used to + * automatically configure asymmetric-key based authentication for SSH between nodes in a Linux pool when the pool's + * enableInterNodeCommunication property is true (it is ignored if enableInterNodeCommunication is false). It does + * this by placing the key pair into the user's .ssh directory. If not specified, password-less SSH is not + * configured between nodes (no modification of the user's .ssh directory is done). + * + * @param sshPrivateKey the sshPrivateKey value to set. + * @return the LinuxUserConfiguration object itself. + */ + public LinuxUserConfiguration withSshPrivateKey(String sshPrivateKey) { + this.sshPrivateKey = sshPrivateKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListApplicationPackagesResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListApplicationPackagesResult.java new file mode 100644 index 0000000000000..89d90580fa375 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListApplicationPackagesResult.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.models.ApplicationPackageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of performing list application packages. */ +@Fluent +public final class ListApplicationPackagesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListApplicationPackagesResult.class); + + /* + * The list of application packages. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of application packages. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of application packages. + * + * @param value the value value to set. + * @return the ListApplicationPackagesResult object itself. + */ + public ListApplicationPackagesResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ListApplicationPackagesResult object itself. + */ + public ListApplicationPackagesResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListApplicationsResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListApplicationsResult.java new file mode 100644 index 0000000000000..b77c21c905cee --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListApplicationsResult.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.models.ApplicationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of performing list applications. */ +@Fluent +public final class ListApplicationsResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListApplicationsResult.class); + + /* + * The list of applications. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of applications. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of applications. + * + * @param value the value value to set. + * @return the ListApplicationsResult object itself. + */ + public ListApplicationsResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the ListApplicationsResult object itself. + */ + public ListApplicationsResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListCertificatesResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListCertificatesResult.java new file mode 100644 index 0000000000000..3d21f1fe2d72d --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListCertificatesResult.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.models.CertificateInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Values returned by the List operation. */ +@Fluent +public final class ListCertificatesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListCertificatesResult.class); + + /* + * The collection of returned certificates. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The continuation token. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The collection of returned certificates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of returned certificates. + * + * @param value the value value to set. + * @return the ListCertificatesResult object itself. + */ + public ListCertificatesResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The continuation token. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The continuation token. + * + * @param nextLink the nextLink value to set. + * @return the ListCertificatesResult object itself. + */ + public ListCertificatesResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPoolsResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPoolsResult.java new file mode 100644 index 0000000000000..63cbe10e79a4b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPoolsResult.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Values returned by the List operation. */ +@Fluent +public final class ListPoolsResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListPoolsResult.class); + + /* + * The collection of returned pools. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The continuation token. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The collection of returned pools. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of returned pools. + * + * @param value the value value to set. + * @return the ListPoolsResult object itself. + */ + public ListPoolsResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The continuation token. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The continuation token. + * + * @param nextLink the nextLink value to set. + * @return the ListPoolsResult object itself. + */ + public ListPoolsResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPrivateEndpointConnectionsResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPrivateEndpointConnectionsResult.java new file mode 100644 index 0000000000000..20f90ab1f4bbd --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPrivateEndpointConnectionsResult.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Values returned by the List operation. */ +@Fluent +public final class ListPrivateEndpointConnectionsResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListPrivateEndpointConnectionsResult.class); + + /* + * The collection of returned private endpoint connection. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The continuation token. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The collection of returned private endpoint connection. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of returned private endpoint connection. + * + * @param value the value value to set. + * @return the ListPrivateEndpointConnectionsResult object itself. + */ + public ListPrivateEndpointConnectionsResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The continuation token. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The continuation token. + * + * @param nextLink the nextLink value to set. + * @return the ListPrivateEndpointConnectionsResult object itself. + */ + public ListPrivateEndpointConnectionsResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPrivateLinkResourcesResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPrivateLinkResourcesResult.java new file mode 100644 index 0000000000000..45e9daabfd9d7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ListPrivateLinkResourcesResult.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Values returned by the List operation. */ +@Fluent +public final class ListPrivateLinkResourcesResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ListPrivateLinkResourcesResult.class); + + /* + * The collection of returned private link resources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The continuation token. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The collection of returned private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of returned private link resources. + * + * @param value the value value to set. + * @return the ListPrivateLinkResourcesResult object itself. + */ + public ListPrivateLinkResourcesResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The continuation token. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The continuation token. + * + * @param nextLink the nextLink value to set. + * @return the ListPrivateLinkResourcesResult object itself. + */ + public ListPrivateLinkResourcesResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Locations.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Locations.java new file mode 100644 index 0000000000000..c0d1e1ef24880 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Locations.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Locations. */ +public interface Locations { + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Batch service quotas for the specified subscription at the given location. + */ + BatchLocationQuota getQuotas(String locationName); + + /** + * Gets the Batch service quotas for the specified subscription at the given location. + * + * @param locationName The region for which to retrieve Batch service quotas. + * @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 Batch service quotas for the specified subscription at the given location. + */ + Response getQuotasWithResponse(String locationName, Context context); + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + CheckNameAvailabilityResult checkNameAvailability(String locationName, CheckNameAvailabilityParameters parameters); + + /** + * Checks whether the Batch account name is available in the specified region. + * + * @param locationName The desired region for the name check. + * @param parameters Properties needed to check the availability of a name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + Response checkNameAvailabilityWithResponse( + String locationName, CheckNameAvailabilityParameters parameters, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/LoginMode.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/LoginMode.java new file mode 100644 index 0000000000000..1f04aff5ad715 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/LoginMode.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for LoginMode. */ +public enum LoginMode { + /** Enum value Batch. */ + BATCH("Batch"), + + /** Enum value Interactive. */ + INTERACTIVE("Interactive"); + + /** The actual serialized value for a LoginMode instance. */ + private final String value; + + LoginMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a LoginMode instance. + * + * @param value the serialized value to parse. + * @return the parsed LoginMode object, or null if unable to parse. + */ + @JsonCreator + public static LoginMode fromString(String value) { + LoginMode[] items = LoginMode.values(); + for (LoginMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/MetadataItem.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/MetadataItem.java new file mode 100644 index 0000000000000..46ad6ad2c298f --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/MetadataItem.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 Batch service does not assign any meaning to this metadata; it is solely for the use of user code. */ +@Fluent +public final class MetadataItem { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetadataItem.class); + + /* + * The name of the metadata item. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The value of the metadata item. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the name property: The name of the metadata item. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the metadata item. + * + * @param name the name value to set. + * @return the MetadataItem object itself. + */ + public MetadataItem withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the metadata item. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the metadata item. + * + * @param value the value value to set. + * @return the MetadataItem object itself. + */ + public MetadataItem withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model MetadataItem")); + } + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model MetadataItem")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/MountConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/MountConfiguration.java new file mode 100644 index 0000000000000..71a3046a0358a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/MountConfiguration.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 file system to mount on each node. */ +@Fluent +public final class MountConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MountConfiguration.class); + + /* + * This property is mutually exclusive with all other properties. + */ + @JsonProperty(value = "azureBlobFileSystemConfiguration") + private AzureBlobFileSystemConfiguration azureBlobFileSystemConfiguration; + + /* + * This property is mutually exclusive with all other properties. + */ + @JsonProperty(value = "nfsMountConfiguration") + private NfsMountConfiguration nfsMountConfiguration; + + /* + * This property is mutually exclusive with all other properties. + */ + @JsonProperty(value = "cifsMountConfiguration") + private CifsMountConfiguration cifsMountConfiguration; + + /* + * This property is mutually exclusive with all other properties. + */ + @JsonProperty(value = "azureFileShareConfiguration") + private AzureFileShareConfiguration azureFileShareConfiguration; + + /** + * Get the azureBlobFileSystemConfiguration property: This property is mutually exclusive with all other properties. + * + * @return the azureBlobFileSystemConfiguration value. + */ + public AzureBlobFileSystemConfiguration azureBlobFileSystemConfiguration() { + return this.azureBlobFileSystemConfiguration; + } + + /** + * Set the azureBlobFileSystemConfiguration property: This property is mutually exclusive with all other properties. + * + * @param azureBlobFileSystemConfiguration the azureBlobFileSystemConfiguration value to set. + * @return the MountConfiguration object itself. + */ + public MountConfiguration withAzureBlobFileSystemConfiguration( + AzureBlobFileSystemConfiguration azureBlobFileSystemConfiguration) { + this.azureBlobFileSystemConfiguration = azureBlobFileSystemConfiguration; + return this; + } + + /** + * Get the nfsMountConfiguration property: This property is mutually exclusive with all other properties. + * + * @return the nfsMountConfiguration value. + */ + public NfsMountConfiguration nfsMountConfiguration() { + return this.nfsMountConfiguration; + } + + /** + * Set the nfsMountConfiguration property: This property is mutually exclusive with all other properties. + * + * @param nfsMountConfiguration the nfsMountConfiguration value to set. + * @return the MountConfiguration object itself. + */ + public MountConfiguration withNfsMountConfiguration(NfsMountConfiguration nfsMountConfiguration) { + this.nfsMountConfiguration = nfsMountConfiguration; + return this; + } + + /** + * Get the cifsMountConfiguration property: This property is mutually exclusive with all other properties. + * + * @return the cifsMountConfiguration value. + */ + public CifsMountConfiguration cifsMountConfiguration() { + return this.cifsMountConfiguration; + } + + /** + * Set the cifsMountConfiguration property: This property is mutually exclusive with all other properties. + * + * @param cifsMountConfiguration the cifsMountConfiguration value to set. + * @return the MountConfiguration object itself. + */ + public MountConfiguration withCifsMountConfiguration(CifsMountConfiguration cifsMountConfiguration) { + this.cifsMountConfiguration = cifsMountConfiguration; + return this; + } + + /** + * Get the azureFileShareConfiguration property: This property is mutually exclusive with all other properties. + * + * @return the azureFileShareConfiguration value. + */ + public AzureFileShareConfiguration azureFileShareConfiguration() { + return this.azureFileShareConfiguration; + } + + /** + * Set the azureFileShareConfiguration property: This property is mutually exclusive with all other properties. + * + * @param azureFileShareConfiguration the azureFileShareConfiguration value to set. + * @return the MountConfiguration object itself. + */ + public MountConfiguration withAzureFileShareConfiguration(AzureFileShareConfiguration azureFileShareConfiguration) { + this.azureFileShareConfiguration = azureFileShareConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (azureBlobFileSystemConfiguration() != null) { + azureBlobFileSystemConfiguration().validate(); + } + if (nfsMountConfiguration() != null) { + nfsMountConfiguration().validate(); + } + if (cifsMountConfiguration() != null) { + cifsMountConfiguration().validate(); + } + if (azureFileShareConfiguration() != null) { + azureFileShareConfiguration().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NameAvailabilityReason.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NameAvailabilityReason.java new file mode 100644 index 0000000000000..b297758d3bbf7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NameAvailabilityReason.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for NameAvailabilityReason. */ +public enum NameAvailabilityReason { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value AlreadyExists. */ + ALREADY_EXISTS("AlreadyExists"); + + /** The actual serialized value for a NameAvailabilityReason instance. */ + private final String value; + + NameAvailabilityReason(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NameAvailabilityReason instance. + * + * @param value the serialized value to parse. + * @return the parsed NameAvailabilityReason object, or null if unable to parse. + */ + @JsonCreator + public static NameAvailabilityReason fromString(String value) { + NameAvailabilityReason[] items = NameAvailabilityReason.values(); + for (NameAvailabilityReason item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkConfiguration.java new file mode 100644 index 0000000000000..be2498194491e --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkConfiguration.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 network configuration for a pool. */ +@Fluent +public final class NetworkConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkConfiguration.class); + + /* + * The virtual network must be in the same region and subscription as the + * Azure Batch account. The specified subnet should have enough free IP + * addresses to accommodate the number of nodes in the pool. If the subnet + * doesn't have enough free IP addresses, the pool will partially allocate + * compute nodes and a resize error will occur. The 'MicrosoftAzureBatch' + * service principal must have the 'Classic Virtual Machine Contributor' + * Role-Based Access Control (RBAC) role for the specified VNet. The + * specified subnet must allow communication from the Azure Batch service + * to be able to schedule tasks on the compute nodes. This can be verified + * by checking if the specified VNet has any associated Network Security + * Groups (NSG). If communication to the compute nodes in the specified + * subnet is denied by an NSG, then the Batch service will set the state of + * the compute nodes to unusable. If the specified VNet has any associated + * Network Security Groups (NSG), then a few reserved system ports must be + * enabled for inbound communication. For pools created with a virtual + * machine configuration, enable ports 29876 and 29877, as well as port 22 + * for Linux and port 3389 for Windows. For pools created with a cloud + * service configuration, enable ports 10100, 20100, and 30100. Also enable + * outbound connections to Azure Storage on port 443. For + * cloudServiceConfiguration pools, only 'classic' VNETs are supported. For + * more details see: + * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /* + * Pool endpoint configuration is only supported on pools with the + * virtualMachineConfiguration property. + */ + @JsonProperty(value = "endpointConfiguration") + private PoolEndpointConfiguration endpointConfiguration; + + /* + * This property is only supported on Pools with the + * virtualMachineConfiguration property. + */ + @JsonProperty(value = "publicIPAddressConfiguration") + private PublicIpAddressConfiguration publicIpAddressConfiguration; + + /** + * Get the subnetId property: The virtual network must be in the same region and subscription as the Azure Batch + * account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the + * pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a + * resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine + * Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow + * communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be + * verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to + * the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the + * compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few + * reserved system ports must be enabled for inbound communication. For pools created with a virtual machine + * configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools + * created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound + * connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are + * supported. For more details see: + * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: The virtual network must be in the same region and subscription as the Azure Batch + * account. The specified subnet should have enough free IP addresses to accommodate the number of nodes in the + * pool. If the subnet doesn't have enough free IP addresses, the pool will partially allocate compute nodes and a + * resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine + * Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow + * communication from the Azure Batch service to be able to schedule tasks on the compute nodes. This can be + * verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to + * the compute nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the + * compute nodes to unusable. If the specified VNet has any associated Network Security Groups (NSG), then a few + * reserved system ports must be enabled for inbound communication. For pools created with a virtual machine + * configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For pools + * created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound + * connections to Azure Storage on port 443. For cloudServiceConfiguration pools, only 'classic' VNETs are + * supported. For more details see: + * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration. + * + * @param subnetId the subnetId value to set. + * @return the NetworkConfiguration object itself. + */ + public NetworkConfiguration withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the endpointConfiguration property: Pool endpoint configuration is only supported on pools with the + * virtualMachineConfiguration property. + * + * @return the endpointConfiguration value. + */ + public PoolEndpointConfiguration endpointConfiguration() { + return this.endpointConfiguration; + } + + /** + * Set the endpointConfiguration property: Pool endpoint configuration is only supported on pools with the + * virtualMachineConfiguration property. + * + * @param endpointConfiguration the endpointConfiguration value to set. + * @return the NetworkConfiguration object itself. + */ + public NetworkConfiguration withEndpointConfiguration(PoolEndpointConfiguration endpointConfiguration) { + this.endpointConfiguration = endpointConfiguration; + return this; + } + + /** + * Get the publicIpAddressConfiguration property: This property is only supported on Pools with the + * virtualMachineConfiguration property. + * + * @return the publicIpAddressConfiguration value. + */ + public PublicIpAddressConfiguration publicIpAddressConfiguration() { + return this.publicIpAddressConfiguration; + } + + /** + * Set the publicIpAddressConfiguration property: This property is only supported on Pools with the + * virtualMachineConfiguration property. + * + * @param publicIpAddressConfiguration the publicIpAddressConfiguration value to set. + * @return the NetworkConfiguration object itself. + */ + public NetworkConfiguration withPublicIpAddressConfiguration( + PublicIpAddressConfiguration publicIpAddressConfiguration) { + this.publicIpAddressConfiguration = publicIpAddressConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (endpointConfiguration() != null) { + endpointConfiguration().validate(); + } + if (publicIpAddressConfiguration() != null) { + publicIpAddressConfiguration().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkSecurityGroupRule.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkSecurityGroupRule.java new file mode 100644 index 0000000000000..e01fdc3862da1 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkSecurityGroupRule.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 network security group rule to apply to an inbound endpoint. */ +@Fluent +public final class NetworkSecurityGroupRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkSecurityGroupRule.class); + + /* + * Priorities within a pool must be unique and are evaluated in order of + * priority. The lower the number the higher the priority. For example, + * rules could be specified with order numbers of 150, 250, and 350. The + * rule with the order number of 150 takes precedence over the rule that + * has an order of 250. Allowed priorities are 150 to 4096. If any reserved + * or duplicate values are provided the request fails with HTTP status code + * 400. + */ + @JsonProperty(value = "priority", required = true) + private int priority; + + /* + * The action that should be taken for a specified IP address, subnet range + * or tag. + */ + @JsonProperty(value = "access", required = true) + private NetworkSecurityGroupRuleAccess access; + + /* + * Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. + * 192.168.1.0/24), default tag, or * (for all addresses). If any other + * values are provided the request fails with HTTP status code 400. + */ + @JsonProperty(value = "sourceAddressPrefix", required = true) + private String sourceAddressPrefix; + + /* + * Valid values are '*' (for all ports 0 - 65535) or arrays of ports or + * port ranges (i.e. 100-200). The ports should in the range of 0 to 65535 + * and the port ranges or ports can't overlap. If any other values are + * provided the request fails with HTTP status code 400. Default value will + * be *. + */ + @JsonProperty(value = "sourcePortRanges") + private List sourcePortRanges; + + /** + * Get the priority property: Priorities within a pool must be unique and are evaluated in order of priority. The + * lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, + * and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed + * priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status + * code 400. + * + * @return the priority value. + */ + public int priority() { + return this.priority; + } + + /** + * Set the priority property: Priorities within a pool must be unique and are evaluated in order of priority. The + * lower the number the higher the priority. For example, rules could be specified with order numbers of 150, 250, + * and 350. The rule with the order number of 150 takes precedence over the rule that has an order of 250. Allowed + * priorities are 150 to 4096. If any reserved or duplicate values are provided the request fails with HTTP status + * code 400. + * + * @param priority the priority value to set. + * @return the NetworkSecurityGroupRule object itself. + */ + public NetworkSecurityGroupRule withPriority(int priority) { + this.priority = priority; + return this; + } + + /** + * Get the access property: The action that should be taken for a specified IP address, subnet range or tag. + * + * @return the access value. + */ + public NetworkSecurityGroupRuleAccess access() { + return this.access; + } + + /** + * Set the access property: The action that should be taken for a specified IP address, subnet range or tag. + * + * @param access the access value to set. + * @return the NetworkSecurityGroupRule object itself. + */ + public NetworkSecurityGroupRule withAccess(NetworkSecurityGroupRuleAccess access) { + this.access = access; + return this; + } + + /** + * Get the sourceAddressPrefix property: Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. + * 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with + * HTTP status code 400. + * + * @return the sourceAddressPrefix value. + */ + public String sourceAddressPrefix() { + return this.sourceAddressPrefix; + } + + /** + * Set the sourceAddressPrefix property: Valid values are a single IP address (i.e. 10.10.10.10), IP subnet (i.e. + * 192.168.1.0/24), default tag, or * (for all addresses). If any other values are provided the request fails with + * HTTP status code 400. + * + * @param sourceAddressPrefix the sourceAddressPrefix value to set. + * @return the NetworkSecurityGroupRule object itself. + */ + public NetworkSecurityGroupRule withSourceAddressPrefix(String sourceAddressPrefix) { + this.sourceAddressPrefix = sourceAddressPrefix; + return this; + } + + /** + * Get the sourcePortRanges property: Valid values are '*' (for all ports 0 - 65535) or arrays of ports or port + * ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges or ports can't overlap. If + * any other values are provided the request fails with HTTP status code 400. Default value will be *. + * + * @return the sourcePortRanges value. + */ + public List sourcePortRanges() { + return this.sourcePortRanges; + } + + /** + * Set the sourcePortRanges property: Valid values are '*' (for all ports 0 - 65535) or arrays of ports or port + * ranges (i.e. 100-200). The ports should in the range of 0 to 65535 and the port ranges or ports can't overlap. If + * any other values are provided the request fails with HTTP status code 400. Default value will be *. + * + * @param sourcePortRanges the sourcePortRanges value to set. + * @return the NetworkSecurityGroupRule object itself. + */ + public NetworkSecurityGroupRule withSourcePortRanges(List sourcePortRanges) { + this.sourcePortRanges = sourcePortRanges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (access() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property access in model NetworkSecurityGroupRule")); + } + if (sourceAddressPrefix() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceAddressPrefix in model NetworkSecurityGroupRule")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkSecurityGroupRuleAccess.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkSecurityGroupRuleAccess.java new file mode 100644 index 0000000000000..35177ef78307a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NetworkSecurityGroupRuleAccess.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for NetworkSecurityGroupRuleAccess. */ +public enum NetworkSecurityGroupRuleAccess { + /** Enum value Allow. */ + ALLOW("Allow"), + + /** Enum value Deny. */ + DENY("Deny"); + + /** The actual serialized value for a NetworkSecurityGroupRuleAccess instance. */ + private final String value; + + NetworkSecurityGroupRuleAccess(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NetworkSecurityGroupRuleAccess instance. + * + * @param value the serialized value to parse. + * @return the parsed NetworkSecurityGroupRuleAccess object, or null if unable to parse. + */ + @JsonCreator + public static NetworkSecurityGroupRuleAccess fromString(String value) { + NetworkSecurityGroupRuleAccess[] items = NetworkSecurityGroupRuleAccess.values(); + for (NetworkSecurityGroupRuleAccess item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NfsMountConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NfsMountConfiguration.java new file mode 100644 index 0000000000000..bbe6cbef61035 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NfsMountConfiguration.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Information used to connect to an NFS file system. */ +@Fluent +public final class NfsMountConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NfsMountConfiguration.class); + + /* + * The URI of the file system to mount. + */ + @JsonProperty(value = "source", required = true) + private String source; + + /* + * All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + */ + @JsonProperty(value = "relativeMountPath", required = true) + private String relativeMountPath; + + /* + * These are 'net use' options in Windows and 'mount' options in Linux. + */ + @JsonProperty(value = "mountOptions") + private String mountOptions; + + /** + * Get the source property: The URI of the file system to mount. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: The URI of the file system to mount. + * + * @param source the source value to set. + * @return the NfsMountConfiguration object itself. + */ + public NfsMountConfiguration withSource(String source) { + this.source = source; + return this; + } + + /** + * Get the relativeMountPath property: All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + * + * @return the relativeMountPath value. + */ + public String relativeMountPath() { + return this.relativeMountPath; + } + + /** + * Set the relativeMountPath property: All file systems are mounted relative to the Batch mounts directory, + * accessible via the AZ_BATCH_NODE_MOUNTS_DIR environment variable. + * + * @param relativeMountPath the relativeMountPath value to set. + * @return the NfsMountConfiguration object itself. + */ + public NfsMountConfiguration withRelativeMountPath(String relativeMountPath) { + this.relativeMountPath = relativeMountPath; + return this; + } + + /** + * Get the mountOptions property: These are 'net use' options in Windows and 'mount' options in Linux. + * + * @return the mountOptions value. + */ + public String mountOptions() { + return this.mountOptions; + } + + /** + * Set the mountOptions property: These are 'net use' options in Windows and 'mount' options in Linux. + * + * @param mountOptions the mountOptions value to set. + * @return the NfsMountConfiguration object itself. + */ + public NfsMountConfiguration withMountOptions(String mountOptions) { + this.mountOptions = mountOptions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property source in model NfsMountConfiguration")); + } + if (relativeMountPath() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property relativeMountPath in model NfsMountConfiguration")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NodePlacementConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NodePlacementConfiguration.java new file mode 100644 index 0000000000000..961bb628684af --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NodePlacementConfiguration.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Allocation configuration used by Batch Service to provision the nodes. */ +@Fluent +public final class NodePlacementConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NodePlacementConfiguration.class); + + /* + * Allocation policy used by Batch Service to provision the nodes. If not + * specified, Batch will use the regional policy. + */ + @JsonProperty(value = "policy") + private NodePlacementPolicyType policy; + + /** + * Get the policy property: Allocation policy used by Batch Service to provision the nodes. If not specified, Batch + * will use the regional policy. + * + * @return the policy value. + */ + public NodePlacementPolicyType policy() { + return this.policy; + } + + /** + * Set the policy property: Allocation policy used by Batch Service to provision the nodes. If not specified, Batch + * will use the regional policy. + * + * @param policy the policy value to set. + * @return the NodePlacementConfiguration object itself. + */ + public NodePlacementConfiguration withPolicy(NodePlacementPolicyType policy) { + this.policy = policy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NodePlacementPolicyType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NodePlacementPolicyType.java new file mode 100644 index 0000000000000..0f1ce680002bd --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/NodePlacementPolicyType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for NodePlacementPolicyType. */ +public enum NodePlacementPolicyType { + /** Enum value Regional. */ + REGIONAL("Regional"), + + /** Enum value Zonal. */ + ZONAL("Zonal"); + + /** The actual serialized value for a NodePlacementPolicyType instance. */ + private final String value; + + NodePlacementPolicyType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a NodePlacementPolicyType instance. + * + * @param value the serialized value to parse. + * @return the parsed NodePlacementPolicyType object, or null if unable to parse. + */ + @JsonCreator + public static NodePlacementPolicyType fromString(String value) { + NodePlacementPolicyType[] items = NodePlacementPolicyType.values(); + for (NodePlacementPolicyType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Operation.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Operation.java new file mode 100644 index 0000000000000..b5dfd0d04d362 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Operation.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.batch.models; + +import com.azure.resourcemanager.batch.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: This is of the format {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that describes the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: Any object. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/OperationDisplay.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/OperationDisplay.java new file mode 100644 index 0000000000000..8454787f94bd9 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that describes the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * For example: read, write, delete, or listKeys/action + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * The friendly name of the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Friendly name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Friendly name of the resource provider. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the operation property: For example: read, write, delete, or listKeys/action. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: For example: read, write, delete, or listKeys/action. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the resource property: The resource type on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: The resource type on which the operation is performed. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the description property: The friendly name of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The friendly name of the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/OperationListResult.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/OperationListResult.java new file mode 100644 index 0000000000000..cf21f83b27afd --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/OperationListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.batch.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the + * next set of results. + */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * The list of operations supported by the resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of operations supported by the resource provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Operations.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Operations.java new file mode 100644 index 0000000000000..9c7aa57b38b48 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/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.batch.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + PagedIterable list(); + + /** + * Lists available operations for the Microsoft.Batch provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PackageState.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PackageState.java new file mode 100644 index 0000000000000..706bd45464ae6 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PackageState.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PackageState. */ +public enum PackageState { + /** Enum value Pending. */ + PENDING("Pending"), + + /** Enum value Active. */ + ACTIVE("Active"); + + /** The actual serialized value for a PackageState instance. */ + private final String value; + + PackageState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PackageState instance. + * + * @param value the serialized value to parse. + * @return the parsed PackageState object, or null if unable to parse. + */ + @JsonCreator + public static PackageState fromString(String value) { + PackageState[] items = PackageState.values(); + for (PackageState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pool.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pool.java new file mode 100644 index 0000000000000..4e54913aeceea --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pool.java @@ -0,0 +1,849 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Pool. */ +public interface Pool { + /** + * 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 identity property: The type of identity used for the Batch Pool. + * + * @return the identity value. + */ + BatchPoolIdentity identity(); + + /** + * Gets the displayName property: The display name need not be unique and can contain any Unicode characters up to a + * maximum length of 1024. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the lastModified property: This is the last time at which the pool level data, such as the + * targetDedicatedNodes or autoScaleSettings, changed. It does not factor in node-level changes such as a compute + * node changing state. + * + * @return the lastModified value. + */ + OffsetDateTime lastModified(); + + /** + * Gets the creationTime property: The creation time of the pool. + * + * @return the creationTime value. + */ + OffsetDateTime creationTime(); + + /** + * Gets the provisioningState property: The current state of the pool. + * + * @return the provisioningState value. + */ + PoolProvisioningState provisioningState(); + + /** + * Gets the provisioningStateTransitionTime property: The time at which the pool entered its current state. + * + * @return the provisioningStateTransitionTime value. + */ + OffsetDateTime provisioningStateTransitionTime(); + + /** + * Gets the allocationState property: Whether the pool is resizing. + * + * @return the allocationState value. + */ + AllocationState allocationState(); + + /** + * Gets the allocationStateTransitionTime property: The time at which the pool entered its current allocation state. + * + * @return the allocationStateTransitionTime value. + */ + OffsetDateTime allocationStateTransitionTime(); + + /** + * Gets the vmSize property: For information about available sizes of virtual machines for Cloud Services pools + * (pools created with cloudServiceConfiguration), see Sizes for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all Cloud + * Services VM sizes except ExtraSmall. For information about available VM sizes for pools using images from the + * Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes for Virtual Machines + * (Linux) (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual + * Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch + * supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and + * STANDARD_DSV2 series). + * + * @return the vmSize value. + */ + String vmSize(); + + /** + * Gets the deploymentConfiguration property: Using CloudServiceConfiguration specifies that the nodes should be + * creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual Machines (IaaS). + * + * @return the deploymentConfiguration value. + */ + DeploymentConfiguration deploymentConfiguration(); + + /** + * Gets the currentDedicatedNodes property: The number of compute nodes currently in the pool. + * + * @return the currentDedicatedNodes value. + */ + Integer currentDedicatedNodes(); + + /** + * Gets the currentLowPriorityNodes property: The number of low priority compute nodes currently in the pool. + * + * @return the currentLowPriorityNodes value. + */ + Integer currentLowPriorityNodes(); + + /** + * Gets the scaleSettings property: Defines the desired size of the pool. This can either be 'fixedScale' where the + * requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is periodically + * reevaluated. If this property is not specified, the pool will have a fixed scale with 0 targetDedicatedNodes. + * + * @return the scaleSettings value. + */ + ScaleSettings scaleSettings(); + + /** + * Gets the autoScaleRun property: This property is set only if the pool automatically scales, i.e. + * autoScaleSettings are used. + * + * @return the autoScaleRun value. + */ + AutoScaleRun autoScaleRun(); + + /** + * Gets the interNodeCommunication property: This imposes restrictions on which nodes can be assigned to the pool. + * Enabling this value can reduce the chance of the requested number of nodes to be allocated in the pool. If not + * specified, this value defaults to 'Disabled'. + * + * @return the interNodeCommunication value. + */ + InterNodeCommunicationState interNodeCommunication(); + + /** + * Gets the networkConfiguration property: The network configuration for a pool. + * + * @return the networkConfiguration value. + */ + NetworkConfiguration networkConfiguration(); + + /** + * Gets the taskSlotsPerNode property: The default value is 1. The maximum value is the smaller of 4 times the + * number of cores of the vmSize of the pool or 256. + * + * @return the taskSlotsPerNode value. + */ + Integer taskSlotsPerNode(); + + /** + * Gets the taskSchedulingPolicy property: If not specified, the default is spread. + * + * @return the taskSchedulingPolicy value. + */ + TaskSchedulingPolicy taskSchedulingPolicy(); + + /** + * Gets the userAccounts property: The list of user accounts to be created on each node in the pool. + * + * @return the userAccounts value. + */ + List userAccounts(); + + /** + * Gets the metadata property: The Batch service does not assign any meaning to metadata; it is solely for the use + * of user code. + * + * @return the metadata value. + */ + List metadata(); + + /** + * Gets the startTask property: In an PATCH (update) operation, this property can be set to an empty object to + * remove the start task from the pool. + * + * @return the startTask value. + */ + StartTask startTask(); + + /** + * Gets the certificates property: For Windows compute nodes, the Batch service installs the certificates to the + * specified certificate store and location. For Linux compute nodes, the certificates are stored in a directory + * inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is supplied to the task + * to query for this location. For certificates with visibility of 'remoteUser', a 'certs' directory is created in + * the user's home directory (e.g., /home/{user-name}/certs) and certificates are placed in that directory. + * + * @return the certificates value. + */ + List certificates(); + + /** + * Gets the applicationPackages property: Changes to application package references affect all new compute nodes + * joining the pool, but do not affect compute nodes that are already in the pool until they are rebooted or + * reimaged. There is a maximum of 10 application package references on any given pool. + * + * @return the applicationPackages value. + */ + List applicationPackages(); + + /** + * Gets the applicationLicenses property: The list of application licenses must be a subset of available Batch + * service application licenses. If a license is requested which is not supported, pool creation will fail. + * + * @return the applicationLicenses value. + */ + List applicationLicenses(); + + /** + * Gets the resizeOperationStatus property: Describes either the current operation (if the pool AllocationState is + * Resizing) or the previously completed operation (if the AllocationState is Steady). + * + * @return the resizeOperationStatus value. + */ + ResizeOperationStatus resizeOperationStatus(); + + /** + * Gets the mountConfiguration property: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + * + * @return the mountConfiguration value. + */ + List mountConfiguration(); + + /** + * Gets the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.PoolInner object. + * + * @return the inner object. + */ + PoolInner innerModel(); + + /** The entirety of the Pool definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Pool definition stages. */ + interface DefinitionStages { + /** The first stage of the Pool definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Pool definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @return the next definition stage. + */ + WithCreate withExistingBatchAccount(String resourceGroupName, String accountName); + } + /** + * The stage of the Pool 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.WithIdentity, + DefinitionStages.WithDisplayName, + DefinitionStages.WithVmSize, + DefinitionStages.WithDeploymentConfiguration, + DefinitionStages.WithScaleSettings, + DefinitionStages.WithInterNodeCommunication, + DefinitionStages.WithNetworkConfiguration, + DefinitionStages.WithTaskSlotsPerNode, + DefinitionStages.WithTaskSchedulingPolicy, + DefinitionStages.WithUserAccounts, + DefinitionStages.WithMetadata, + DefinitionStages.WithStartTask, + DefinitionStages.WithCertificates, + DefinitionStages.WithApplicationPackages, + DefinitionStages.WithApplicationLicenses, + DefinitionStages.WithMountConfiguration, + DefinitionStages.WithIfMatch, + DefinitionStages.WithIfNoneMatch { + /** + * Executes the create request. + * + * @return the created resource. + */ + Pool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Pool create(Context context); + } + /** The stage of the Pool definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The type of identity used for the Batch Pool.. + * + * @param identity The type of identity used for the Batch Pool. + * @return the next definition stage. + */ + WithCreate withIdentity(BatchPoolIdentity identity); + } + /** The stage of the Pool definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024.. + * + * @param displayName The display name need not be unique and can contain any Unicode characters up to a + * maximum length of 1024. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the Pool definition allowing to specify vmSize. */ + interface WithVmSize { + /** + * Specifies the vmSize property: For information about available sizes of virtual machines for Cloud + * Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all + * Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using + * images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes + * for Virtual Machines (Linux) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual + * Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). + * Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, + * STANDARD_DS, and STANDARD_DSV2 series).. + * + * @param vmSize For information about available sizes of virtual machines for Cloud Services pools (pools + * created with cloudServiceConfiguration), see Sizes for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all + * Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using + * images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see + * Sizes for Virtual Machines (Linux) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for + * Virtual Machines (Windows) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports + * all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and + * STANDARD_DSV2 series). + * @return the next definition stage. + */ + WithCreate withVmSize(String vmSize); + } + /** The stage of the Pool definition allowing to specify deploymentConfiguration. */ + interface WithDeploymentConfiguration { + /** + * Specifies the deploymentConfiguration property: Using CloudServiceConfiguration specifies that the nodes + * should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure + * Virtual Machines (IaaS).. + * + * @param deploymentConfiguration Using CloudServiceConfiguration specifies that the nodes should be + * creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual + * Machines (IaaS). + * @return the next definition stage. + */ + WithCreate withDeploymentConfiguration(DeploymentConfiguration deploymentConfiguration); + } + /** The stage of the Pool definition allowing to specify scaleSettings. */ + interface WithScaleSettings { + /** + * Specifies the scaleSettings property: Defines the desired size of the pool. This can either be + * 'fixedScale' where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a + * formula which is periodically reevaluated. If this property is not specified, the pool will have a fixed + * scale with 0 targetDedicatedNodes.. + * + * @param scaleSettings Defines the desired size of the pool. This can either be 'fixedScale' where the + * requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is + * periodically reevaluated. If this property is not specified, the pool will have a fixed scale with 0 + * targetDedicatedNodes. + * @return the next definition stage. + */ + WithCreate withScaleSettings(ScaleSettings scaleSettings); + } + /** The stage of the Pool definition allowing to specify interNodeCommunication. */ + interface WithInterNodeCommunication { + /** + * Specifies the interNodeCommunication property: This imposes restrictions on which nodes can be assigned + * to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated + * in the pool. If not specified, this value defaults to 'Disabled'.. + * + * @param interNodeCommunication This imposes restrictions on which nodes can be assigned to the pool. + * Enabling this value can reduce the chance of the requested number of nodes to be allocated in the + * pool. If not specified, this value defaults to 'Disabled'. + * @return the next definition stage. + */ + WithCreate withInterNodeCommunication(InterNodeCommunicationState interNodeCommunication); + } + /** The stage of the Pool definition allowing to specify networkConfiguration. */ + interface WithNetworkConfiguration { + /** + * Specifies the networkConfiguration property: The network configuration for a pool.. + * + * @param networkConfiguration The network configuration for a pool. + * @return the next definition stage. + */ + WithCreate withNetworkConfiguration(NetworkConfiguration networkConfiguration); + } + /** The stage of the Pool definition allowing to specify taskSlotsPerNode. */ + interface WithTaskSlotsPerNode { + /** + * Specifies the taskSlotsPerNode property: The default value is 1. The maximum value is the smaller of 4 + * times the number of cores of the vmSize of the pool or 256.. + * + * @param taskSlotsPerNode The default value is 1. The maximum value is the smaller of 4 times the number of + * cores of the vmSize of the pool or 256. + * @return the next definition stage. + */ + WithCreate withTaskSlotsPerNode(Integer taskSlotsPerNode); + } + /** The stage of the Pool definition allowing to specify taskSchedulingPolicy. */ + interface WithTaskSchedulingPolicy { + /** + * Specifies the taskSchedulingPolicy property: If not specified, the default is spread.. + * + * @param taskSchedulingPolicy If not specified, the default is spread. + * @return the next definition stage. + */ + WithCreate withTaskSchedulingPolicy(TaskSchedulingPolicy taskSchedulingPolicy); + } + /** The stage of the Pool definition allowing to specify userAccounts. */ + interface WithUserAccounts { + /** + * Specifies the userAccounts property: The list of user accounts to be created on each node in the pool.. + * + * @param userAccounts The list of user accounts to be created on each node in the pool. + * @return the next definition stage. + */ + WithCreate withUserAccounts(List userAccounts); + } + /** The stage of the Pool definition allowing to specify metadata. */ + interface WithMetadata { + /** + * Specifies the metadata property: The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code.. + * + * @param metadata The Batch service does not assign any meaning to metadata; it is solely for the use of + * user code. + * @return the next definition stage. + */ + WithCreate withMetadata(List metadata); + } + /** The stage of the Pool definition allowing to specify startTask. */ + interface WithStartTask { + /** + * Specifies the startTask property: In an PATCH (update) operation, this property can be set to an empty + * object to remove the start task from the pool.. + * + * @param startTask In an PATCH (update) operation, this property can be set to an empty object to remove + * the start task from the pool. + * @return the next definition stage. + */ + WithCreate withStartTask(StartTask startTask); + } + /** The stage of the Pool definition allowing to specify certificates. */ + interface WithCertificates { + /** + * Specifies the certificates property: For Windows compute nodes, the Batch service installs the + * certificates to the specified certificate store and location. For Linux compute nodes, the certificates + * are stored in a directory inside the task working directory and an environment variable + * AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with + * visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., + * /home/{user-name}/certs) and certificates are placed in that directory.. + * + * @param certificates For Windows compute nodes, the Batch service installs the certificates to the + * specified certificate store and location. For Linux compute nodes, the certificates are stored in a + * directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is + * supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a + * 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and + * certificates are placed in that directory. + * @return the next definition stage. + */ + WithCreate withCertificates(List certificates); + } + /** The stage of the Pool definition allowing to specify applicationPackages. */ + interface WithApplicationPackages { + /** + * Specifies the applicationPackages property: Changes to application package references affect all new + * compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they + * are rebooted or reimaged. There is a maximum of 10 application package references on any given pool.. + * + * @param applicationPackages Changes to application package references affect all new compute nodes joining + * the pool, but do not affect compute nodes that are already in the pool until they are rebooted or + * reimaged. There is a maximum of 10 application package references on any given pool. + * @return the next definition stage. + */ + WithCreate withApplicationPackages(List applicationPackages); + } + /** The stage of the Pool definition allowing to specify applicationLicenses. */ + interface WithApplicationLicenses { + /** + * Specifies the applicationLicenses property: The list of application licenses must be a subset of + * available Batch service application licenses. If a license is requested which is not supported, pool + * creation will fail.. + * + * @param applicationLicenses The list of application licenses must be a subset of available Batch service + * application licenses. If a license is requested which is not supported, pool creation will fail. + * @return the next definition stage. + */ + WithCreate withApplicationLicenses(List applicationLicenses); + } + /** The stage of the Pool definition allowing to specify mountConfiguration. */ + interface WithMountConfiguration { + /** + * Specifies the mountConfiguration property: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse.. + * + * @param mountConfiguration This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + * @return the next definition stage. + */ + WithCreate withMountConfiguration(List mountConfiguration); + } + /** The stage of the Pool definition allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: The entity state (ETag) version of the pool to update. A value of "*" can + * be used to apply the operation only if the pool already exists. If omitted, this operation will always be + * applied.. + * + * @param ifMatch The entity state (ETag) version of the pool to update. A value of "*" can be used to apply + * the operation only if the pool already exists. If omitted, this operation will always be applied. + * @return the next definition stage. + */ + WithCreate withIfMatch(String ifMatch); + } + /** The stage of the Pool definition allowing to specify ifNoneMatch. */ + interface WithIfNoneMatch { + /** + * Specifies the ifNoneMatch property: Set to '*' to allow a new pool to be created, but to prevent updating + * an existing pool. Other values will be ignored.. + * + * @param ifNoneMatch Set to '*' to allow a new pool to be created, but to prevent updating an existing + * pool. Other values will be ignored. + * @return the next definition stage. + */ + WithCreate withIfNoneMatch(String ifNoneMatch); + } + } + /** + * Begins update for the Pool resource. + * + * @return the stage of resource update. + */ + Pool.Update update(); + + /** The template for Pool update. */ + interface Update + extends UpdateStages.WithIdentity, + UpdateStages.WithDisplayName, + UpdateStages.WithVmSize, + UpdateStages.WithDeploymentConfiguration, + UpdateStages.WithScaleSettings, + UpdateStages.WithInterNodeCommunication, + UpdateStages.WithNetworkConfiguration, + UpdateStages.WithTaskSlotsPerNode, + UpdateStages.WithTaskSchedulingPolicy, + UpdateStages.WithUserAccounts, + UpdateStages.WithMetadata, + UpdateStages.WithStartTask, + UpdateStages.WithCertificates, + UpdateStages.WithApplicationPackages, + UpdateStages.WithApplicationLicenses, + UpdateStages.WithMountConfiguration, + UpdateStages.WithIfMatch { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Pool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Pool apply(Context context); + } + /** The Pool update stages. */ + interface UpdateStages { + /** The stage of the Pool update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The type of identity used for the Batch Pool.. + * + * @param identity The type of identity used for the Batch Pool. + * @return the next definition stage. + */ + Update withIdentity(BatchPoolIdentity identity); + } + /** The stage of the Pool update allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name need not be unique and can contain any Unicode + * characters up to a maximum length of 1024.. + * + * @param displayName The display name need not be unique and can contain any Unicode characters up to a + * maximum length of 1024. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + /** The stage of the Pool update allowing to specify vmSize. */ + interface WithVmSize { + /** + * Specifies the vmSize property: For information about available sizes of virtual machines for Cloud + * Services pools (pools created with cloudServiceConfiguration), see Sizes for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all + * Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using + * images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see Sizes + * for Virtual Machines (Linux) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for Virtual + * Machines (Windows) (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). + * Batch supports all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, + * STANDARD_DS, and STANDARD_DSV2 series).. + * + * @param vmSize For information about available sizes of virtual machines for Cloud Services pools (pools + * created with cloudServiceConfiguration), see Sizes for Cloud Services + * (https://azure.microsoft.com/documentation/articles/cloud-services-sizes-specs/). Batch supports all + * Cloud Services VM sizes except ExtraSmall. For information about available VM sizes for pools using + * images from the Virtual Machines Marketplace (pools created with virtualMachineConfiguration) see + * Sizes for Virtual Machines (Linux) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-linux-sizes/) or Sizes for + * Virtual Machines (Windows) + * (https://azure.microsoft.com/documentation/articles/virtual-machines-windows-sizes/). Batch supports + * all Azure VM sizes except STANDARD_A0 and those with premium storage (STANDARD_GS, STANDARD_DS, and + * STANDARD_DSV2 series). + * @return the next definition stage. + */ + Update withVmSize(String vmSize); + } + /** The stage of the Pool update allowing to specify deploymentConfiguration. */ + interface WithDeploymentConfiguration { + /** + * Specifies the deploymentConfiguration property: Using CloudServiceConfiguration specifies that the nodes + * should be creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure + * Virtual Machines (IaaS).. + * + * @param deploymentConfiguration Using CloudServiceConfiguration specifies that the nodes should be + * creating using Azure Cloud Services (PaaS), while VirtualMachineConfiguration uses Azure Virtual + * Machines (IaaS). + * @return the next definition stage. + */ + Update withDeploymentConfiguration(DeploymentConfiguration deploymentConfiguration); + } + /** The stage of the Pool update allowing to specify scaleSettings. */ + interface WithScaleSettings { + /** + * Specifies the scaleSettings property: Defines the desired size of the pool. This can either be + * 'fixedScale' where the requested targetDedicatedNodes is specified, or 'autoScale' which defines a + * formula which is periodically reevaluated. If this property is not specified, the pool will have a fixed + * scale with 0 targetDedicatedNodes.. + * + * @param scaleSettings Defines the desired size of the pool. This can either be 'fixedScale' where the + * requested targetDedicatedNodes is specified, or 'autoScale' which defines a formula which is + * periodically reevaluated. If this property is not specified, the pool will have a fixed scale with 0 + * targetDedicatedNodes. + * @return the next definition stage. + */ + Update withScaleSettings(ScaleSettings scaleSettings); + } + /** The stage of the Pool update allowing to specify interNodeCommunication. */ + interface WithInterNodeCommunication { + /** + * Specifies the interNodeCommunication property: This imposes restrictions on which nodes can be assigned + * to the pool. Enabling this value can reduce the chance of the requested number of nodes to be allocated + * in the pool. If not specified, this value defaults to 'Disabled'.. + * + * @param interNodeCommunication This imposes restrictions on which nodes can be assigned to the pool. + * Enabling this value can reduce the chance of the requested number of nodes to be allocated in the + * pool. If not specified, this value defaults to 'Disabled'. + * @return the next definition stage. + */ + Update withInterNodeCommunication(InterNodeCommunicationState interNodeCommunication); + } + /** The stage of the Pool update allowing to specify networkConfiguration. */ + interface WithNetworkConfiguration { + /** + * Specifies the networkConfiguration property: The network configuration for a pool.. + * + * @param networkConfiguration The network configuration for a pool. + * @return the next definition stage. + */ + Update withNetworkConfiguration(NetworkConfiguration networkConfiguration); + } + /** The stage of the Pool update allowing to specify taskSlotsPerNode. */ + interface WithTaskSlotsPerNode { + /** + * Specifies the taskSlotsPerNode property: The default value is 1. The maximum value is the smaller of 4 + * times the number of cores of the vmSize of the pool or 256.. + * + * @param taskSlotsPerNode The default value is 1. The maximum value is the smaller of 4 times the number of + * cores of the vmSize of the pool or 256. + * @return the next definition stage. + */ + Update withTaskSlotsPerNode(Integer taskSlotsPerNode); + } + /** The stage of the Pool update allowing to specify taskSchedulingPolicy. */ + interface WithTaskSchedulingPolicy { + /** + * Specifies the taskSchedulingPolicy property: If not specified, the default is spread.. + * + * @param taskSchedulingPolicy If not specified, the default is spread. + * @return the next definition stage. + */ + Update withTaskSchedulingPolicy(TaskSchedulingPolicy taskSchedulingPolicy); + } + /** The stage of the Pool update allowing to specify userAccounts. */ + interface WithUserAccounts { + /** + * Specifies the userAccounts property: The list of user accounts to be created on each node in the pool.. + * + * @param userAccounts The list of user accounts to be created on each node in the pool. + * @return the next definition stage. + */ + Update withUserAccounts(List userAccounts); + } + /** The stage of the Pool update allowing to specify metadata. */ + interface WithMetadata { + /** + * Specifies the metadata property: The Batch service does not assign any meaning to metadata; it is solely + * for the use of user code.. + * + * @param metadata The Batch service does not assign any meaning to metadata; it is solely for the use of + * user code. + * @return the next definition stage. + */ + Update withMetadata(List metadata); + } + /** The stage of the Pool update allowing to specify startTask. */ + interface WithStartTask { + /** + * Specifies the startTask property: In an PATCH (update) operation, this property can be set to an empty + * object to remove the start task from the pool.. + * + * @param startTask In an PATCH (update) operation, this property can be set to an empty object to remove + * the start task from the pool. + * @return the next definition stage. + */ + Update withStartTask(StartTask startTask); + } + /** The stage of the Pool update allowing to specify certificates. */ + interface WithCertificates { + /** + * Specifies the certificates property: For Windows compute nodes, the Batch service installs the + * certificates to the specified certificate store and location. For Linux compute nodes, the certificates + * are stored in a directory inside the task working directory and an environment variable + * AZ_BATCH_CERTIFICATES_DIR is supplied to the task to query for this location. For certificates with + * visibility of 'remoteUser', a 'certs' directory is created in the user's home directory (e.g., + * /home/{user-name}/certs) and certificates are placed in that directory.. + * + * @param certificates For Windows compute nodes, the Batch service installs the certificates to the + * specified certificate store and location. For Linux compute nodes, the certificates are stored in a + * directory inside the task working directory and an environment variable AZ_BATCH_CERTIFICATES_DIR is + * supplied to the task to query for this location. For certificates with visibility of 'remoteUser', a + * 'certs' directory is created in the user's home directory (e.g., /home/{user-name}/certs) and + * certificates are placed in that directory. + * @return the next definition stage. + */ + Update withCertificates(List certificates); + } + /** The stage of the Pool update allowing to specify applicationPackages. */ + interface WithApplicationPackages { + /** + * Specifies the applicationPackages property: Changes to application package references affect all new + * compute nodes joining the pool, but do not affect compute nodes that are already in the pool until they + * are rebooted or reimaged. There is a maximum of 10 application package references on any given pool.. + * + * @param applicationPackages Changes to application package references affect all new compute nodes joining + * the pool, but do not affect compute nodes that are already in the pool until they are rebooted or + * reimaged. There is a maximum of 10 application package references on any given pool. + * @return the next definition stage. + */ + Update withApplicationPackages(List applicationPackages); + } + /** The stage of the Pool update allowing to specify applicationLicenses. */ + interface WithApplicationLicenses { + /** + * Specifies the applicationLicenses property: The list of application licenses must be a subset of + * available Batch service application licenses. If a license is requested which is not supported, pool + * creation will fail.. + * + * @param applicationLicenses The list of application licenses must be a subset of available Batch service + * application licenses. If a license is requested which is not supported, pool creation will fail. + * @return the next definition stage. + */ + Update withApplicationLicenses(List applicationLicenses); + } + /** The stage of the Pool update allowing to specify mountConfiguration. */ + interface WithMountConfiguration { + /** + * Specifies the mountConfiguration property: This supports Azure Files, NFS, CIFS/SMB, and Blobfuse.. + * + * @param mountConfiguration This supports Azure Files, NFS, CIFS/SMB, and Blobfuse. + * @return the next definition stage. + */ + Update withMountConfiguration(List mountConfiguration); + } + /** The stage of the Pool update allowing to specify ifMatch. */ + interface WithIfMatch { + /** + * Specifies the ifMatch property: The entity state (ETag) version of the pool to update. This value can be + * omitted or set to "*" to apply the operation unconditionally.. + * + * @param ifMatch The entity state (ETag) version of the pool to update. This value can be omitted or set to + * "*" to apply the operation unconditionally. + * @return the next definition stage. + */ + Update withIfMatch(String ifMatch); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Pool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Pool refresh(Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolAllocationMode.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolAllocationMode.java new file mode 100644 index 0000000000000..dba5139d61997 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolAllocationMode.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PoolAllocationMode. */ +public enum PoolAllocationMode { + /** Enum value BatchService. */ + BATCH_SERVICE("BatchService"), + + /** Enum value UserSubscription. */ + USER_SUBSCRIPTION("UserSubscription"); + + /** The actual serialized value for a PoolAllocationMode instance. */ + private final String value; + + PoolAllocationMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PoolAllocationMode instance. + * + * @param value the serialized value to parse. + * @return the parsed PoolAllocationMode object, or null if unable to parse. + */ + @JsonCreator + public static PoolAllocationMode fromString(String value) { + PoolAllocationMode[] items = PoolAllocationMode.values(); + for (PoolAllocationMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolEndpointConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolEndpointConfiguration.java new file mode 100644 index 0000000000000..858637fb241d3 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolEndpointConfiguration.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The endpoint configuration for a pool. */ +@Fluent +public final class PoolEndpointConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolEndpointConfiguration.class); + + /* + * The maximum number of inbound NAT pools per Batch pool is 5. If the + * maximum number of inbound NAT pools is exceeded the request fails with + * HTTP status code 400. This cannot be specified if the + * IPAddressProvisioningType is NoPublicIPAddresses. + */ + @JsonProperty(value = "inboundNatPools", required = true) + private List inboundNatPools; + + /** + * Get the inboundNatPools property: The maximum number of inbound NAT pools per Batch pool is 5. If the maximum + * number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if + * the IPAddressProvisioningType is NoPublicIPAddresses. + * + * @return the inboundNatPools value. + */ + public List inboundNatPools() { + return this.inboundNatPools; + } + + /** + * Set the inboundNatPools property: The maximum number of inbound NAT pools per Batch pool is 5. If the maximum + * number of inbound NAT pools is exceeded the request fails with HTTP status code 400. This cannot be specified if + * the IPAddressProvisioningType is NoPublicIPAddresses. + * + * @param inboundNatPools the inboundNatPools value to set. + * @return the PoolEndpointConfiguration object itself. + */ + public PoolEndpointConfiguration withInboundNatPools(List inboundNatPools) { + this.inboundNatPools = inboundNatPools; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (inboundNatPools() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property inboundNatPools in model PoolEndpointConfiguration")); + } else { + inboundNatPools().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolIdentityType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolIdentityType.java new file mode 100644 index 0000000000000..ff4103b59b194 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolIdentityType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PoolIdentityType. */ +public enum PoolIdentityType { + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a PoolIdentityType instance. */ + private final String value; + + PoolIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PoolIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed PoolIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static PoolIdentityType fromString(String value) { + PoolIdentityType[] items = PoolIdentityType.values(); + for (PoolIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolProvisioningState.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolProvisioningState.java new file mode 100644 index 0000000000000..505e9c8009b85 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolProvisioningState.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PoolProvisioningState. */ +public enum PoolProvisioningState { + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Deleting. */ + DELETING("Deleting"); + + /** The actual serialized value for a PoolProvisioningState instance. */ + private final String value; + + PoolProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PoolProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed PoolProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static PoolProvisioningState fromString(String value) { + PoolProvisioningState[] items = PoolProvisioningState.values(); + for (PoolProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pools.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pools.java new file mode 100644 index 0000000000000..5ea274237bdfb --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/Pools.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 Pools. */ +public interface Pools { + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + PagedIterable listByBatchAccount(String resourceGroupName, String accountName); + + /** + * Lists all of the pools in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @param select Comma separated list of properties that should be returned. e.g. "properties/provisioningState". + * Only top level properties under properties/ are valid for selection. + * @param filter OData filter expression. Valid properties for filtering are: + *

name properties/allocationState properties/allocationStateTransitionTime properties/creationTime + * properties/provisioningState properties/provisioningStateTransitionTime properties/lastModified + * properties/vmSize properties/interNodeCommunication properties/scaleSettings/autoScale + * properties/scaleSettings/fixedScale. + * @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 values returned by the List operation. + */ + PagedIterable listByBatchAccount( + String resourceGroupName, + String accountName, + Integer maxresults, + String select, + String filter, + Context context); + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 poolName); + + /** + * Deletes the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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. + */ + void delete(String resourceGroupName, String accountName, String poolName, Context context); + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + Pool get(String resourceGroupName, String accountName, String poolName); + + /** + * Gets information about the specified pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 information about the specified pool. + */ + Response getWithResponse(String resourceGroupName, String accountName, String poolName, Context context); + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + Pool disableAutoScale(String resourceGroupName, String accountName, String poolName); + + /** + * Disables automatic scaling for a pool. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + Response disableAutoScaleWithResponse( + String resourceGroupName, String accountName, String poolName, Context context); + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + Pool stopResize(String resourceGroupName, String accountName, String poolName); + + /** + * This does not restore the pool to its previous state before the resize operation: it only stops any further + * changes being made, and the pool maintains its current state. After stopping, the pool stabilizes at the number + * of nodes it was at when the stop operation was done. During the stop operation, the pool allocation state changes + * first to stopping and then to steady. A resize operation need not be an explicit resize pool request; this API + * can also be used to halt the initial sizing of the pool when it is created. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param poolName The pool name. This must be unique within the 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 contains information about a pool. + */ + Response stopResizeWithResponse( + String resourceGroupName, String accountName, String poolName, Context context); + + /** + * Gets information about the specified pool. + * + * @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 information about the specified pool. + */ + Pool getById(String id); + + /** + * Gets information about the specified pool. + * + * @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 information about the specified pool. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified pool. + * + * @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 pool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Pool resource. + * + * @param name resource name. + * @return the first stage of the new Pool definition. + */ + Pool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsCreateHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsCreateHeaders.java new file mode 100644 index 0000000000000..e3b65f4c54291 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsCreateHeaders.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.batch.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 PoolsCreateHeaders model. */ +@Fluent +public final class PoolsCreateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolsCreateHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the PoolsCreateHeaders object itself. + */ + public PoolsCreateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsCreateResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsCreateResponse.java new file mode 100644 index 0000000000000..4137d4355c34e --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsCreateResponse.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; + +/** Contains all response data for the create operation. */ +public final class PoolsCreateResponse extends ResponseBase { + /** + * Creates an instance of PoolsCreateResponse. + * + * @param request the request which resulted in this PoolsCreateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PoolsCreateResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, PoolInner value, PoolsCreateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public PoolInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDeleteHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDeleteHeaders.java new file mode 100644 index 0000000000000..18de9e5cd4663 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDeleteHeaders.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.batch.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 PoolsDeleteHeaders model. */ +@Fluent +public final class PoolsDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolsDeleteHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the PoolsDeleteHeaders object itself. + */ + public PoolsDeleteHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the PoolsDeleteHeaders object itself. + */ + public PoolsDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDeleteResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDeleteResponse.java new file mode 100644 index 0000000000000..6b90acdf24c56 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDeleteResponse.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.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class PoolsDeleteResponse extends ResponseBase { + /** + * Creates an instance of PoolsDeleteResponse. + * + * @param request the request which resulted in this PoolsDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PoolsDeleteResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, PoolsDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDisableAutoScaleHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDisableAutoScaleHeaders.java new file mode 100644 index 0000000000000..2d2bc9f37ec6b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDisableAutoScaleHeaders.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.batch.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 PoolsDisableAutoScaleHeaders model. */ +@Fluent +public final class PoolsDisableAutoScaleHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolsDisableAutoScaleHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the PoolsDisableAutoScaleHeaders object itself. + */ + public PoolsDisableAutoScaleHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDisableAutoScaleResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDisableAutoScaleResponse.java new file mode 100644 index 0000000000000..e828f6f2385da --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsDisableAutoScaleResponse.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.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; + +/** Contains all response data for the disableAutoScale operation. */ +public final class PoolsDisableAutoScaleResponse extends ResponseBase { + /** + * Creates an instance of PoolsDisableAutoScaleResponse. + * + * @param request the request which resulted in this PoolsDisableAutoScaleResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PoolsDisableAutoScaleResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + PoolInner value, + PoolsDisableAutoScaleHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public PoolInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsGetHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsGetHeaders.java new file mode 100644 index 0000000000000..7b6e893c3229a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsGetHeaders.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.batch.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 PoolsGetHeaders model. */ +@Fluent +public final class PoolsGetHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolsGetHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the PoolsGetHeaders object itself. + */ + public PoolsGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsGetResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsGetResponse.java new file mode 100644 index 0000000000000..30fda7dd1b2c2 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsGetResponse.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; + +/** Contains all response data for the get operation. */ +public final class PoolsGetResponse extends ResponseBase { + /** + * Creates an instance of PoolsGetResponse. + * + * @param request the request which resulted in this PoolsGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PoolsGetResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, PoolInner value, PoolsGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public PoolInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsStopResizeHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsStopResizeHeaders.java new file mode 100644 index 0000000000000..1a7043fe05a61 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsStopResizeHeaders.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.batch.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 PoolsStopResizeHeaders model. */ +@Fluent +public final class PoolsStopResizeHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolsStopResizeHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the PoolsStopResizeHeaders object itself. + */ + public PoolsStopResizeHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsStopResizeResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsStopResizeResponse.java new file mode 100644 index 0000000000000..3273356b03152 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsStopResizeResponse.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; + +/** Contains all response data for the stopResize operation. */ +public final class PoolsStopResizeResponse extends ResponseBase { + /** + * Creates an instance of PoolsStopResizeResponse. + * + * @param request the request which resulted in this PoolsStopResizeResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PoolsStopResizeResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, PoolInner value, PoolsStopResizeHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public PoolInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsUpdateHeaders.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsUpdateHeaders.java new file mode 100644 index 0000000000000..db2ecae3170f7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsUpdateHeaders.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.batch.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 PoolsUpdateHeaders model. */ +@Fluent +public final class PoolsUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoolsUpdateHeaders.class); + + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the PoolsUpdateHeaders object itself. + */ + public PoolsUpdateHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsUpdateResponse.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsUpdateResponse.java new file mode 100644 index 0000000000000..33769f567010d --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PoolsUpdateResponse.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.batch.fluent.models.PoolInner; + +/** Contains all response data for the update operation. */ +public final class PoolsUpdateResponse extends ResponseBase { + /** + * Creates an instance of PoolsUpdateResponse. + * + * @param request the request which resulted in this PoolsUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PoolsUpdateResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, PoolInner value, PoolsUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public PoolInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpoint.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..f1884bd12f5ba --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpoint.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.batch.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 of the private endpoint connection. */ +@Immutable +public final class PrivateEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpoint.class); + + /* + * The ARM resource identifier of the private endpoint. This is of the form + * /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/privateEndpoints/{privateEndpoint}. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: The ARM resource identifier of the private endpoint. This is of the form + * /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/privateEndpoints/{privateEndpoint}. + * + * @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/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnection.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..12a4d76dad905 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnection.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.resourcemanager.batch.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 provisioningState property: The provisioning state of the private endpoint connection. + * + * @return the provisioningState value. + */ + PrivateEndpointConnectionProvisioningState provisioningState(); + + /** + * Gets the privateEndpoint property: The private endpoint of the private endpoint connection. + * + * @return the privateEndpoint value. + */ + PrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: The private link service connection state of the private + * endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnectionProvisioningState.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 0000000000000..9888532c7b22c --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnectionProvisioningState.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PrivateEndpointConnectionProvisioningState. */ +public enum PrivateEndpointConnectionProvisioningState { + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Updating. */ + UPDATING("Updating"), + + /** Enum value Failed. */ + FAILED("Failed"); + + /** The actual serialized value for a PrivateEndpointConnectionProvisioningState instance. */ + private final String value; + + PrivateEndpointConnectionProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PrivateEndpointConnectionProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed PrivateEndpointConnectionProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static PrivateEndpointConnectionProvisioningState fromString(String value) { + PrivateEndpointConnectionProvisioningState[] items = PrivateEndpointConnectionProvisioningState.values(); + for (PrivateEndpointConnectionProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnections.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..8ad7d9ca21ea7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateEndpointConnections.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.batch.fluent.models.PrivateEndpointConnectionInner; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + PagedIterable listByBatchAccount(String resourceGroupName, String accountName); + + /** + * Lists all of the private endpoint connections in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @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 values returned by the List operation. + */ + PagedIterable listByBatchAccount( + String resourceGroupName, String accountName, Integer maxresults, Context context); + + /** + * Gets information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * Gets information about the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * 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 information about the specified private endpoint connection. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String privateEndpointConnectionName, Context context); + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + PrivateEndpointConnection update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch); + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return contains information about a private link resource. + */ + PrivateEndpointConnection update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Updates the properties of an existing private endpoint connection. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateEndpointConnectionName The private endpoint connection name. This must be unique within the + * account. + * @param parameters PrivateEndpointConnection properties that should be updated. Properties that are supplied will + * be updated, any property not supplied will be unchanged. + * @param ifMatch The state (ETag) version of the private endpoint connection to update. This value can be omitted + * or set to "*" to apply the operation unconditionally. + * @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 contains information about a private link resource. + */ + PrivateEndpointConnection update( + String resourceGroupName, + String accountName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + String ifMatch, + Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkResource.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..4a1fda98182a1 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkResource.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.resourcemanager.batch.fluent.models.PrivateLinkResourceInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * 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 groupId property: The group id is used to establish the private link connection. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the requiredMembers property: The list of required members that are used to establish the private link + * connection. + * + * @return the requiredMembers value. + */ + List requiredMembers(); + + /** + * Gets the requiredZoneNames property: The list of required zone names for the private DNS resource name. + * + * @return the requiredZoneNames value. + */ + List requiredZoneNames(); + + /** + * Gets the etag property: The ETag of the resource, used for concurrency statements. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the inner com.azure.resourcemanager.batch.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkResources.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..6da094b3780aa --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkResources.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch 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 values returned by the List operation. + */ + PagedIterable listByBatchAccount(String resourceGroupName, String accountName); + + /** + * Lists all of the private link resources in the specified account. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param maxresults The maximum number of items to return in the response. + * @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 values returned by the List operation. + */ + PagedIterable listByBatchAccount( + String resourceGroupName, String accountName, Integer maxresults, Context context); + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + PrivateLinkResource get(String resourceGroupName, String accountName, String privateLinkResourceName); + + /** + * Gets information about the specified private link resource. + * + * @param resourceGroupName The name of the resource group that contains the Batch account. + * @param accountName The name of the Batch account. + * @param privateLinkResourceName The private link resource name. This must be unique within the 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 information about the specified private link resource. + */ + Response getWithResponse( + String resourceGroupName, String accountName, String privateLinkResourceName, Context context); +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkServiceConnectionState.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..e78d4f593aad1 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The private link service connection state of the private endpoint connection. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionState.class); + + /* + * The status of the Batch private endpoint connection + */ + @JsonProperty(value = "status", required = true) + private PrivateLinkServiceConnectionStatus status; + + /* + * Description of the private Connection state + */ + @JsonProperty(value = "description") + private String description; + + /* + * Action required on the private connection state + */ + @JsonProperty(value = "actionRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionRequired; + + /** + * Get the status property: The status of the Batch private endpoint connection. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: The status of the Batch private endpoint connection. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateLinkServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: Description of the private Connection state. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the private Connection state. + * + * @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: Action required on the private connection state. + * + * @return the actionRequired value. + */ + public String actionRequired() { + return this.actionRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model PrivateLinkServiceConnectionState")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkServiceConnectionStatus.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkServiceConnectionStatus.java new file mode 100644 index 0000000000000..242185c005c39 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PrivateLinkServiceConnectionStatus.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PrivateLinkServiceConnectionStatus. */ +public enum PrivateLinkServiceConnectionStatus { + /** Enum value Approved. */ + APPROVED("Approved"), + + /** Enum value Pending. */ + PENDING("Pending"), + + /** Enum value Rejected. */ + REJECTED("Rejected"), + + /** Enum value Disconnected. */ + DISCONNECTED("Disconnected"); + + /** The actual serialized value for a PrivateLinkServiceConnectionStatus instance. */ + private final String value; + + PrivateLinkServiceConnectionStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PrivateLinkServiceConnectionStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed PrivateLinkServiceConnectionStatus object, or null if unable to parse. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStatus fromString(String value) { + PrivateLinkServiceConnectionStatus[] items = PrivateLinkServiceConnectionStatus.values(); + for (PrivateLinkServiceConnectionStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ProvisioningState.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ProvisioningState.java new file mode 100644 index 0000000000000..c439c9c778c18 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ProvisioningState.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ProvisioningState. */ +public enum ProvisioningState { + /** Enum value Invalid. */ + INVALID("Invalid"), + + /** Enum value Creating. */ + CREATING("Creating"), + + /** Enum value Deleting. */ + DELETING("Deleting"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Cancelled. */ + CANCELLED("Cancelled"); + + /** The actual serialized value for a ProvisioningState instance. */ + private final String value; + + ProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningState fromString(String value) { + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PublicIpAddressConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PublicIpAddressConfiguration.java new file mode 100644 index 0000000000000..6c93c6015aa51 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PublicIpAddressConfiguration.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The public IP Address configuration of the networking configuration of a Pool. */ +@Fluent +public final class PublicIpAddressConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PublicIpAddressConfiguration.class); + + /* + * The default value is BatchManaged + */ + @JsonProperty(value = "provision") + private IpAddressProvisioningType provision; + + /* + * The number of IPs specified here limits the maximum size of the Pool - + * 100 dedicated nodes or 100 low-priority nodes can be allocated for each + * public IP. For example, a pool needing 250 dedicated VMs would need at + * least 3 public IPs specified. Each element of this collection is of the + * form: + * /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + */ + @JsonProperty(value = "ipAddressIds") + private List ipAddressIds; + + /** + * Get the provision property: The default value is BatchManaged. + * + * @return the provision value. + */ + public IpAddressProvisioningType provision() { + return this.provision; + } + + /** + * Set the provision property: The default value is BatchManaged. + * + * @param provision the provision value to set. + * @return the PublicIpAddressConfiguration object itself. + */ + public PublicIpAddressConfiguration withProvision(IpAddressProvisioningType provision) { + this.provision = provision; + return this; + } + + /** + * Get the ipAddressIds property: The number of IPs specified here limits the maximum size of the Pool - 100 + * dedicated nodes or 100 low-priority nodes can be allocated for each public IP. For example, a pool needing 250 + * dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: + * /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + * + * @return the ipAddressIds value. + */ + public List ipAddressIds() { + return this.ipAddressIds; + } + + /** + * Set the ipAddressIds property: The number of IPs specified here limits the maximum size of the Pool - 100 + * dedicated nodes or 100 low-priority nodes can be allocated for each public IP. For example, a pool needing 250 + * dedicated VMs would need at least 3 public IPs specified. Each element of this collection is of the form: + * /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}. + * + * @param ipAddressIds the ipAddressIds value to set. + * @return the PublicIpAddressConfiguration object itself. + */ + public PublicIpAddressConfiguration withIpAddressIds(List ipAddressIds) { + this.ipAddressIds = ipAddressIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PublicNetworkAccessType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PublicNetworkAccessType.java new file mode 100644 index 0000000000000..23c1f6feb9548 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/PublicNetworkAccessType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for PublicNetworkAccessType. */ +public enum PublicNetworkAccessType { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a PublicNetworkAccessType instance. */ + private final String value; + + PublicNetworkAccessType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PublicNetworkAccessType instance. + * + * @param value the serialized value to parse. + * @return the parsed PublicNetworkAccessType object, or null if unable to parse. + */ + @JsonCreator + public static PublicNetworkAccessType fromString(String value) { + PublicNetworkAccessType[] items = PublicNetworkAccessType.values(); + for (PublicNetworkAccessType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResizeError.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResizeError.java new file mode 100644 index 0000000000000..7da196d01705b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResizeError.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** An error that occurred when resizing a pool. */ +@Fluent +public final class ResizeError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResizeError.class); + + /* + * An identifier for the error. Codes are invariant and are intended to be + * consumed programmatically. + */ + @JsonProperty(value = "code", required = true) + private String code; + + /* + * A message describing the error, intended to be suitable for display in a + * user interface. + */ + @JsonProperty(value = "message", required = true) + private String message; + + /* + * Additional details about the error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get the code property: An identifier for the error. Codes are invariant and are intended to be consumed + * programmatically. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: An identifier for the error. Codes are invariant and are intended to be consumed + * programmatically. + * + * @param code the code value to set. + * @return the ResizeError object itself. + */ + public ResizeError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: A message describing the error, intended to be suitable for display in a user + * interface. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: A message describing the error, intended to be suitable for display in a user + * interface. + * + * @param message the message value to set. + * @return the ResizeError object itself. + */ + public ResizeError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the details property: Additional details about the error. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: Additional details about the error. + * + * @param details the details value to set. + * @return the ResizeError object itself. + */ + public ResizeError withDetails(List details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (code() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property code in model ResizeError")); + } + if (message() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property message in model ResizeError")); + } + if (details() != null) { + details().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResizeOperationStatus.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResizeOperationStatus.java new file mode 100644 index 0000000000000..264ee1d550ef7 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResizeOperationStatus.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Describes either the current operation (if the pool AllocationState is Resizing) or the previously completed + * operation (if the AllocationState is Steady). + */ +@Fluent +public final class ResizeOperationStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResizeOperationStatus.class); + + /* + * The desired number of dedicated compute nodes in the pool. + */ + @JsonProperty(value = "targetDedicatedNodes") + private Integer targetDedicatedNodes; + + /* + * The desired number of low priority compute nodes in the pool. + */ + @JsonProperty(value = "targetLowPriorityNodes") + private Integer targetLowPriorityNodes; + + /* + * The default value is 15 minutes. The minimum value is 5 minutes. If you + * specify a value less than 5 minutes, the Batch service returns an error; + * if you are calling the REST API directly, the HTTP status code is 400 + * (Bad Request). + */ + @JsonProperty(value = "resizeTimeout") + private Duration resizeTimeout; + + /* + * The default value is requeue. + */ + @JsonProperty(value = "nodeDeallocationOption") + private ComputeNodeDeallocationOption nodeDeallocationOption; + + /* + * The time when this resize operation was started. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * This property is set only if an error occurred during the last pool + * resize, and only when the pool allocationState is Steady. + */ + @JsonProperty(value = "errors") + private List errors; + + /** + * Get the targetDedicatedNodes property: The desired number of dedicated compute nodes in the pool. + * + * @return the targetDedicatedNodes value. + */ + public Integer targetDedicatedNodes() { + return this.targetDedicatedNodes; + } + + /** + * Set the targetDedicatedNodes property: The desired number of dedicated compute nodes in the pool. + * + * @param targetDedicatedNodes the targetDedicatedNodes value to set. + * @return the ResizeOperationStatus object itself. + */ + public ResizeOperationStatus withTargetDedicatedNodes(Integer targetDedicatedNodes) { + this.targetDedicatedNodes = targetDedicatedNodes; + return this; + } + + /** + * Get the targetLowPriorityNodes property: The desired number of low priority compute nodes in the pool. + * + * @return the targetLowPriorityNodes value. + */ + public Integer targetLowPriorityNodes() { + return this.targetLowPriorityNodes; + } + + /** + * Set the targetLowPriorityNodes property: The desired number of low priority compute nodes in the pool. + * + * @param targetLowPriorityNodes the targetLowPriorityNodes value to set. + * @return the ResizeOperationStatus object itself. + */ + public ResizeOperationStatus withTargetLowPriorityNodes(Integer targetLowPriorityNodes) { + this.targetLowPriorityNodes = targetLowPriorityNodes; + return this; + } + + /** + * Get the resizeTimeout property: The default value is 15 minutes. The minimum value is 5 minutes. If you specify a + * value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP + * status code is 400 (Bad Request). + * + * @return the resizeTimeout value. + */ + public Duration resizeTimeout() { + return this.resizeTimeout; + } + + /** + * Set the resizeTimeout property: The default value is 15 minutes. The minimum value is 5 minutes. If you specify a + * value less than 5 minutes, the Batch service returns an error; if you are calling the REST API directly, the HTTP + * status code is 400 (Bad Request). + * + * @param resizeTimeout the resizeTimeout value to set. + * @return the ResizeOperationStatus object itself. + */ + public ResizeOperationStatus withResizeTimeout(Duration resizeTimeout) { + this.resizeTimeout = resizeTimeout; + return this; + } + + /** + * Get the nodeDeallocationOption property: The default value is requeue. + * + * @return the nodeDeallocationOption value. + */ + public ComputeNodeDeallocationOption nodeDeallocationOption() { + return this.nodeDeallocationOption; + } + + /** + * Set the nodeDeallocationOption property: The default value is requeue. + * + * @param nodeDeallocationOption the nodeDeallocationOption value to set. + * @return the ResizeOperationStatus object itself. + */ + public ResizeOperationStatus withNodeDeallocationOption(ComputeNodeDeallocationOption nodeDeallocationOption) { + this.nodeDeallocationOption = nodeDeallocationOption; + return this; + } + + /** + * Get the startTime property: The time when this resize operation was started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: The time when this resize operation was started. + * + * @param startTime the startTime value to set. + * @return the ResizeOperationStatus object itself. + */ + public ResizeOperationStatus withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the errors property: This property is set only if an error occurred during the last pool resize, and only + * when the pool allocationState is Steady. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Set the errors property: This property is set only if an error occurred during the last pool resize, and only + * when the pool allocationState is Steady. + * + * @param errors the errors value to set. + * @return the ResizeOperationStatus object itself. + */ + public ResizeOperationStatus withErrors(List errors) { + this.errors = errors; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errors() != null) { + errors().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResourceFile.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResourceFile.java new file mode 100644 index 0000000000000..cb57ec71859de --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResourceFile.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 single file or multiple files to be downloaded to a compute node. */ +@Fluent +public final class ResourceFile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceFile.class); + + /* + * The autoStorageContainerName, storageContainerUrl and httpUrl properties + * are mutually exclusive and one of them must be specified. + */ + @JsonProperty(value = "autoStorageContainerName") + private String autoStorageContainerName; + + /* + * The autoStorageContainerName, storageContainerUrl and httpUrl properties + * are mutually exclusive and one of them must be specified. This URL must + * be readable and listable using anonymous access; that is, the Batch + * service does not present any credentials when downloading the blob. + * There are two ways to get such a URL for a blob in Azure storage: + * include a Shared Access Signature (SAS) granting read and list + * permissions on the blob, or set the ACL for the blob or its container to + * allow public access. + */ + @JsonProperty(value = "storageContainerUrl") + private String storageContainerUrl; + + /* + * The autoStorageContainerName, storageContainerUrl and httpUrl properties + * are mutually exclusive and one of them must be specified. If the URL is + * Azure Blob Storage, it must be readable using anonymous access; that is, + * the Batch service does not present any credentials when downloading the + * blob. There are two ways to get such a URL for a blob in Azure storage: + * include a Shared Access Signature (SAS) granting read permissions on the + * blob, or set the ACL for the blob or its container to allow public + * access. + */ + @JsonProperty(value = "httpUrl") + private String httpUrl; + + /* + * The property is valid only when autoStorageContainerName or + * storageContainerUrl is used. This prefix can be a partial filename or a + * subdirectory. If a prefix is not specified, all the files in the + * container will be downloaded. + */ + @JsonProperty(value = "blobPrefix") + private String blobPrefix; + + /* + * If the httpUrl property is specified, the filePath is required and + * describes the path which the file will be downloaded to, including the + * filename. Otherwise, if the autoStorageContainerName or + * storageContainerUrl property is specified, filePath is optional and is + * the directory to download the files to. In the case where filePath is + * used as a directory, any directory structure already associated with the + * input data will be retained in full and appended to the specified + * filePath directory. The specified relative path cannot break out of the + * task's working directory (for example by using '..'). + */ + @JsonProperty(value = "filePath") + private String filePath; + + /* + * This property applies only to files being downloaded to Linux compute + * nodes. It will be ignored if it is specified for a resourceFile which + * will be downloaded to a Windows node. If this property is not specified + * for a Linux node, then a default value of 0770 is applied to the file. + */ + @JsonProperty(value = "fileMode") + private String fileMode; + + /** + * Get the autoStorageContainerName property: The autoStorageContainerName, storageContainerUrl and httpUrl + * properties are mutually exclusive and one of them must be specified. + * + * @return the autoStorageContainerName value. + */ + public String autoStorageContainerName() { + return this.autoStorageContainerName; + } + + /** + * Set the autoStorageContainerName property: The autoStorageContainerName, storageContainerUrl and httpUrl + * properties are mutually exclusive and one of them must be specified. + * + * @param autoStorageContainerName the autoStorageContainerName value to set. + * @return the ResourceFile object itself. + */ + public ResourceFile withAutoStorageContainerName(String autoStorageContainerName) { + this.autoStorageContainerName = autoStorageContainerName; + return this; + } + + /** + * Get the storageContainerUrl property: The autoStorageContainerName, storageContainerUrl and httpUrl properties + * are mutually exclusive and one of them must be specified. This URL must be readable and listable using anonymous + * access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways + * to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read and list + * permissions on the blob, or set the ACL for the blob or its container to allow public access. + * + * @return the storageContainerUrl value. + */ + public String storageContainerUrl() { + return this.storageContainerUrl; + } + + /** + * Set the storageContainerUrl property: The autoStorageContainerName, storageContainerUrl and httpUrl properties + * are mutually exclusive and one of them must be specified. This URL must be readable and listable using anonymous + * access; that is, the Batch service does not present any credentials when downloading the blob. There are two ways + * to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read and list + * permissions on the blob, or set the ACL for the blob or its container to allow public access. + * + * @param storageContainerUrl the storageContainerUrl value to set. + * @return the ResourceFile object itself. + */ + public ResourceFile withStorageContainerUrl(String storageContainerUrl) { + this.storageContainerUrl = storageContainerUrl; + return this; + } + + /** + * Get the httpUrl property: The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually + * exclusive and one of them must be specified. If the URL is Azure Blob Storage, it must be readable using + * anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There + * are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read + * permissions on the blob, or set the ACL for the blob or its container to allow public access. + * + * @return the httpUrl value. + */ + public String httpUrl() { + return this.httpUrl; + } + + /** + * Set the httpUrl property: The autoStorageContainerName, storageContainerUrl and httpUrl properties are mutually + * exclusive and one of them must be specified. If the URL is Azure Blob Storage, it must be readable using + * anonymous access; that is, the Batch service does not present any credentials when downloading the blob. There + * are two ways to get such a URL for a blob in Azure storage: include a Shared Access Signature (SAS) granting read + * permissions on the blob, or set the ACL for the blob or its container to allow public access. + * + * @param httpUrl the httpUrl value to set. + * @return the ResourceFile object itself. + */ + public ResourceFile withHttpUrl(String httpUrl) { + this.httpUrl = httpUrl; + return this; + } + + /** + * Get the blobPrefix property: The property is valid only when autoStorageContainerName or storageContainerUrl is + * used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the + * container will be downloaded. + * + * @return the blobPrefix value. + */ + public String blobPrefix() { + return this.blobPrefix; + } + + /** + * Set the blobPrefix property: The property is valid only when autoStorageContainerName or storageContainerUrl is + * used. This prefix can be a partial filename or a subdirectory. If a prefix is not specified, all the files in the + * container will be downloaded. + * + * @param blobPrefix the blobPrefix value to set. + * @return the ResourceFile object itself. + */ + public ResourceFile withBlobPrefix(String blobPrefix) { + this.blobPrefix = blobPrefix; + return this; + } + + /** + * Get the filePath property: If the httpUrl property is specified, the filePath is required and describes the path + * which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or + * storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In + * the case where filePath is used as a directory, any directory structure already associated with the input data + * will be retained in full and appended to the specified filePath directory. The specified relative path cannot + * break out of the task's working directory (for example by using '..'). + * + * @return the filePath value. + */ + public String filePath() { + return this.filePath; + } + + /** + * Set the filePath property: If the httpUrl property is specified, the filePath is required and describes the path + * which the file will be downloaded to, including the filename. Otherwise, if the autoStorageContainerName or + * storageContainerUrl property is specified, filePath is optional and is the directory to download the files to. In + * the case where filePath is used as a directory, any directory structure already associated with the input data + * will be retained in full and appended to the specified filePath directory. The specified relative path cannot + * break out of the task's working directory (for example by using '..'). + * + * @param filePath the filePath value to set. + * @return the ResourceFile object itself. + */ + public ResourceFile withFilePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * Get the fileMode property: This property applies only to files being downloaded to Linux compute nodes. It will + * be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is + * not specified for a Linux node, then a default value of 0770 is applied to the file. + * + * @return the fileMode value. + */ + public String fileMode() { + return this.fileMode; + } + + /** + * Set the fileMode property: This property applies only to files being downloaded to Linux compute nodes. It will + * be ignored if it is specified for a resourceFile which will be downloaded to a Windows node. If this property is + * not specified for a Linux node, then a default value of 0770 is applied to the file. + * + * @param fileMode the fileMode value to set. + * @return the ResourceFile object itself. + */ + public ResourceFile withFileMode(String fileMode) { + this.fileMode = fileMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResourceIdentityType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..66f23d3edbd0a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ResourceIdentityType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ScaleSettings.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ScaleSettings.java new file mode 100644 index 0000000000000..76b4a643c6295 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/ScaleSettings.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** + * Defines the desired size of the pool. This can either be 'fixedScale' where the requested targetDedicatedNodes is + * specified, or 'autoScale' which defines a formula which is periodically reevaluated. If this property is not + * specified, the pool will have a fixed scale with 0 targetDedicatedNodes. + */ +@Fluent +public final class ScaleSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScaleSettings.class); + + /* + * This property and autoScale are mutually exclusive and one of the + * properties must be specified. + */ + @JsonProperty(value = "fixedScale") + private FixedScaleSettings fixedScale; + + /* + * This property and fixedScale are mutually exclusive and one of the + * properties must be specified. + */ + @JsonProperty(value = "autoScale") + private AutoScaleSettings autoScale; + + /** + * Get the fixedScale property: This property and autoScale are mutually exclusive and one of the properties must be + * specified. + * + * @return the fixedScale value. + */ + public FixedScaleSettings fixedScale() { + return this.fixedScale; + } + + /** + * Set the fixedScale property: This property and autoScale are mutually exclusive and one of the properties must be + * specified. + * + * @param fixedScale the fixedScale value to set. + * @return the ScaleSettings object itself. + */ + public ScaleSettings withFixedScale(FixedScaleSettings fixedScale) { + this.fixedScale = fixedScale; + return this; + } + + /** + * Get the autoScale property: This property and fixedScale are mutually exclusive and one of the properties must be + * specified. + * + * @return the autoScale value. + */ + public AutoScaleSettings autoScale() { + return this.autoScale; + } + + /** + * Set the autoScale property: This property and fixedScale are mutually exclusive and one of the properties must be + * specified. + * + * @param autoScale the autoScale value to set. + * @return the ScaleSettings object itself. + */ + public ScaleSettings withAutoScale(AutoScaleSettings autoScale) { + this.autoScale = autoScale; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (fixedScale() != null) { + fixedScale().validate(); + } + if (autoScale() != null) { + autoScale().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/StartTask.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/StartTask.java new file mode 100644 index 0000000000000..899c08251d529 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/StartTask.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** + * In some cases the start task may be re-run even though the node was not rebooted. Due to this, start tasks should be + * idempotent and exit gracefully if the setup they're performing has already been done. Special care should be taken to + * avoid start tasks which create breakaway process or install/launch services from the start task working directory, as + * this will block Batch from being able to re-run the start task. + */ +@Fluent +public final class StartTask { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StartTask.class); + + /* + * The command line does not run under a shell, and therefore cannot take + * advantage of shell features such as environment variable expansion. If + * you want to take advantage of such features, you should invoke the shell + * in the command line, for example using "cmd /c MyCommand" in Windows or + * "/bin/sh -c MyCommand" in Linux. Required if any other properties of the + * startTask are specified. + */ + @JsonProperty(value = "commandLine") + private String commandLine; + + /* + * A list of files that the Batch service will download to the compute node + * before running the command line. + */ + @JsonProperty(value = "resourceFiles") + private List resourceFiles; + + /* + * A list of environment variable settings for the start task. + */ + @JsonProperty(value = "environmentSettings") + private List environmentSettings; + + /* + * If omitted, the task runs as a non-administrative user unique to the + * task. + */ + @JsonProperty(value = "userIdentity") + private UserIdentity userIdentity; + + /* + * The Batch service retries a task if its exit code is nonzero. Note that + * this value specifically controls the number of retries. The Batch + * service will try the task once, and may then retry up to this limit. For + * example, if the maximum retry count is 3, Batch tries the task up to 4 + * times (one initial try and 3 retries). If the maximum retry count is 0, + * the Batch service does not retry the task. If the maximum retry count is + * -1, the Batch service retries the task without limit. + */ + @JsonProperty(value = "maxTaskRetryCount") + private Integer maxTaskRetryCount; + + /* + * If true and the start task fails on a compute node, the Batch service + * retries the start task up to its maximum retry count + * (maxTaskRetryCount). If the task has still not completed successfully + * after all retries, then the Batch service marks the compute node + * unusable, and will not schedule tasks to it. This condition can be + * detected via the node state and scheduling error detail. If false, the + * Batch service will not wait for the start task to complete. In this + * case, other tasks can start executing on the compute node while the + * start task is still running; and even if the start task fails, new tasks + * will continue to be scheduled on the node. The default is true. + */ + @JsonProperty(value = "waitForSuccess") + private Boolean waitForSuccess; + + /* + * When this is specified, all directories recursively below the + * AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) + * are mapped into the container, all task environment variables are mapped + * into the container, and the task command line is executed in the + * container. + */ + @JsonProperty(value = "containerSettings") + private TaskContainerSettings containerSettings; + + /** + * Get the commandLine property: The command line does not run under a shell, and therefore cannot take advantage of + * shell features such as environment variable expansion. If you want to take advantage of such features, you should + * invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" + * in Linux. Required if any other properties of the startTask are specified. + * + * @return the commandLine value. + */ + public String commandLine() { + return this.commandLine; + } + + /** + * Set the commandLine property: The command line does not run under a shell, and therefore cannot take advantage of + * shell features such as environment variable expansion. If you want to take advantage of such features, you should + * invoke the shell in the command line, for example using "cmd /c MyCommand" in Windows or "/bin/sh -c MyCommand" + * in Linux. Required if any other properties of the startTask are specified. + * + * @param commandLine the commandLine value to set. + * @return the StartTask object itself. + */ + public StartTask withCommandLine(String commandLine) { + this.commandLine = commandLine; + return this; + } + + /** + * Get the resourceFiles property: A list of files that the Batch service will download to the compute node before + * running the command line. + * + * @return the resourceFiles value. + */ + public List resourceFiles() { + return this.resourceFiles; + } + + /** + * Set the resourceFiles property: A list of files that the Batch service will download to the compute node before + * running the command line. + * + * @param resourceFiles the resourceFiles value to set. + * @return the StartTask object itself. + */ + public StartTask withResourceFiles(List resourceFiles) { + this.resourceFiles = resourceFiles; + return this; + } + + /** + * Get the environmentSettings property: A list of environment variable settings for the start task. + * + * @return the environmentSettings value. + */ + public List environmentSettings() { + return this.environmentSettings; + } + + /** + * Set the environmentSettings property: A list of environment variable settings for the start task. + * + * @param environmentSettings the environmentSettings value to set. + * @return the StartTask object itself. + */ + public StartTask withEnvironmentSettings(List environmentSettings) { + this.environmentSettings = environmentSettings; + return this; + } + + /** + * Get the userIdentity property: If omitted, the task runs as a non-administrative user unique to the task. + * + * @return the userIdentity value. + */ + public UserIdentity userIdentity() { + return this.userIdentity; + } + + /** + * Set the userIdentity property: If omitted, the task runs as a non-administrative user unique to the task. + * + * @param userIdentity the userIdentity value to set. + * @return the StartTask object itself. + */ + public StartTask withUserIdentity(UserIdentity userIdentity) { + this.userIdentity = userIdentity; + return this; + } + + /** + * Get the maxTaskRetryCount property: The Batch service retries a task if its exit code is nonzero. Note that this + * value specifically controls the number of retries. The Batch service will try the task once, and may then retry + * up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial + * try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum + * retry count is -1, the Batch service retries the task without limit. + * + * @return the maxTaskRetryCount value. + */ + public Integer maxTaskRetryCount() { + return this.maxTaskRetryCount; + } + + /** + * Set the maxTaskRetryCount property: The Batch service retries a task if its exit code is nonzero. Note that this + * value specifically controls the number of retries. The Batch service will try the task once, and may then retry + * up to this limit. For example, if the maximum retry count is 3, Batch tries the task up to 4 times (one initial + * try and 3 retries). If the maximum retry count is 0, the Batch service does not retry the task. If the maximum + * retry count is -1, the Batch service retries the task without limit. + * + * @param maxTaskRetryCount the maxTaskRetryCount value to set. + * @return the StartTask object itself. + */ + public StartTask withMaxTaskRetryCount(Integer maxTaskRetryCount) { + this.maxTaskRetryCount = maxTaskRetryCount; + return this; + } + + /** + * Get the waitForSuccess property: If true and the start task fails on a compute node, the Batch service retries + * the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed + * successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule + * tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch + * service will not wait for the start task to complete. In this case, other tasks can start executing on the + * compute node while the start task is still running; and even if the start task fails, new tasks will continue to + * be scheduled on the node. The default is true. + * + * @return the waitForSuccess value. + */ + public Boolean waitForSuccess() { + return this.waitForSuccess; + } + + /** + * Set the waitForSuccess property: If true and the start task fails on a compute node, the Batch service retries + * the start task up to its maximum retry count (maxTaskRetryCount). If the task has still not completed + * successfully after all retries, then the Batch service marks the compute node unusable, and will not schedule + * tasks to it. This condition can be detected via the node state and scheduling error detail. If false, the Batch + * service will not wait for the start task to complete. In this case, other tasks can start executing on the + * compute node while the start task is still running; and even if the start task fails, new tasks will continue to + * be scheduled on the node. The default is true. + * + * @param waitForSuccess the waitForSuccess value to set. + * @return the StartTask object itself. + */ + public StartTask withWaitForSuccess(Boolean waitForSuccess) { + this.waitForSuccess = waitForSuccess; + return this; + } + + /** + * Get the containerSettings property: When this is specified, all directories recursively below the + * AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task + * environment variables are mapped into the container, and the task command line is executed in the container. + * + * @return the containerSettings value. + */ + public TaskContainerSettings containerSettings() { + return this.containerSettings; + } + + /** + * Set the containerSettings property: When this is specified, all directories recursively below the + * AZ_BATCH_NODE_ROOT_DIR (the root of Azure Batch directories on the node) are mapped into the container, all task + * environment variables are mapped into the container, and the task command line is executed in the container. + * + * @param containerSettings the containerSettings value to set. + * @return the StartTask object itself. + */ + public StartTask withContainerSettings(TaskContainerSettings containerSettings) { + this.containerSettings = containerSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceFiles() != null) { + resourceFiles().forEach(e -> e.validate()); + } + if (environmentSettings() != null) { + environmentSettings().forEach(e -> e.validate()); + } + if (userIdentity() != null) { + userIdentity().validate(); + } + if (containerSettings() != null) { + containerSettings().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/StorageAccountType.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/StorageAccountType.java new file mode 100644 index 0000000000000..5494da969a061 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/StorageAccountType.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.batch.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for StorageAccountType. */ +public enum StorageAccountType { + /** Enum value Standard_LRS. */ + STANDARD_LRS("Standard_LRS"), + + /** Enum value Premium_LRS. */ + PREMIUM_LRS("Premium_LRS"); + + /** The actual serialized value for a StorageAccountType instance. */ + private final String value; + + StorageAccountType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StorageAccountType instance. + * + * @param value the serialized value to parse. + * @return the parsed StorageAccountType object, or null if unable to parse. + */ + @JsonCreator + public static StorageAccountType fromString(String value) { + StorageAccountType[] items = StorageAccountType.values(); + for (StorageAccountType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/TaskContainerSettings.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/TaskContainerSettings.java new file mode 100644 index 0000000000000..29e853c0f7712 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/TaskContainerSettings.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.batch.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 container settings for a task. */ +@Fluent +public final class TaskContainerSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TaskContainerSettings.class); + + /* + * These additional options are supplied as arguments to the "docker + * create" command, in addition to those controlled by the Batch Service. + */ + @JsonProperty(value = "containerRunOptions") + private String containerRunOptions; + + /* + * This is the full image reference, as would be specified to "docker + * pull". If no tag is provided as part of the image name, the tag + * ":latest" is used as a default. + */ + @JsonProperty(value = "imageName", required = true) + private String imageName; + + /* + * This setting can be omitted if was already provided at pool creation. + */ + @JsonProperty(value = "registry") + private ContainerRegistry registry; + + /* + * A flag to indicate where the container task working directory is. The + * default is 'taskWorkingDirectory'. + */ + @JsonProperty(value = "workingDirectory") + private ContainerWorkingDirectory workingDirectory; + + /** + * Get the containerRunOptions property: These additional options are supplied as arguments to the "docker create" + * command, in addition to those controlled by the Batch Service. + * + * @return the containerRunOptions value. + */ + public String containerRunOptions() { + return this.containerRunOptions; + } + + /** + * Set the containerRunOptions property: These additional options are supplied as arguments to the "docker create" + * command, in addition to those controlled by the Batch Service. + * + * @param containerRunOptions the containerRunOptions value to set. + * @return the TaskContainerSettings object itself. + */ + public TaskContainerSettings withContainerRunOptions(String containerRunOptions) { + this.containerRunOptions = containerRunOptions; + return this; + } + + /** + * Get the imageName property: This is the full image reference, as would be specified to "docker pull". If no tag + * is provided as part of the image name, the tag ":latest" is used as a default. + * + * @return the imageName value. + */ + public String imageName() { + return this.imageName; + } + + /** + * Set the imageName property: This is the full image reference, as would be specified to "docker pull". If no tag + * is provided as part of the image name, the tag ":latest" is used as a default. + * + * @param imageName the imageName value to set. + * @return the TaskContainerSettings object itself. + */ + public TaskContainerSettings withImageName(String imageName) { + this.imageName = imageName; + return this; + } + + /** + * Get the registry property: This setting can be omitted if was already provided at pool creation. + * + * @return the registry value. + */ + public ContainerRegistry registry() { + return this.registry; + } + + /** + * Set the registry property: This setting can be omitted if was already provided at pool creation. + * + * @param registry the registry value to set. + * @return the TaskContainerSettings object itself. + */ + public TaskContainerSettings withRegistry(ContainerRegistry registry) { + this.registry = registry; + return this; + } + + /** + * Get the workingDirectory property: A flag to indicate where the container task working directory is. The default + * is 'taskWorkingDirectory'. + * + * @return the workingDirectory value. + */ + public ContainerWorkingDirectory workingDirectory() { + return this.workingDirectory; + } + + /** + * Set the workingDirectory property: A flag to indicate where the container task working directory is. The default + * is 'taskWorkingDirectory'. + * + * @param workingDirectory the workingDirectory value to set. + * @return the TaskContainerSettings object itself. + */ + public TaskContainerSettings withWorkingDirectory(ContainerWorkingDirectory workingDirectory) { + this.workingDirectory = workingDirectory; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (imageName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property imageName in model TaskContainerSettings")); + } + if (registry() != null) { + registry().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/TaskSchedulingPolicy.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/TaskSchedulingPolicy.java new file mode 100644 index 0000000000000..70047704342d5 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/TaskSchedulingPolicy.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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; + +/** Specifies how tasks should be distributed across compute nodes. */ +@Fluent +public final class TaskSchedulingPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TaskSchedulingPolicy.class); + + /* + * How tasks should be distributed across compute nodes. + */ + @JsonProperty(value = "nodeFillType", required = true) + private ComputeNodeFillType nodeFillType; + + /** + * Get the nodeFillType property: How tasks should be distributed across compute nodes. + * + * @return the nodeFillType value. + */ + public ComputeNodeFillType nodeFillType() { + return this.nodeFillType; + } + + /** + * Set the nodeFillType property: How tasks should be distributed across compute nodes. + * + * @param nodeFillType the nodeFillType value to set. + * @return the TaskSchedulingPolicy object itself. + */ + public TaskSchedulingPolicy withNodeFillType(ComputeNodeFillType nodeFillType) { + this.nodeFillType = nodeFillType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (nodeFillType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property nodeFillType in model TaskSchedulingPolicy")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/UserAccount.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/UserAccount.java new file mode 100644 index 0000000000000..4e83b8b8cb04c --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/UserAccount.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.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 used to create a user on an Azure Batch node. */ +@Fluent +public final class UserAccount { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserAccount.class); + + /* + * The name of the user account. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The password for the user account. + */ + @JsonProperty(value = "password", required = true) + private String password; + + /* + * nonAdmin - The auto user is a standard user without elevated access. + * admin - The auto user is a user with elevated access and operates with + * full Administrator permissions. The default value is nonAdmin. + */ + @JsonProperty(value = "elevationLevel") + private ElevationLevel elevationLevel; + + /* + * This property is ignored if specified on a Windows pool. If not + * specified, the user is created with the default options. + */ + @JsonProperty(value = "linuxUserConfiguration") + private LinuxUserConfiguration linuxUserConfiguration; + + /* + * This property can only be specified if the user is on a Windows pool. If + * not specified and on a Windows pool, the user is created with the + * default options. + */ + @JsonProperty(value = "windowsUserConfiguration") + private WindowsUserConfiguration windowsUserConfiguration; + + /** + * Get the name property: The name of the user account. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the user account. + * + * @param name the name value to set. + * @return the UserAccount object itself. + */ + public UserAccount withName(String name) { + this.name = name; + return this; + } + + /** + * Get the password property: The password for the user account. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password for the user account. + * + * @param password the password value to set. + * @return the UserAccount object itself. + */ + public UserAccount withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the elevationLevel property: nonAdmin - The auto user is a standard user without elevated access. admin - The + * auto user is a user with elevated access and operates with full Administrator permissions. The default value is + * nonAdmin. + * + * @return the elevationLevel value. + */ + public ElevationLevel elevationLevel() { + return this.elevationLevel; + } + + /** + * Set the elevationLevel property: nonAdmin - The auto user is a standard user without elevated access. admin - The + * auto user is a user with elevated access and operates with full Administrator permissions. The default value is + * nonAdmin. + * + * @param elevationLevel the elevationLevel value to set. + * @return the UserAccount object itself. + */ + public UserAccount withElevationLevel(ElevationLevel elevationLevel) { + this.elevationLevel = elevationLevel; + return this; + } + + /** + * Get the linuxUserConfiguration property: This property is ignored if specified on a Windows pool. If not + * specified, the user is created with the default options. + * + * @return the linuxUserConfiguration value. + */ + public LinuxUserConfiguration linuxUserConfiguration() { + return this.linuxUserConfiguration; + } + + /** + * Set the linuxUserConfiguration property: This property is ignored if specified on a Windows pool. If not + * specified, the user is created with the default options. + * + * @param linuxUserConfiguration the linuxUserConfiguration value to set. + * @return the UserAccount object itself. + */ + public UserAccount withLinuxUserConfiguration(LinuxUserConfiguration linuxUserConfiguration) { + this.linuxUserConfiguration = linuxUserConfiguration; + return this; + } + + /** + * Get the windowsUserConfiguration property: This property can only be specified if the user is on a Windows pool. + * If not specified and on a Windows pool, the user is created with the default options. + * + * @return the windowsUserConfiguration value. + */ + public WindowsUserConfiguration windowsUserConfiguration() { + return this.windowsUserConfiguration; + } + + /** + * Set the windowsUserConfiguration property: This property can only be specified if the user is on a Windows pool. + * If not specified and on a Windows pool, the user is created with the default options. + * + * @param windowsUserConfiguration the windowsUserConfiguration value to set. + * @return the UserAccount object itself. + */ + public UserAccount withWindowsUserConfiguration(WindowsUserConfiguration windowsUserConfiguration) { + this.windowsUserConfiguration = windowsUserConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model UserAccount")); + } + if (password() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property password in model UserAccount")); + } + if (linuxUserConfiguration() != null) { + linuxUserConfiguration().validate(); + } + if (windowsUserConfiguration() != null) { + windowsUserConfiguration().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/UserIdentity.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/UserIdentity.java new file mode 100644 index 0000000000000..77d112882fc06 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/UserIdentity.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.batch.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; + +/** Specify either the userName or autoUser property, but not both. */ +@Fluent +public class UserIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserIdentity.class); + + /* + * The userName and autoUser properties are mutually exclusive; you must + * specify one but not both. + */ + @JsonProperty(value = "userName") + private String username; + + /* + * The userName and autoUser properties are mutually exclusive; you must + * specify one but not both. + */ + @JsonProperty(value = "autoUser") + private AutoUserSpecification autoUser; + + /** + * Get the username property: The userName and autoUser properties are mutually exclusive; you must specify one but + * not both. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The userName and autoUser properties are mutually exclusive; you must specify one but + * not both. + * + * @param username the username value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the autoUser property: The userName and autoUser properties are mutually exclusive; you must specify one but + * not both. + * + * @return the autoUser value. + */ + public AutoUserSpecification autoUser() { + return this.autoUser; + } + + /** + * Set the autoUser property: The userName and autoUser properties are mutually exclusive; you must specify one but + * not both. + * + * @param autoUser the autoUser value to set. + * @return the UserIdentity object itself. + */ + public UserIdentity withAutoUser(AutoUserSpecification autoUser) { + this.autoUser = autoUser; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (autoUser() != null) { + autoUser().validate(); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VMExtension.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VMExtension.java new file mode 100644 index 0000000000000..e87a20d672839 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VMExtension.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.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The configuration for virtual machine extensions. */ +@Fluent +public final class VMExtension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VMExtension.class); + + /* + * The name of the virtual machine extension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * The type of the extensions. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * The version of script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Any object + */ + @JsonProperty(value = "settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "protectedSettings") + private Object protectedSettings; + + /* + * Collection of extension names after which this extension needs to be + * provisioned. + */ + @JsonProperty(value = "provisionAfterExtensions") + private List provisionAfterExtensions; + + /** + * Get the name property: The name of the virtual machine extension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the virtual machine extension. + * + * @param name the name value to set. + * @return the VMExtension object itself. + */ + public VMExtension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the VMExtension object itself. + */ + public VMExtension withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: The type of the extensions. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the extensions. + * + * @param type the type value to set. + * @return the VMExtension object itself. + */ + public VMExtension withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: The version of script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: The version of script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the VMExtension object itself. + */ + public VMExtension withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the VMExtension object itself. + */ + public VMExtension withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the settings property: Any object. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Any object. + * + * @param settings the settings value to set. + * @return the VMExtension object itself. + */ + public VMExtension withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the VMExtension object itself. + */ + public VMExtension withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @return the provisionAfterExtensions value. + */ + public List provisionAfterExtensions() { + return this.provisionAfterExtensions; + } + + /** + * Set the provisionAfterExtensions property: Collection of extension names after which this extension needs to be + * provisioned. + * + * @param provisionAfterExtensions the provisionAfterExtensions value to set. + * @return the VMExtension object itself. + */ + public VMExtension withProvisionAfterExtensions(List provisionAfterExtensions) { + this.provisionAfterExtensions = provisionAfterExtensions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model VMExtension")); + } + if (publisher() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property publisher in model VMExtension")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model VMExtension")); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VirtualMachineConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VirtualMachineConfiguration.java new file mode 100644 index 0000000000000..2f2894b471e87 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VirtualMachineConfiguration.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.batch.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The configuration for compute nodes in a pool based on the Azure Virtual Machines infrastructure. */ +@Fluent +public final class VirtualMachineConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineConfiguration.class); + + /* + * A reference to an Azure Virtual Machines Marketplace image or the Azure + * Image resource of a custom Virtual Machine. To get the list of all + * imageReferences verified by Azure Batch, see the 'List supported node + * agent SKUs' operation. + */ + @JsonProperty(value = "imageReference", required = true) + private ImageReference imageReference; + + /* + * The Batch node agent is a program that runs on each node in the pool, + * and provides the command-and-control interface between the node and the + * Batch service. There are different implementations of the node agent, + * known as SKUs, for different operating systems. You must specify a node + * agent SKU which matches the selected image reference. To get the list of + * supported node agent SKUs along with their list of verified image + * references, see the 'List supported node agent SKUs' operation. + */ + @JsonProperty(value = "nodeAgentSkuId", required = true) + private String nodeAgentSkuId; + + /* + * This property must not be specified if the imageReference specifies a + * Linux OS image. + */ + @JsonProperty(value = "windowsConfiguration") + private WindowsConfiguration windowsConfiguration; + + /* + * This property must be specified if the compute nodes in the pool need to + * have empty data disks attached to them. + */ + @JsonProperty(value = "dataDisks") + private List dataDisks; + + /* + * This only applies to images that contain the Windows operating system, + * and should only be used when you hold valid on-premises licenses for the + * nodes which will be deployed. If omitted, no on-premises licensing + * discount is applied. Values are: + * + * Windows_Server - The on-premises license is for Windows Server. + * Windows_Client - The on-premises license is for Windows Client. + * + */ + @JsonProperty(value = "licenseType") + private String licenseType; + + /* + * If specified, setup is performed on each node in the pool to allow tasks + * to run in containers. All regular tasks and job manager tasks run on + * this pool must specify the containerSettings property, and all other + * tasks may specify it. + */ + @JsonProperty(value = "containerConfiguration") + private ContainerConfiguration containerConfiguration; + + /* + * If specified, encryption is performed on each node in the pool during + * node provisioning. + */ + @JsonProperty(value = "diskEncryptionConfiguration") + private DiskEncryptionConfiguration diskEncryptionConfiguration; + + /* + * This configuration will specify rules on how nodes in the pool will be + * physically allocated. + */ + @JsonProperty(value = "nodePlacementConfiguration") + private NodePlacementConfiguration nodePlacementConfiguration; + + /* + * If specified, the extensions mentioned in this configuration will be + * installed on each node. + */ + @JsonProperty(value = "extensions") + private List extensions; + + /** + * Get the imageReference property: A reference to an Azure Virtual Machines Marketplace image or the Azure Image + * resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the + * 'List supported node agent SKUs' operation. + * + * @return the imageReference value. + */ + public ImageReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: A reference to an Azure Virtual Machines Marketplace image or the Azure Image + * resource of a custom Virtual Machine. To get the list of all imageReferences verified by Azure Batch, see the + * 'List supported node agent SKUs' operation. + * + * @param imageReference the imageReference value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withImageReference(ImageReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the nodeAgentSkuId property: The Batch node agent is a program that runs on each node in the pool, and + * provides the command-and-control interface between the node and the Batch service. There are different + * implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent + * SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their + * list of verified image references, see the 'List supported node agent SKUs' operation. + * + * @return the nodeAgentSkuId value. + */ + public String nodeAgentSkuId() { + return this.nodeAgentSkuId; + } + + /** + * Set the nodeAgentSkuId property: The Batch node agent is a program that runs on each node in the pool, and + * provides the command-and-control interface between the node and the Batch service. There are different + * implementations of the node agent, known as SKUs, for different operating systems. You must specify a node agent + * SKU which matches the selected image reference. To get the list of supported node agent SKUs along with their + * list of verified image references, see the 'List supported node agent SKUs' operation. + * + * @param nodeAgentSkuId the nodeAgentSkuId value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withNodeAgentSkuId(String nodeAgentSkuId) { + this.nodeAgentSkuId = nodeAgentSkuId; + return this; + } + + /** + * Get the windowsConfiguration property: This property must not be specified if the imageReference specifies a + * Linux OS image. + * + * @return the windowsConfiguration value. + */ + public WindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set the windowsConfiguration property: This property must not be specified if the imageReference specifies a + * Linux OS image. + * + * @param windowsConfiguration the windowsConfiguration value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withWindowsConfiguration(WindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Get the dataDisks property: This property must be specified if the compute nodes in the pool need to have empty + * data disks attached to them. + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: This property must be specified if the compute nodes in the pool need to have empty + * data disks attached to them. + * + * @param dataDisks the dataDisks value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Get the licenseType property: This only applies to images that contain the Windows operating system, and should + * only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no + * on-premises licensing discount is applied. Values are: + * + *

Windows_Server - The on-premises license is for Windows Server. Windows_Client - The on-premises license is + * for Windows Client. + * + * @return the licenseType value. + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType property: This only applies to images that contain the Windows operating system, and should + * only be used when you hold valid on-premises licenses for the nodes which will be deployed. If omitted, no + * on-premises licensing discount is applied. Values are: + * + *

Windows_Server - The on-premises license is for Windows Server. Windows_Client - The on-premises license is + * for Windows Client. + * + * @param licenseType the licenseType value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the containerConfiguration property: If specified, setup is performed on each node in the pool to allow tasks + * to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings + * property, and all other tasks may specify it. + * + * @return the containerConfiguration value. + */ + public ContainerConfiguration containerConfiguration() { + return this.containerConfiguration; + } + + /** + * Set the containerConfiguration property: If specified, setup is performed on each node in the pool to allow tasks + * to run in containers. All regular tasks and job manager tasks run on this pool must specify the containerSettings + * property, and all other tasks may specify it. + * + * @param containerConfiguration the containerConfiguration value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withContainerConfiguration(ContainerConfiguration containerConfiguration) { + this.containerConfiguration = containerConfiguration; + return this; + } + + /** + * Get the diskEncryptionConfiguration property: If specified, encryption is performed on each node in the pool + * during node provisioning. + * + * @return the diskEncryptionConfiguration value. + */ + public DiskEncryptionConfiguration diskEncryptionConfiguration() { + return this.diskEncryptionConfiguration; + } + + /** + * Set the diskEncryptionConfiguration property: If specified, encryption is performed on each node in the pool + * during node provisioning. + * + * @param diskEncryptionConfiguration the diskEncryptionConfiguration value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withDiskEncryptionConfiguration( + DiskEncryptionConfiguration diskEncryptionConfiguration) { + this.diskEncryptionConfiguration = diskEncryptionConfiguration; + return this; + } + + /** + * Get the nodePlacementConfiguration property: This configuration will specify rules on how nodes in the pool will + * be physically allocated. + * + * @return the nodePlacementConfiguration value. + */ + public NodePlacementConfiguration nodePlacementConfiguration() { + return this.nodePlacementConfiguration; + } + + /** + * Set the nodePlacementConfiguration property: This configuration will specify rules on how nodes in the pool will + * be physically allocated. + * + * @param nodePlacementConfiguration the nodePlacementConfiguration value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withNodePlacementConfiguration( + NodePlacementConfiguration nodePlacementConfiguration) { + this.nodePlacementConfiguration = nodePlacementConfiguration; + return this; + } + + /** + * Get the extensions property: If specified, the extensions mentioned in this configuration will be installed on + * each node. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Set the extensions property: If specified, the extensions mentioned in this configuration will be installed on + * each node. + * + * @param extensions the extensions value to set. + * @return the VirtualMachineConfiguration object itself. + */ + public VirtualMachineConfiguration withExtensions(List extensions) { + this.extensions = extensions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (imageReference() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property imageReference in model VirtualMachineConfiguration")); + } else { + imageReference().validate(); + } + if (nodeAgentSkuId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property nodeAgentSkuId in model VirtualMachineConfiguration")); + } + if (windowsConfiguration() != null) { + windowsConfiguration().validate(); + } + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + if (containerConfiguration() != null) { + containerConfiguration().validate(); + } + if (diskEncryptionConfiguration() != null) { + diskEncryptionConfiguration().validate(); + } + if (nodePlacementConfiguration() != null) { + nodePlacementConfiguration().validate(); + } + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VirtualMachineFamilyCoreQuota.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VirtualMachineFamilyCoreQuota.java new file mode 100644 index 0000000000000..b38007eadd31b --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/VirtualMachineFamilyCoreQuota.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.batch.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 VM Family and its associated core quota for the Batch account. */ +@Immutable +public final class VirtualMachineFamilyCoreQuota { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineFamilyCoreQuota.class); + + /* + * The Virtual Machine family name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The core quota for the VM family for the Batch account. + */ + @JsonProperty(value = "coreQuota", access = JsonProperty.Access.WRITE_ONLY) + private Integer coreQuota; + + /** + * Get the name property: The Virtual Machine family name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the coreQuota property: The core quota for the VM family for the Batch account. + * + * @return the coreQuota value. + */ + public Integer coreQuota() { + return this.coreQuota; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/WindowsConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/WindowsConfiguration.java new file mode 100644 index 0000000000000..827c9d3e5a226 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/WindowsConfiguration.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.batch.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; + +/** Windows operating system settings to apply to the virtual machine. */ +@Fluent +public final class WindowsConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WindowsConfiguration.class); + + /* + * If omitted, the default value is true. + */ + @JsonProperty(value = "enableAutomaticUpdates") + private Boolean enableAutomaticUpdates; + + /** + * Get the enableAutomaticUpdates property: If omitted, the default value is true. + * + * @return the enableAutomaticUpdates value. + */ + public Boolean enableAutomaticUpdates() { + return this.enableAutomaticUpdates; + } + + /** + * Set the enableAutomaticUpdates property: If omitted, the default value is true. + * + * @param enableAutomaticUpdates the enableAutomaticUpdates value to set. + * @return the WindowsConfiguration object itself. + */ + public WindowsConfiguration withEnableAutomaticUpdates(Boolean enableAutomaticUpdates) { + this.enableAutomaticUpdates = enableAutomaticUpdates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/WindowsUserConfiguration.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/WindowsUserConfiguration.java new file mode 100644 index 0000000000000..20c4c32493b7f --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/WindowsUserConfiguration.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.batch.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 used to create a user account on a Windows node. */ +@Fluent +public final class WindowsUserConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WindowsUserConfiguration.class); + + /* + * Specifies login mode for the user. The default value for + * VirtualMachineConfiguration pools is interactive mode and for + * CloudServiceConfiguration pools is batch mode. + */ + @JsonProperty(value = "loginMode") + private LoginMode loginMode; + + /** + * Get the loginMode property: Specifies login mode for the user. The default value for VirtualMachineConfiguration + * pools is interactive mode and for CloudServiceConfiguration pools is batch mode. + * + * @return the loginMode value. + */ + public LoginMode loginMode() { + return this.loginMode; + } + + /** + * Set the loginMode property: Specifies login mode for the user. The default value for VirtualMachineConfiguration + * pools is interactive mode and for CloudServiceConfiguration pools is batch mode. + * + * @param loginMode the loginMode value to set. + * @return the WindowsUserConfiguration object itself. + */ + public WindowsUserConfiguration withLoginMode(LoginMode loginMode) { + this.loginMode = loginMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/package-info.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/package-info.java new file mode 100644 index 0000000000000..2a7f85de666d8 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/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 BatchManagement. null. */ +package com.azure.resourcemanager.batch.models; diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/package-info.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/package-info.java new file mode 100644 index 0000000000000..f927ece06812a --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/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 BatchManagement. null. */ +package com.azure.resourcemanager.batch; diff --git a/sdk/batch/azure-resourcemanager-batch/src/main/java/module-info.java b/sdk/batch/azure-resourcemanager-batch/src/main/java/module-info.java new file mode 100644 index 0000000000000..1372738480d11 --- /dev/null +++ b/sdk/batch/azure-resourcemanager-batch/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.batch { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.batch; + exports com.azure.resourcemanager.batch.fluent; + exports com.azure.resourcemanager.batch.fluent.models; + exports com.azure.resourcemanager.batch.models; + + opens com.azure.resourcemanager.batch.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.batch.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/batch/ci.yml b/sdk/batch/ci.yml index fe33541989e13..729b29e0e0061 100644 --- a/sdk/batch/ci.yml +++ b/sdk/batch/ci.yml @@ -24,9 +24,8 @@ pr: extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - SDKType: data ServiceDirectory: batch Artifacts: - - name: azure-batch - groupId: com.microsoft.azure - safeName: azurebatch + - name: azure-resourcemanager-batch + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerbatch diff --git a/sdk/batch/pom.xml b/sdk/batch/pom.xml index c1fe47f40a73c..e78a3ea4b2366 100644 --- a/sdk/batch/pom.xml +++ b/sdk/batch/pom.xml @@ -9,6 +9,7 @@ pom 1.0.0 + azure-resourcemanager-batch microsoft-azure-batch