Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 2.26.0-beta.1 (Unreleased)

### Features Added

- Supported `timeCreated()` in `VirtualMachineScaleSetVM` and `VirtualMachine`.

### Breaking Changes

- Changed type from `ApiEntityReference` to `DiskRestorePointAttributes` of `diskRestorePoint` property in `RestorePointSourceVMDataDisk` and `RestorePointSourceVmosDisk` class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMNetworkProfileConfiguration;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMProtectionPolicy;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -542,6 +543,15 @@ public VirtualMachineScaleSetVMInner withUserData(String userData) {
return this;
}

/**
* Get the timeCreated property: Specifies the time at which the Virtual Machine resource was created.
*
* @return the timeCreated value.
*/
public OffsetDateTime timeCreated() {
return this.innerProperties() == null ? null : this.innerProperties().timeCreated();
}

/**
* Validates the instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMNetworkProfileConfiguration;
import com.azure.resourcemanager.compute.models.VirtualMachineScaleSetVMProtectionPolicy;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** Describes the properties of a virtual machine scale set virtual machine. */
@Fluent
Expand Down Expand Up @@ -139,6 +140,12 @@ public final class VirtualMachineScaleSetVMPropertiesInner {
@JsonProperty(value = "userData")
private String userData;

/*
* Specifies the time at which the Virtual Machine resource was created.
*/
@JsonProperty(value = "timeCreated", access = JsonProperty.Access.WRITE_ONLY)
private OffsetDateTime timeCreated;

/** Creates an instance of VirtualMachineScaleSetVMPropertiesInner class. */
public VirtualMachineScaleSetVMPropertiesInner() {
}
Expand Down Expand Up @@ -468,6 +475,15 @@ public VirtualMachineScaleSetVMPropertiesInner withUserData(String userData) {
return this;
}

/**
* Get the timeCreated property: Specifies the time at which the Virtual Machine resource was created.
*
* @return the timeCreated value.
*/
public OffsetDateTime timeCreated() {
return this.timeCreated;
}

/**
* Validates the instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -1992,6 +1993,11 @@ public boolean isVTpmEnabled() {
&& ResourceManagerUtils.toPrimitiveBoolean(this.innerModel().securityProfile().uefiSettings().vTpmEnabled());
}

@Override
public OffsetDateTime timeCreated() {
return innerModel().timeCreated();
}

@Override
public VirtualMachinePriorityTypes priority() {
return this.innerModel().priority();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils;
import reactor.core.publisher.Mono;

import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand Down Expand Up @@ -591,6 +592,11 @@ public VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfigu
return this.innerModel().networkProfileConfiguration();
}

@Override
public OffsetDateTime timeCreated() {
return this.innerModel().timeCreated();
}

private void clearCachedRelatedResources() {
this.virtualMachineInstanceView = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.azure.resourcemanager.storage.models.StorageAccount;
import reactor.core.publisher.Mono;

import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -422,6 +423,9 @@ Mono<RunCommandResult> runShellScriptAsync(
/** @return whether vTPM is enabled on the virtual machine */
boolean isVTpmEnabled();

/** @return the time at which the Virtual Machine resource was created */
OffsetDateTime timeCreated();

// Setters
//

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import com.azure.resourcemanager.resources.fluentcore.model.HasInnerModel;
import com.azure.resourcemanager.resources.fluentcore.model.Refreshable;
import com.azure.resourcemanager.resources.fluentcore.model.Updatable;

import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -291,6 +293,9 @@ public interface VirtualMachineScaleSetVM
/** @return The network profile config for the vm. */
VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration();

/** @return the time at which the Virtual Machine resource was created */
OffsetDateTime timeCreated();

/** The template for an update operation, containing all the settings that can be modified. */
interface Update extends Appliable<VirtualMachineScaleSetVM> {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public void canCreateVirtualMachine() throws Exception {
Assertions.assertNotNull(foundVM);
Assertions.assertEquals(region, foundVM.region());
Assertions.assertEquals("Windows_Server", foundVM.licenseType());
Assertions.assertNotNull(foundVM.timeCreated());

// Fetch instance view
PowerState powerState = foundVM.powerState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,7 @@ public void canListInstancesIncludingInstanceView() {
VirtualMachineScaleSet vmss = computeManager.virtualMachineScaleSets().getByResourceGroup(rgName, vmssName);
List<VirtualMachineScaleSetVM> vmInstances = vmss.virtualMachines().list(null, VirtualMachineScaleSetVMExpandType.INSTANCE_VIEW).stream().collect(Collectors.toList());
Assertions.assertEquals(3, vmInstances.size());
Assertions.assertTrue(vmInstances.stream().allMatch(vm -> vm.timeCreated() != null));
List<PowerState> powerStates = vmInstances.stream().map(VirtualMachineScaleSetVM::powerState).collect(Collectors.toList());
Assertions.assertEquals(Arrays.asList(PowerState.RUNNING, PowerState.RUNNING, PowerState.RUNNING), powerStates);

Expand All @@ -1282,6 +1283,7 @@ public void canListInstancesIncludingInstanceView() {
// check single VM
VirtualMachineScaleSetVM vmInstance0 = vmss.virtualMachines().getInstance(firstInstanceId);
Assertions.assertEquals(PowerState.DEALLOCATED, vmInstance0.powerState());
Assertions.assertNotNull(vmInstance0.timeCreated());
}

@Test
Expand Down
Loading