Skip to content

Commit

Permalink
Merge pull request #1045 from anuchandy/extensions-observable
Browse files Browse the repository at this point in the history
Virtual machine extensions
  • Loading branch information
anuchandy authored Sep 8, 2016
2 parents d52a28c + 2cea55c commit 1f5af9f
Show file tree
Hide file tree
Showing 41 changed files with 3,119 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.microsoft.azure.management.compute;


import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
* Defines values for ComputeRoles.
*/
public enum ComputeRoles {
/** Enum value PaaS. */
PAAS("PaaS"),

/** Enum value IaaS. */
IAAS("IaaS");

/** The actual serialized value for a ComputeRoles instance. */
private String value;

ComputeRoles(String value) {
this.value = value;
}

/**
* Parses a serialized value to a ComputeRoles instance.
*
* @param value the serialized value to parse.
* @return the parsed ComputeRoles object, or null if unable to parse.
*/
@JsonCreator
public static ComputeRoles fromString(String value) {
ComputeRoles[] items = ComputeRoles.values();
for (ComputeRoles item : items) {
if (item.toString().equalsIgnoreCase(value)) {
return item;
}
}
return null;
}

@JsonValue
@Override
public String toString() {
return this.value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.microsoft.azure.management.compute;

import com.microsoft.azure.management.resources.fluentcore.arm.models.ChildResource;
import com.microsoft.azure.management.resources.fluentcore.model.Refreshable;

/**
* Represents an external child resource.
*
* @param <T> fluent type of the external child resource
*/
public interface ExternalChildResource<T> extends ChildResource, Refreshable<T> {
/**
* @return the id of the external child resource
*/
String id();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.microsoft.azure.CloudException;
import com.microsoft.azure.PagedList;
import com.microsoft.azure.management.compute.implementation.VirtualMachineInner;
import com.microsoft.azure.management.compute.implementation.VirtualMachineExtensionInner;
import com.microsoft.azure.management.network.Network;
import com.microsoft.azure.management.network.NetworkInterface;
import com.microsoft.azure.management.network.PublicIpAddress;
Expand All @@ -19,6 +18,7 @@

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
* An immutable client-side representation of an Azure virtual machine.
Expand Down Expand Up @@ -192,9 +192,9 @@ public interface VirtualMachine extends
String licenseType();

/**
* @return the resources value
* @return the extensions attached to the Azure Virtual Machine
*/
List<VirtualMachineExtensionInner> resources();
Map<String, VirtualMachineExtension> extensions();

/**
* @return the plan value
Expand Down Expand Up @@ -812,6 +812,19 @@ interface WithSecondaryNetworkInterface {
WithCreate withExistingSecondaryNetworkInterface(NetworkInterface networkInterface);
}

/**
* The stage of the virtual machine definition allowing to specify extensions.
*/
interface WithExtension {
/**
* Specifies definition of an extension to be attached to the virtual machine.
*
* @param name the reference name for the extension
* @return the stage representing configuration for the extension
*/
VirtualMachineExtension.DefinitionStages.Blank<WithCreate> defineNewExtension(String name);
}

/**
* The stage of the definition which contains all the minimum required inputs for
* the resource to be created (via {@link WithCreate#create()}), but also allows
Expand All @@ -826,7 +839,8 @@ interface WithCreate extends
DefinitionStages.WithStorageAccount,
DefinitionStages.WithDataDisk,
DefinitionStages.WithAvailabilitySet,
DefinitionStages.WithSecondaryNetworkInterface {
DefinitionStages.WithSecondaryNetworkInterface,
DefinitionStages.WithExtension {
}
}

Expand Down Expand Up @@ -936,6 +950,37 @@ interface WithSecondaryNetworkInterface {
*/
Update withoutSecondaryNetworkInterface(String name);
}

/**
* The stage of the virtual machine definition allowing to specify extensions.
*/
interface WithExtension {
/**
* Specifies definition of an extension to be attached to the virtual machine.
*
* @param name the reference name for the extension
* @return the stage representing configuration for the extension
*/
VirtualMachineExtension
.UpdateDefinitionStages
.Blank<Update> defineNewExtension(String name);

/**
* Begins the description of an update of an existing extension of this virtual machine.
*
* @param name the reference name for the extension
* @return the stage representing updatable VM definition
*/
VirtualMachineExtension.Update updateExtension(String name);

/**
* Detaches an extension with the given name from the virtual machine.
*
* @param name the reference name for the extension to be removed/uninstalled
* @return the stage representing updatable VM definition
*/
Update withoutExtension(String name);
}
}

/**
Expand All @@ -948,7 +993,8 @@ interface Update extends
Appliable<VirtualMachine>,
Resource.UpdateWithTags<Update>,
UpdateStages.WithDataDisk,
UpdateStages.WithSecondaryNetworkInterface {
UpdateStages.WithSecondaryNetworkInterface,
UpdateStages.WithExtension {
/**
* Specifies the caching type for the Operating System disk.
*
Expand Down Expand Up @@ -981,4 +1027,4 @@ interface Update extends
*/
Update withSize(VirtualMachineSizeTypes size);
}
}
}
Loading

0 comments on commit 1f5af9f

Please sign in to comment.