From 3b5d2aa079411facb466748e7140f50f062241fb Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 2 Oct 2024 00:49:15 +0000 Subject: [PATCH] CodeGen from PR 30824 in Azure/azure-rest-api-specs Merge b2fdf5c0b14033037a6029f1b9701143ac199cdc into e605d439dda724fc2fc0274e0a82a3434a1524d7 --- .../CHANGELOG.md | 10 +-- .../README.md | 44 +++++++++- .../azure-resourcemanager-standbypool/pom.xml | 27 +++--- .../standbypool/StandbyPoolTests.java | 87 +++++++++---------- .../tsp-location.yaml | 2 +- 5 files changed, 99 insertions(+), 71 deletions(-) diff --git a/sdk/standbypool/azure-resourcemanager-standbypool/CHANGELOG.md b/sdk/standbypool/azure-resourcemanager-standbypool/CHANGELOG.md index 62b558c58bc5..00bf23ffaa2d 100644 --- a/sdk/standbypool/azure-resourcemanager-standbypool/CHANGELOG.md +++ b/sdk/standbypool/azure-resourcemanager-standbypool/CHANGELOG.md @@ -1,14 +1,8 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2024-10-02) -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Azure Resource Manager Standby Pool client library for Java. This package contains Microsoft Azure SDK for Standby Pool Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0 (2024-09-25) diff --git a/sdk/standbypool/azure-resourcemanager-standbypool/README.md b/sdk/standbypool/azure-resourcemanager-standbypool/README.md index b0288c241a33..394c40e9e4d4 100644 --- a/sdk/standbypool/azure-resourcemanager-standbypool/README.md +++ b/sdk/standbypool/azure-resourcemanager-standbypool/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-standbypool - 1.0.0 + 1.1.0-beta.1 ``` [//]: # ({x-version-update-end}) @@ -70,6 +70,48 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +```java +// reference https://learn.microsoft.com/azure/virtual-machine-scale-sets/standby-pools-create + +// Create virtual network and virtual machine scale set +virtualNetwork = this.computeManager.networkManager() + .networks() + .define("vmssvnet") + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .withAddressSpace("10.0.0.0/27") + .withSubnet("default", "10.0.0.0/27") + .create(); + +virtualMachineScaleSet = computeManager.virtualMachineScaleSets() + .define("vmss") + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .withFlexibleOrchestrationMode() + .withSku(VirtualMachineScaleSetSkuTypes.STANDARD_A0) + .withExistingPrimaryNetworkSubnet(virtualNetwork, "default") + .withoutPrimaryInternetFacingLoadBalancer() + .withoutPrimaryInternalLoadBalancer() + .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_18_04_LTS) + .withRootUsername("Foo12") + .withSsh(sshPublicKey()) + .withVirtualMachinePublicIp() + .withCapacity(3L) + .create(); + +// create standby virtual machine pool +standbyVirtualMachinePool = standbyPoolManager.standbyVirtualMachinePools() + .define(poolName) + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .withProperties(new StandbyVirtualMachinePoolResourceProperties() + .withAttachedVirtualMachineScaleSetId(virtualMachineScaleSet.id()) + .withVirtualMachineState(VirtualMachineState.DEALLOCATED) + .withElasticityProfile(new StandbyVirtualMachinePoolElasticityProfile() + .withMaxReadyCapacity(3L) + .withMinReadyCapacity(1L))) + .create(); +``` [Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/standbypool/azure-resourcemanager-standbypool/SAMPLE.md) diff --git a/sdk/standbypool/azure-resourcemanager-standbypool/pom.xml b/sdk/standbypool/azure-resourcemanager-standbypool/pom.xml index f11d1a1e3f74..3fc1c4d6609f 100644 --- a/sdk/standbypool/azure-resourcemanager-standbypool/pom.xml +++ b/sdk/standbypool/azure-resourcemanager-standbypool/pom.xml @@ -46,13 +46,9 @@ 0 0 true + false - - com.azure - azure-json - 1.3.0 - com.azure azure-core @@ -68,23 +64,22 @@ azure-core-test 1.27.0-beta.2 test - - - com.azure - azure-core-http-jdk-httpclient - - - com.azure.resourcemanager - azure-resourcemanager-compute - 2.43.0 + com.azure + azure-identity + 1.13.3 test com.azure - azure-identity - 1.13.3 + azure-json + 1.3.0 + + + com.azure.resourcemanager + azure-resourcemanager-compute + 2.43.0 test diff --git a/sdk/standbypool/azure-resourcemanager-standbypool/src/test/java/com/azure/resourcemanager/standbypool/StandbyPoolTests.java b/sdk/standbypool/azure-resourcemanager-standbypool/src/test/java/com/azure/resourcemanager/standbypool/StandbyPoolTests.java index 3794e422b97a..c901d9e3d157 100644 --- a/sdk/standbypool/azure-resourcemanager-standbypool/src/test/java/com/azure/resourcemanager/standbypool/StandbyPoolTests.java +++ b/sdk/standbypool/azure-resourcemanager-standbypool/src/test/java/com/azure/resourcemanager/standbypool/StandbyPoolTests.java @@ -55,15 +55,13 @@ public void beforeTest() { final TokenCredential credential = new AzurePowerShellCredentialBuilder().build(); final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); - standbyPoolManager = StandbyPoolManager - .configure() - .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)) - .authenticate(credential, profile); + standbyPoolManager = StandbyPoolManager.configure() + .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)) + .authenticate(credential, profile); - computeManager = ComputeManager - .configure() - .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)) - .authenticate(credential, profile); + computeManager = ComputeManager.configure() + .withLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC)) + .authenticate(credential, profile); // use AZURE_RESOURCE_GROUP_NAME if run in LIVE CI String testResourceGroup = Configuration.getGlobalConfiguration().get("AZURE_RESOURCE_GROUP_NAME"); @@ -71,10 +69,7 @@ public void beforeTest() { if (testEnv) { resourceGroupName = testResourceGroup; } else { - computeManager.resourceManager().resourceGroups() - .define(resourceGroupName) - .withRegion(REGION) - .create(); + computeManager.resourceManager().resourceGroups().define(resourceGroupName).withRegion(REGION).create(); } } @@ -98,46 +93,47 @@ public void testStandbyVirtualMachinePool() { // Create virtual network and virtual machine scale set virtualNetwork = this.computeManager.networkManager() - .networks() - .define("vmssvnet") - .withRegion(REGION) - .withExistingResourceGroup(resourceGroupName) - .withAddressSpace("10.0.0.0/27") - .withSubnet("default", "10.0.0.0/27") - .create(); + .networks() + .define("vmssvnet") + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .withAddressSpace("10.0.0.0/27") + .withSubnet("default", "10.0.0.0/27") + .create(); virtualMachineScaleSet = computeManager.virtualMachineScaleSets() - .define("vmss") - .withRegion(REGION) - .withExistingResourceGroup(resourceGroupName) - .withFlexibleOrchestrationMode() - .withSku(VirtualMachineScaleSetSkuTypes.STANDARD_A0) - .withExistingPrimaryNetworkSubnet(virtualNetwork, "default") - .withoutPrimaryInternetFacingLoadBalancer() - .withoutPrimaryInternalLoadBalancer() - .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_18_04_LTS) - .withRootUsername("Foo12") - .withSsh(sshPublicKey()) - .withVirtualMachinePublicIp() - .withCapacity(3L) - .create(); + .define("vmss") + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .withFlexibleOrchestrationMode() + .withSku(VirtualMachineScaleSetSkuTypes.STANDARD_A0) + .withExistingPrimaryNetworkSubnet(virtualNetwork, "default") + .withoutPrimaryInternetFacingLoadBalancer() + .withoutPrimaryInternalLoadBalancer() + .withPopularLinuxImage(KnownLinuxVirtualMachineImage.UBUNTU_SERVER_18_04_LTS) + .withRootUsername("Foo12") + .withSsh(sshPublicKey()) + .withVirtualMachinePublicIp() + .withCapacity(3L) + .create(); // create standby virtual machine pool standbyVirtualMachinePool = standbyPoolManager.standbyVirtualMachinePools() - .define(poolName) - .withRegion(REGION) - .withExistingResourceGroup(resourceGroupName) - .withProperties(new StandbyVirtualMachinePoolResourceProperties() - .withAttachedVirtualMachineScaleSetId(virtualMachineScaleSet.id()) - .withVirtualMachineState(VirtualMachineState.DEALLOCATED) - .withElasticityProfile(new StandbyVirtualMachinePoolElasticityProfile() - .withMaxReadyCapacity(3L) - .withMinReadyCapacity(1L))) - .create(); + .define(poolName) + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .withProperties(new StandbyVirtualMachinePoolResourceProperties() + .withAttachedVirtualMachineScaleSetId(virtualMachineScaleSet.id()) + .withVirtualMachineState(VirtualMachineState.DEALLOCATED) + .withElasticityProfile(new StandbyVirtualMachinePoolElasticityProfile().withMaxReadyCapacity(3L) + .withMinReadyCapacity(1L))) + .create(); // @embedmeEnd standbyVirtualMachinePool.refresh(); Assertions.assertEquals(poolName, standbyVirtualMachinePool.name()); - Assertions.assertTrue(standbyPoolManager.standbyVirtualMachinePools().listByResourceGroup(resourceGroupName).stream().count() > 0); + Assertions.assertTrue( + standbyPoolManager.standbyVirtualMachinePools().listByResourceGroup(resourceGroupName).stream().count() + > 0); } finally { if (standbyVirtualMachinePool != null) { standbyPoolManager.standbyVirtualMachinePools().deleteById(standbyVirtualMachinePool.id()); @@ -170,7 +166,8 @@ private static String sshPublicKey() { dos.write(rsaPublicKey.getPublicExponent().toByteArray()); dos.writeInt(rsaPublicKey.getModulus().toByteArray().length); dos.write(rsaPublicKey.getModulus().toByteArray()); - String publicKeyEncoded = new String(Base64.getEncoder().encode(byteOs.toByteArray()), StandardCharsets.US_ASCII); + String publicKeyEncoded + = new String(Base64.getEncoder().encode(byteOs.toByteArray()), StandardCharsets.US_ASCII); sshPublicKey = "ssh-rsa " + publicKeyEncoded; } catch (NoSuchAlgorithmException | IOException e) { throw LOGGER.logExceptionAsError(new IllegalStateException("failed to generate ssh key", e)); diff --git a/sdk/standbypool/azure-resourcemanager-standbypool/tsp-location.yaml b/sdk/standbypool/azure-resourcemanager-standbypool/tsp-location.yaml index 8c53e98e7792..ecbeacd6435c 100644 --- a/sdk/standbypool/azure-resourcemanager-standbypool/tsp-location.yaml +++ b/sdk/standbypool/azure-resourcemanager-standbypool/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/standbypool/StandbyPool.Management -commit: f93850874010501f216ceadf19459402efd16d9e +commit: 6b815c0cae3b7b3b42809a68a22b1d86511ecf7f repo: Azure/azure-rest-api-specs additionalDirectories: