Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-resourcemanager-standbypool] Adding IsZoneResilientProvisioningAllowed property in the response for location capabilities api #12850

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions sdk/standbypool/azure-resourcemanager-standbypool/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# Release History

## 1.1.0-beta.1 (Unreleased)
## 1.0.0-beta.1 (2024-10-08)

### 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)

Expand Down
44 changes: 43 additions & 1 deletion sdk/standbypool/azure-resourcemanager-standbypool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-standbypool</artifactId>
<version>1.0.0</version>
<version>1.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -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)


Expand Down
27 changes: 11 additions & 16 deletions sdk/standbypool/azure-resourcemanager-standbypool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,9 @@
<jacoco.min.linecoverage>0</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0</jacoco.min.branchcoverage>
<revapi.skip>true</revapi.skip>
<spotless.skip>false</spotless.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-json</artifactId>
<version>1.3.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
Expand All @@ -68,23 +64,22 @@
<artifactId>azure-core-test</artifactId>
<version>1.27.0-beta.2</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-jdk-httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-compute</artifactId>
<version>2.43.0</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-compute;dependency} -->
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.14.0</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.14.0</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<artifactId>azure-json</artifactId>
<version>1.3.0</version> <!-- {x-version-update;com.azure:azure-json;dependency} -->
</dependency>
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-compute</artifactId>
<version>2.43.0</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-compute;dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,21 @@ 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");
testEnv = !CoreUtils.isNullOrEmpty(testResourceGroup);
if (testEnv) {
resourceGroupName = testResourceGroup;
} else {
computeManager.resourceManager().resourceGroups()
.define(resourceGroupName)
.withRegion(REGION)
.create();
computeManager.resourceManager().resourceGroups().define(resourceGroupName).withRegion(REGION).create();
}
}

Expand All @@ -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());
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
directory: specification/standbypool/StandbyPool.Management
commit: f93850874010501f216ceadf19459402efd16d9e
commit: 8efaa61aa60b750f83b68893abb0481c9dbf5c13
repo: Azure/azure-rest-api-specs
additionalDirectories: