Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/sdk/formrecognizer/ @samvaity @mssfang @sima-zhu
/sdk/identity/ @schaabs @g2vinay @jianghaolu
/sdk/keyvault/ @g2vinay @vcolin7 @samvaity
/sdk/schemaregistry/ @arerlend @sjkwak
/sdk/search/ @alzimmermsft @sima-zhu @mssfang @samvaity @conniey
/sdk/servicebus/ @yvgopal @nemakam @hemanttanwar @conniey
/sdk/storage/ @amishra-dev @rickle-msft @jaschrep-msft @gapra-msft @alzimmermsft @sima-zhu
Expand Down
3 changes: 3 additions & 0 deletions eng/docgeneration/service-mapper.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"resourcegraph": "Resource Graph",
"resourcehealth": "Resource Health",
"resources": "Resources",
"schemaregistry": "Schema Registry",
"search": "Search",
"security": "Security",
"serialconsole": "Serial Console",
Expand All @@ -116,6 +117,8 @@
"storsimple8000series": "Storsimple 8000 Series",
"streamanalytics": "Stream Analytics",
"subscription": "Subscription",
"synapse": "Synapse",
"tables": "Tables",
"template": "Template",
"test-utils": "Test Utils",
"textanalytics": "Text Analytics",
Expand Down
4 changes: 4 additions & 0 deletions eng/mgmt/api-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
"source": "specification/consumption/resource-manager/readme.md",
"args": "--multiapi --fluent"
},
"containerinstance/resource-manager": {
"source": "specification/containerinstance/resource-manager/readme.md",
"args": "--multiapi --fluent"
},
"containerservice/resource-manager": {
"source": "specification/containerservice/resource-manager/readme.md",
"args": "--multiapi --fluent"
Expand Down
2 changes: 1 addition & 1 deletion eng/mgmt/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ var changePom = function(project) {
var modulePom = path.join(projectRoot, mod, 'pom.xml');
if (fs.existsSync(modulePom)) {
var pomContent = fs.readFileSync(modulePom, {encoding: 'utf-8'});
pomContent = pomContent.replace('<version>1.1.0</version>', '<version>1.3.0</version>');
pomContent = pomContent.replace('<version>1.1.0</version>', '<version>1.3.2</version>');
pomContent = pomContent.replace('<relativePath>../../../pom.management.xml</relativePath>', '<relativePath>../../parents/azure-arm-parent/pom.xml</relativePath>');
fs.writeFileSync(modulePom, pomContent, {encoding: 'utf-8'});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package com.azure.resourcemanager.compute.implementation;

import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.management.AzureEnvironment;
import com.azure.core.management.SubResource;
import com.azure.core.util.logging.ClientLogger;
Expand Down Expand Up @@ -72,7 +73,10 @@
import com.azure.resourcemanager.resources.fluentcore.arm.ResourceId;
import com.azure.resourcemanager.resources.fluentcore.arm.ResourceUtils;
import com.azure.resourcemanager.resources.fluentcore.arm.models.implementation.GroupableResourceImpl;
import com.azure.resourcemanager.resources.fluentcore.model.Accepted;
import com.azure.resourcemanager.resources.fluentcore.model.Creatable;
import com.azure.resourcemanager.resources.fluentcore.model.Indexable;
import com.azure.resourcemanager.resources.fluentcore.model.implementation.AcceptedImpl;
import com.azure.resourcemanager.resources.fluentcore.utils.ResourceNamer;
import com.azure.resourcemanager.resources.fluentcore.utils.Utils;
import com.azure.resourcemanager.storage.models.StorageAccount;
Expand All @@ -83,10 +87,12 @@
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import reactor.core.Exceptions;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.net.MalformedURLException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
Expand All @@ -110,6 +116,7 @@ class VirtualMachineImpl
// Clients
private final StorageManager storageManager;
private final NetworkManager networkManager;
private final AuthorizationManager authorizationManager;
// the name of the virtual machine
private final String vmName;
// used to generate unique name for any dependency resources
Expand Down Expand Up @@ -184,6 +191,7 @@ public JsonProperty.Access findPropertyAccess(Annotated annotated) {
super(name, innerModel, computeManager);
this.storageManager = storageManager;
this.networkManager = networkManager;
this.authorizationManager = authorizationManager;
this.vmName = name;
this.isMarketplaceLinuxImage = false;
this.namer = this.manager().sdkContext().getResourceNamerFactory().createResourceNamer(this.vmName);
Expand Down Expand Up @@ -1675,6 +1683,16 @@ public void beforeGroupCreateOrUpdate() {
@Override
public Mono<VirtualMachine> createResourceAsync() {
// -- set creation-time only properties
return prepareCreateResourceAsync()
.flatMap(virtualMachine -> this.manager().inner().getVirtualMachines()
.createOrUpdateAsync(resourceGroupName(), vmName, inner())
.map(virtualMachineInner -> {
reset(virtualMachineInner);
return this;
}));
}

private Mono<VirtualMachine> prepareCreateResourceAsync() {
setOSDiskDefaults();
setOSProfileDefaults();
setHardwareProfileDefaults();
Expand All @@ -1686,27 +1704,44 @@ public Mono<VirtualMachine> createResourceAsync() {
this.handleUnManagedOSAndDataDisksStorageSettings();
this.bootDiagnosticsHandler.handleDiagnosticsSettings();
this.handleNetworkSettings();
final VirtualMachineImpl self = this;
return this
.createNewProximityPlacementGroupAsync()
.flatMap(
.map(
virtualMachine -> {
this.handleAvailabilitySettings();
this.virtualMachineMsiHandler.processCreatedExternalIdentities();
this.virtualMachineMsiHandler.handleExternalIdentities();
return this
.manager()
.inner()
.getVirtualMachines()
.createOrUpdateAsync(resourceGroupName(), vmName, inner())
.map(
virtualMachineInner -> {
reset(virtualMachineInner);
return self;
});
return virtualMachine;
});
}

public Accepted<VirtualMachine> beginCreate() {
Flux<Indexable> dependencyTasksAsync = taskGroup().invokeDependencyAsync(taskGroup().newInvocationContext());
dependencyTasksAsync.blockLast();

// same as createResourceAsync
prepareCreateResourceAsync().block();

Response<Flux<ByteBuffer>> activationResponse = this.manager().inner().getVirtualMachines()
.createOrUpdateWithResponseAsync(resourceGroupName(), vmName, inner()).block();

if (activationResponse == null) {
throw logger.logExceptionAsError(new NullPointerException());
} else {
Accepted<VirtualMachine> accepted = new AcceptedImpl<VirtualMachineInner, VirtualMachine>(
activationResponse,
this.manager().inner().getSerializerAdapter(),
this.manager().inner().getHttpPipeline(),
VirtualMachineInner.class,
VirtualMachineInner.class,
inner -> new VirtualMachineImpl(inner.name(), inner, this.manager(),
this.storageManager, this.networkManager, this.authorizationManager));

reset(accepted.getAcceptedResult().getValue().inner());
return accepted;
}
}

@Override
public Mono<VirtualMachine> updateResourceAsync() {
if (isManagedDiskEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.
package com.azure.resourcemanager.compute.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.compute.ComputeManager;
import com.azure.resourcemanager.compute.models.HardwareProfile;
Expand All @@ -21,12 +22,19 @@
import com.azure.resourcemanager.authorization.AuthorizationManager;
import com.azure.resourcemanager.network.NetworkManager;
import com.azure.resourcemanager.resources.fluentcore.arm.collection.implementation.TopLevelModifiableResourcesImpl;
import com.azure.resourcemanager.resources.fluentcore.model.Accepted;
import com.azure.resourcemanager.resources.fluentcore.model.implementation.AcceptedImpl;
import com.azure.resourcemanager.storage.StorageManager;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;

import reactor.core.Exceptions;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

/** The implementation for VirtualMachines. */
Expand Down Expand Up @@ -197,6 +205,22 @@ public Mono<RunCommandResult> runCommandAsync(String groupName, String name, Run
return this.inner().runCommandAsync(groupName, name, inputCommand).map(RunCommandResultImpl::new);
}

@Override
public Accepted<Void> beginDeleteByResourceGroup(String resourceGroupName, String name) {
Response<Flux<ByteBuffer>> activationResponse =
this.inner().deleteWithResponseAsync(resourceGroupName, name).block();
if (activationResponse == null) {
throw logger.logExceptionAsError(new NullPointerException());
} else {
return new AcceptedImpl<Void, Void>(activationResponse,
manager().inner().getSerializerAdapter(),
manager().inner().getHttpPipeline(),
Void.class,
Void.class,
Function.identity());
}
}

// Getters
@Override
public VirtualMachineSizes sizes() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,24 @@

/** The popular Azure Linux images. */
public enum KnownLinuxVirtualMachineImage {
/** UbuntuServer 14.04LTS. */
UBUNTU_SERVER_14_04_LTS("Canonical", "UbuntuServer", "14.04.4-LTS"),
/** UbuntuServer 16.04LTS. */
UBUNTU_SERVER_16_04_LTS("Canonical", "UbuntuServer", "16.04.0-LTS"),
/** Debian 8. */
DEBIAN_8("credativ", "Debian", "8"),
/** CentOS 7.2. */
CENTOS_7_2("OpenLogic", "CentOS", "7.2"),
/**
* OpenSUSE-Leap 42.1.
*
* @deprecated for virtual machine use {@link VirtualMachine.DefinitionShared#withLatestLinuxImage(String, String,
* String)}(String publisher, String offer, String sku)} and for virtual machine scale set use {@link
* VirtualMachineScaleSet.DefinitionShared#withLatestLinuxImage(String, String, String)}(String publisher,
* String offer, String sku)} with publisher as "SUSE", offer as "openSUSE-Leap" and sku as "42.3")}.
*/
@Deprecated
OPENSUSE_LEAP_42_1("SUSE", "openSUSE-Leap", "42.1"),
/**
* SLES 12-SP1.
*
* @deprecated for virtual machine use {@link VirtualMachine.DefinitionShared#withLatestLinuxImage(String, String,
* String)}(String publisher, String offer, String sku)} and for virtual machine scale set use {@link
* VirtualMachineScaleSet.DefinitionShared#withLatestLinuxImage(String, String, String)}(String publisher,
* String offer, String sku)} with publisher as "SUSE", offer as "SLES" and sku as "12-SP3")}.
*/
@Deprecated
SLES_12_SP1("SUSE", "SLES", "12-SP1");
/** UbuntuServer 18.04LTS. */
UBUNTU_SERVER_18_04_LTS("Canonical", "UbuntuServer", "18.04-LTS"),
/** Debian 9. */
DEBIAN_9("credativ", "Debian", "9"),
/** Debian 10. */
DEBIAN_10("Debian", "debian-10", "10"),
/** CentOS 8.1. */
CENTOS_8_1("OpenLogic", "CentOS", "8_1"),
/** OpenSUSE-Leap 15.1. */
OPENSUSE_LEAP_15_1("SUSE", "openSUSE-Leap", "15-1"),
/** SLES 15-SP1-gen1. */
SLES_15_SP1("SUSE", "sles-15-sp1", "gen1"),
/** RedHat RHEL 8.2. */
REDHAT_RHEL_8_2("RedHat", "RHEL", "8.2"),
/** Oracle Linux 8.1. */
ORACLE_LINUX_8_1("Oracle", "Oracle-Linux", "81");

private final String publisher;
private final String offer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,17 @@

/** The popular Azure Windows images. */
public enum KnownWindowsVirtualMachineImage {
/** Windows Server 2008 R2 SP1. */
WINDOWS_SERVER_2008_R2_SP1("MicrosoftWindowsServer", "WindowsServer", "2008-R2-SP1"),
/** Windows Server 2012 Data center. */
WINDOWS_SERVER_2012_DATACENTER("MicrosoftWindowsServer", "WindowsServer", "2012-Datacenter"),
/** Windows 10 2020 H1 Pro */
WINDOWS_DESKTOP_10_20H1_PRO("MicrosoftWindowsDesktop", "Windows-10", "20h1-pro"),
/** Windows Server 2019 Data center. */
WINDOWS_SERVER_2019_DATACENTER("MicrosoftWindowsServer", "WindowsServer", "2019-Datacenter"),
/** Windows Server 2019 Data center with containers. */
WINDOWS_SERVER_2019_DATACENTER_WITH_CONTAINERS(
"MicrosoftWindowsServer", "WindowsServer", "2019-Datacenter-with-Containers"),
/** Windows Server 2016 Data center. */
WINDOWS_SERVER_2016_DATACENTER("MicrosoftWindowsServer", "WindowsServer", "2016-Datacenter"),
/** Windows Server 2012 R2 Data center. */
WINDOWS_SERVER_2012_R2_DATACENTER("MicrosoftWindowsServer", "WindowsServer", "2012-R2-Datacenter"),
/**
* Windows Server 2016 technical preview with container.
*
* @deprecated for virtual machine use {@link VirtualMachine.DefinitionShared#withLatestWindowsImage(String
* publisher, String offer, String sku)} and for virtual machine scale set use {@link
* VirtualMachineScaleSet.DefinitionShared#withLatestWindowsImage(String publisher, String offer, String sku)}
* with publisher as "MicrosoftWindowsServer", offer as "WindowsServer" and sku as
* "2016-Datacenter-with-Containers")}.
*/
@Deprecated
WINDOWS_SERVER_2016_TECHNICAL_PREVIEW_WITH_CONTAINERS(
"MicrosoftWindowsServer", "WindowsServer", "2016-Technical-Preview-with-Containers"),
/**
* Windows Server 2016 technical preview.
*
* @deprecated for virtual machine use {@link VirtualMachine.DefinitionShared#withLatestWindowsImage(String
* publisher, String offer, String sku)} and for virtual machine scale set use {@link
* VirtualMachineScaleSet.DefinitionShared#withLatestWindowsImage(String publisher, String offer, String sku)}
* with publisher as "MicrosoftWindowsServer", offer as "WindowsServer" and sku as "2016-Datacenter")}.
*/
@Deprecated
WINDOWS_SERVER_TECHNICAL_PREVIEW("MicrosoftWindowsServer", "WindowsServer", "Windows-Server-Technical-Preview");
WINDOWS_SERVER_2012_R2_DATACENTER("MicrosoftWindowsServer", "WindowsServer", "2012-R2-Datacenter");

private final String publisher;
private final String offer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.azure.resourcemanager.resources.fluentcore.arm.AvailabilityZoneId;
import com.azure.resourcemanager.resources.fluentcore.arm.models.GroupableResource;
import com.azure.resourcemanager.resources.fluentcore.arm.models.Resource;
import com.azure.resourcemanager.resources.fluentcore.model.Accepted;
import com.azure.resourcemanager.resources.fluentcore.model.Appliable;
import com.azure.resourcemanager.resources.fluentcore.model.Creatable;
import com.azure.resourcemanager.resources.fluentcore.model.Refreshable;
Expand Down Expand Up @@ -1636,6 +1637,13 @@ interface WithCreate
DefinitionStages.WithSystemAssignedManagedServiceIdentity,
DefinitionStages.WithUserAssignedManagedServiceIdentity,
DefinitionStages.WithLicenseType {

/**
* Begins creating the virtual machine resource.
*
* @return the accepted create operation
*/
Accepted<VirtualMachine> beginCreate();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.azure.resourcemanager.resources.fluentcore.collection.SupportsCreating;
import com.azure.resourcemanager.resources.fluentcore.collection.SupportsDeletingById;
import com.azure.resourcemanager.resources.fluentcore.collection.SupportsListing;
import com.azure.resourcemanager.resources.fluentcore.model.Accepted;
import com.azure.resourcemanager.resources.fluentcore.model.HasInner;
import java.util.List;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -248,4 +249,13 @@ Mono<RunCommandResult> runShellScriptAsync(
* @return handle to the asynchronous execution
*/
Mono<RunCommandResult> runCommandAsync(String groupName, String name, RunCommandInput inputCommand);

/**
* Begins deleting a virtual machine from Azure, identifying it by its name and its resource group.
*
* @param resourceGroupName the resource group the resource is part of
* @param name the virtual machine name
* @return the accepted deleting operation
*/
Accepted<Void> beginDeleteByResourceGroup(String resourceGroupName, String name);
}
Loading