* implemented definition flow and getters besides LogAnalytics, ContainerGroupIpAddressType, and OperationListResult. Passes tests

* before changing tests to work with subscription and making dns config dependent on network profile setting

* changed definition flow so dns config can only be defined once networkprofileId is defined

* finished implementation of container instance, updated tests and tests pass locally

* rerecorded container instance tests in azure tests

* fixed javadoc comments

* added Pary's comments and added testing for UserAssignedMSIs

* updated log analytics test setup

* moved log analytics to just live testing

* added private ip address container instance test to recordings

* Update private ip address test with random guid
This commit is contained in:
iscai-msft 2019-06-21 10:53:14 -07:00 коммит произвёл GitHub
Родитель 958cbe76f1
Коммит 9a70a2279f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
70 изменённых файлов: 5534 добавлений и 973 удалений

Просмотреть файл

@ -88,7 +88,7 @@
"dir": "azure-mgmt-containerinstance",
"source": "specification/containerinstance/resource-manager/readme.md",
"package": "com.microsoft.azure.management.containerinstance",
"args": "--payload-flattening-threshold=1 --tag=package-2018-06"
"args": "--payload-flattening-threshold=1 --tag=package-2018-10"
},
"containerregistry": {
"dir": "azure-mgmt-containerregistry",

Просмотреть файл

@ -96,6 +96,18 @@
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-mgmt-graph-rbac</artifactId>
<version>1.22.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-mgmt-msi</artifactId>
<version>1.22.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>

Просмотреть файл

@ -41,7 +41,7 @@ public class AzureFileVolume {
private String storageAccountKey;
/**
* Get the shareName value.
* Get the name of the Azure File share to be mounted as a volume.
*
* @return the shareName value
*/
@ -50,7 +50,7 @@ public class AzureFileVolume {
}
/**
* Set the shareName value.
* Set the name of the Azure File share to be mounted as a volume.
*
* @param shareName the shareName value to set
* @return the AzureFileVolume object itself.
@ -61,7 +61,7 @@ public class AzureFileVolume {
}
/**
* Get the readOnly value.
* Get the flag indicating whether the Azure File shared mounted as a volume is read-only.
*
* @return the readOnly value
*/
@ -70,7 +70,7 @@ public class AzureFileVolume {
}
/**
* Set the readOnly value.
* Set the flag indicating whether the Azure File shared mounted as a volume is read-only.
*
* @param readOnly the readOnly value to set
* @return the AzureFileVolume object itself.
@ -81,7 +81,7 @@ public class AzureFileVolume {
}
/**
* Get the storageAccountName value.
* Get the name of the storage account that contains the Azure File share.
*
* @return the storageAccountName value
*/
@ -90,7 +90,7 @@ public class AzureFileVolume {
}
/**
* Set the storageAccountName value.
* Set the name of the storage account that contains the Azure File share.
*
* @param storageAccountName the storageAccountName value to set
* @return the AzureFileVolume object itself.
@ -101,7 +101,7 @@ public class AzureFileVolume {
}
/**
* Get the storageAccountKey value.
* Get the storage account access key used to access the Azure File share.
*
* @return the storageAccountKey value
*/
@ -110,7 +110,7 @@ public class AzureFileVolume {
}
/**
* Set the storageAccountKey value.
* Set the storage account access key used to access the Azure File share.
*
* @param storageAccountKey the storageAccountKey value to set
* @return the AzureFileVolume object itself.

Просмотреть файл

@ -0,0 +1,95 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The cached image and OS type.
*/
public class CachedImages {
/**
* The resource Id of the cached image.
*/
@JsonProperty(value = "id")
private String id;
/**
* The OS type of the cached image.
*/
@JsonProperty(value = "osType", required = true)
private String osType;
/**
* The cached image name.
*/
@JsonProperty(value = "image", required = true)
private String image;
/**
* Get the resource Id of the cached image.
*
* @return the id value
*/
public String id() {
return this.id;
}
/**
* Set the resource Id of the cached image.
*
* @param id the id value to set
* @return the CachedImages object itself.
*/
public CachedImages withId(String id) {
this.id = id;
return this;
}
/**
* Get the OS type of the cached image.
*
* @return the osType value
*/
public String osType() {
return this.osType;
}
/**
* Set the OS type of the cached image.
*
* @param osType the osType value to set
* @return the CachedImages object itself.
*/
public CachedImages withOsType(String osType) {
this.osType = osType;
return this;
}
/**
* Get the cached image name.
*
* @return the image value
*/
public String image() {
return this.image;
}
/**
* Set the cached image name.
*
* @param image the image value to set
* @return the CachedImages object itself.
*/
public CachedImages withImage(String image) {
this.image = image;
return this;
}
}

Просмотреть файл

@ -0,0 +1,107 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The regional capabilities.
*/
public class Capabilities {
/**
* The resource type that this capability describes.
*/
@JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY)
private String resourceType;
/**
* The OS type that this capability describes.
*/
@JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY)
private String osType;
/**
* The resource location.
*/
@JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY)
private String location;
/**
* The ip address type that this capability describes.
*/
@JsonProperty(value = "ipAddressType", access = JsonProperty.Access.WRITE_ONLY)
private String ipAddressType;
/**
* The GPU sku that this capability describes.
*/
@JsonProperty(value = "gpu", access = JsonProperty.Access.WRITE_ONLY)
private String gpu;
/**
* The supported capabilities.
*/
@JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY)
private CapabilitiesCapabilities capabilities;
/**
* Get the resource type that this capability describes.
*
* @return the resourceType value
*/
public String resourceType() {
return this.resourceType;
}
/**
* Get the OS type that this capability describes.
*
* @return the osType value
*/
public String osType() {
return this.osType;
}
/**
* Get the resource location.
*
* @return the location value
*/
public String location() {
return this.location;
}
/**
* Get the ip address type that this capability describes.
*
* @return the ipAddressType value
*/
public String ipAddressType() {
return this.ipAddressType;
}
/**
* Get the GPU sku that this capability describes.
*
* @return the gpu value
*/
public String gpu() {
return this.gpu;
}
/**
* Get the supported capabilities.
*
* @return the capabilities value
*/
public CapabilitiesCapabilities capabilities() {
return this.capabilities;
}
}

Просмотреть файл

@ -0,0 +1,62 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The supported capabilities.
*/
public class CapabilitiesCapabilities {
/**
* The maximum allowed memory request in GB.
*/
@JsonProperty(value = "maxMemoryInGB", access = JsonProperty.Access.WRITE_ONLY)
private Double maxMemoryInGB;
/**
* The maximum allowed CPU request in cores.
*/
@JsonProperty(value = "maxCpu", access = JsonProperty.Access.WRITE_ONLY)
private Double maxCpu;
/**
* The maximum allowed GPU count.
*/
@JsonProperty(value = "maxGpuCount", access = JsonProperty.Access.WRITE_ONLY)
private Double maxGpuCount;
/**
* Get the maximum allowed memory request in GB.
*
* @return the maxMemoryInGB value
*/
public Double maxMemoryInGB() {
return this.maxMemoryInGB;
}
/**
* Get the maximum allowed CPU request in cores.
*
* @return the maxCpu value
*/
public Double maxCpu() {
return this.maxCpu;
}
/**
* Get the maximum allowed GPU count.
*
* @return the maxGpuCount value
*/
public Double maxGpuCount() {
return this.maxGpuCount;
}
}

Просмотреть файл

@ -2,13 +2,12 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.serializer.JsonFlatten;
@ -78,7 +77,7 @@ public class Container {
private ContainerProbe readinessProbe;
/**
* Get the name value.
* Get the user-provided name of the container instance.
*
* @return the name value
*/
@ -87,7 +86,7 @@ public class Container {
}
/**
* Set the name value.
* Set the user-provided name of the container instance.
*
* @param name the name value to set
* @return the Container object itself.
@ -98,7 +97,7 @@ public class Container {
}
/**
* Get the image value.
* Get the name of the image used to create the container instance.
*
* @return the image value
*/
@ -107,7 +106,7 @@ public class Container {
}
/**
* Set the image value.
* Set the name of the image used to create the container instance.
*
* @param image the image value to set
* @return the Container object itself.
@ -118,7 +117,7 @@ public class Container {
}
/**
* Get the command value.
* Get the commands to execute within the container instance in exec form.
*
* @return the command value
*/
@ -127,7 +126,7 @@ public class Container {
}
/**
* Set the command value.
* Set the commands to execute within the container instance in exec form.
*
* @param command the command value to set
* @return the Container object itself.
@ -138,7 +137,7 @@ public class Container {
}
/**
* Get the ports value.
* Get the exposed ports on the container instance.
*
* @return the ports value
*/
@ -147,7 +146,7 @@ public class Container {
}
/**
* Set the ports value.
* Set the exposed ports on the container instance.
*
* @param ports the ports value to set
* @return the Container object itself.
@ -158,7 +157,7 @@ public class Container {
}
/**
* Get the environmentVariables value.
* Get the environment variables to set in the container instance.
*
* @return the environmentVariables value
*/
@ -167,7 +166,7 @@ public class Container {
}
/**
* Set the environmentVariables value.
* Set the environment variables to set in the container instance.
*
* @param environmentVariables the environmentVariables value to set
* @return the Container object itself.
@ -178,7 +177,7 @@ public class Container {
}
/**
* Get the instanceView value.
* Get the instance view of the container instance. Only valid in response.
*
* @return the instanceView value
*/
@ -187,7 +186,7 @@ public class Container {
}
/**
* Get the resources value.
* Get the resource requirements of the container instance.
*
* @return the resources value
*/
@ -196,7 +195,7 @@ public class Container {
}
/**
* Set the resources value.
* Set the resource requirements of the container instance.
*
* @param resources the resources value to set
* @return the Container object itself.
@ -207,7 +206,7 @@ public class Container {
}
/**
* Get the volumeMounts value.
* Get the volume mounts available to the container instance.
*
* @return the volumeMounts value
*/
@ -216,7 +215,7 @@ public class Container {
}
/**
* Set the volumeMounts value.
* Set the volume mounts available to the container instance.
*
* @param volumeMounts the volumeMounts value to set
* @return the Container object itself.
@ -227,7 +226,7 @@ public class Container {
}
/**
* Get the livenessProbe value.
* Get the liveness probe.
*
* @return the livenessProbe value
*/
@ -236,7 +235,7 @@ public class Container {
}
/**
* Set the livenessProbe value.
* Set the liveness probe.
*
* @param livenessProbe the livenessProbe value to set
* @return the Container object itself.
@ -247,7 +246,7 @@ public class Container {
}
/**
* Get the readinessProbe value.
* Get the readiness probe.
*
* @return the readinessProbe value
*/
@ -256,7 +255,7 @@ public class Container {
}
/**
* Set the readinessProbe value.
* Set the readiness probe.
*
* @param readinessProbe the readinessProbe value to set
* @return the Container object itself.

Просмотреть файл

@ -22,7 +22,7 @@ public class ContainerExec {
private List<String> command;
/**
* Get the command value.
* Get the commands to execute within the container.
*
* @return the command value
*/
@ -31,7 +31,7 @@ public class ContainerExec {
}
/**
* Set the command value.
* Set the commands to execute within the container.
*
* @param command the command value to set
* @return the ContainerExec object itself.

Просмотреть файл

@ -6,15 +6,14 @@
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance.implementation;
package com.microsoft.azure.management.containerinstance;
import com.microsoft.azure.management.containerinstance.ContainerExecRequestTerminalSize;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The container exec request.
*/
public class ContainerExecRequestInner {
public class ContainerExecRequest {
/**
* The command to be executed.
*/
@ -28,7 +27,7 @@ public class ContainerExecRequestInner {
private ContainerExecRequestTerminalSize terminalSize;
/**
* Get the command value.
* Get the command to be executed.
*
* @return the command value
*/
@ -37,18 +36,18 @@ public class ContainerExecRequestInner {
}
/**
* Set the command value.
* Set the command to be executed.
*
* @param command the command value to set
* @return the ContainerExecRequestInner object itself.
* @return the ContainerExecRequest object itself.
*/
public ContainerExecRequestInner withCommand(String command) {
public ContainerExecRequest withCommand(String command) {
this.command = command;
return this;
}
/**
* Get the terminalSize value.
* Get the size of the terminal.
*
* @return the terminalSize value
*/
@ -57,12 +56,12 @@ public class ContainerExecRequestInner {
}
/**
* Set the terminalSize value.
* Set the size of the terminal.
*
* @param terminalSize the terminalSize value to set
* @return the ContainerExecRequestInner object itself.
* @return the ContainerExecRequest object itself.
*/
public ContainerExecRequestInner withTerminalSize(ContainerExecRequestTerminalSize terminalSize) {
public ContainerExecRequest withTerminalSize(ContainerExecRequestTerminalSize terminalSize) {
this.terminalSize = terminalSize;
return this;
}

Просмотреть файл

@ -27,7 +27,7 @@ public class ContainerExecRequestTerminalSize {
private Integer cols;
/**
* Get the rows value.
* Get the row size of the terminal.
*
* @return the rows value
*/
@ -36,7 +36,7 @@ public class ContainerExecRequestTerminalSize {
}
/**
* Set the rows value.
* Set the row size of the terminal.
*
* @param rows the rows value to set
* @return the ContainerExecRequestTerminalSize object itself.
@ -47,7 +47,7 @@ public class ContainerExecRequestTerminalSize {
}
/**
* Get the cols value.
* Get the column size of the terminal.
*
* @return the cols value
*/
@ -56,7 +56,7 @@ public class ContainerExecRequestTerminalSize {
}
/**
* Set the cols value.
* Set the column size of the terminal.
*
* @param cols the cols value to set
* @return the ContainerExecRequestTerminalSize object itself.

Просмотреть файл

@ -10,6 +10,8 @@ import com.microsoft.azure.management.apigeneration.Fluent;
import com.microsoft.azure.management.apigeneration.Method;
import com.microsoft.azure.management.containerinstance.implementation.ContainerGroupInner;
import com.microsoft.azure.management.containerinstance.implementation.ContainerInstanceManager;
import com.microsoft.azure.management.graphrbac.BuiltInRole;
import com.microsoft.azure.management.msi.Identity;
import com.microsoft.azure.management.resources.fluentcore.arm.models.GroupableResource;
import com.microsoft.azure.management.resources.fluentcore.arm.models.Resource;
import com.microsoft.azure.management.resources.fluentcore.model.Appliable;
@ -21,6 +23,7 @@ import rx.Completable;
import rx.Observable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -28,11 +31,11 @@ import java.util.Set;
* An immutable client-side representation of an Azure Container Group.
*/
@Fluent
@Beta(Beta.SinceVersion.V1_3_0)
@Beta(Beta.SinceVersion.V1_23_0)
public interface ContainerGroup extends
GroupableResource<ContainerInstanceManager, ContainerGroupInner>,
Refreshable<ContainerGroup>,
Updatable<ContainerGroup.Update> {
GroupableResource<ContainerInstanceManager, ContainerGroupInner>,
Refreshable<ContainerGroup>,
Updatable<ContainerGroup.Update> {
/***********************************************************
* Getters
@ -98,6 +101,11 @@ public interface ContainerGroup extends
*/
boolean isIPAddressPublic();
/**
* @return true if IP address is private
*/
boolean isIPAddressPrivate();
/**
* @return the base level OS type required by the containers in the group
*/
@ -119,6 +127,55 @@ public interface ContainerGroup extends
@Beta(Beta.SinceVersion.V1_5_0)
Set<Event> events();
/**
* @return the DNS configuration for the container group
*/
@Beta(Beta.SinceVersion.V1_23_0)
DnsConfiguration dnsConfig();
/**
* @return the id of the network profile for the container group
*/
@Beta(Beta.SinceVersion.V1_23_0)
String networkProfileId();
/**
* @return whether managed service identity is enabled for the container group
*/
@Beta(Beta.SinceVersion.V1_23_0)
boolean isManagedServiceIdentityEnabled();
/**
* @return the tenant id of the system assigned managed service identity. Null if managed
* service identity is not configured.
*/
@Beta(Beta.SinceVersion.V1_23_0)
String systemAssignedManagedServiceIdentityTenantId();
/**
* @return the principal id of the system assigned managed service identity. Null if managed
* service identity is not configured.
*/
@Beta(Beta.SinceVersion.V1_23_0)
String systemAssignedManagedServiceIdentityPrincipalId();
/**
* @return whether managed service identity is system assigned, user assigned, both, or neither
*/
@Beta(Beta.SinceVersion.V1_23_0)
ResourceIdentityType managedServiceIdentityType();
/**
* @return the ids of the user assigned managed service identities. Returns an empty set if no
* MSIs are set.
*/
@Beta(Beta.SinceVersion.V1_23_0)
Set<String> userAssignedManagedServiceIdentityIds();
/**
* @return the log analytics information of the container group.
*/
LogAnalytics logAnalytics();
/***********************************************************
* Actions
@ -225,15 +282,18 @@ public interface ContainerGroup extends
* Starts the exec command for a specific container instance within the current group asynchronously.
*/
interface Definition extends
DefinitionStages.Blank,
DefinitionStages.WithGroup,
DefinitionStages.WithOsType,
DefinitionStages.WithPublicOrPrivateImageRegistry,
DefinitionStages.WithPrivateImageRegistryOrVolume,
DefinitionStages.WithVolume,
DefinitionStages.WithFirstContainerInstance,
DefinitionStages.WithNextContainerInstance,
DefinitionStages.WithCreate {
DefinitionStages.Blank,
DefinitionStages.WithGroup,
DefinitionStages.WithOsType,
DefinitionStages.WithPublicOrPrivateImageRegistry,
DefinitionStages.WithPrivateImageRegistryOrVolume,
DefinitionStages.WithVolume,
DefinitionStages.WithFirstContainerInstance,
DefinitionStages.WithSystemAssignedManagedServiceIdentity,
DefinitionStages.WithSystemAssignedIdentityBasedAccessOrCreate,
DefinitionStages.WithNextContainerInstance,
DefinitionStages.DnsConfigFork,
DefinitionStages.WithCreate {
}
/**
@ -244,14 +304,14 @@ public interface ContainerGroup extends
* The first stage of the container group definition.
*/
interface Blank
extends GroupableResource.DefinitionWithRegion<WithGroup> {
extends GroupableResource.DefinitionWithRegion<WithGroup> {
}
/**
* The stage of the container group definition allowing to specify the resource group.
*/
interface WithGroup
extends GroupableResource.DefinitionStages.WithGroup<DefinitionStages.WithOsType> {
extends GroupableResource.DefinitionStages.WithGroup<DefinitionStages.WithOsType> {
}
/**
@ -505,7 +565,7 @@ public interface ContainerGroup extends
* @param <ParentT> the stage of the parent definition to return to after attaching this definition
*/
interface WithVolumeAttach<ParentT> extends
Attachable.InDefinition<ParentT> {
Attachable.InDefinition<ParentT> {
}
/**
@ -600,8 +660,8 @@ public interface ContainerGroup extends
* @param <ParentT> the stage of the parent definition to return to after attaching this definition
*/
interface WithOrWithoutPorts<ParentT> extends
WithPorts<ParentT>,
WithoutPorts<ParentT> {
WithPorts<ParentT>,
WithoutPorts<ParentT> {
}
/**
@ -624,7 +684,7 @@ public interface ContainerGroup extends
* @param <ParentT> the stage of the parent definition to return to after attaching this definition
*/
interface WithPortsOrContainerInstanceAttach<ParentT> extends
WithPorts<ParentT>,
WithPorts<ParentT>,
WithContainerInstanceAttach<ParentT> {
}
@ -754,6 +814,10 @@ public interface ContainerGroup extends
WithContainerInstanceAttach<ParentT> withCpuCoreCount(double cpuCoreCount);
}
interface WithGpuResource<ParentT> {
WithContainerInstanceAttach<ParentT> withGpuResource(int gpuCoreCount, GpuSku gpuSku);
}
/**
* The stage of the container instance definition allowing to specify the memory size in GB.
* <p>
@ -908,12 +972,13 @@ public interface ContainerGroup extends
* @param <ParentT> the stage of the parent definition to return to after attaching this definition
*/
interface WithContainerInstanceAttach<ParentT> extends
WithCpuCoreCount<ParentT>,
WithMemorySize<ParentT>,
WithStartingCommandLine<ParentT>,
WithEnvironmentVariables<ParentT>,
WithVolumeMountSetting<ParentT>,
Attachable.InDefinition<ParentT> {
WithCpuCoreCount<ParentT>,
WithGpuResource<ParentT>,
WithMemorySize<ParentT>,
WithStartingCommandLine<ParentT>,
WithEnvironmentVariables<ParentT>,
WithVolumeMountSetting<ParentT>,
Attachable.InDefinition<ParentT> {
}
/**
@ -928,6 +993,86 @@ public interface ContainerGroup extends
}
}
/**
* The stage of the container instance definition allowing to specify having system assigned managed service identity.
*/
interface WithSystemAssignedManagedServiceIdentity {
/**
* Specifies a system assigned managed service identity for the container group.
*
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedManagedServiceIdentity();
}
/**
* The stage of the container instance definition allowing to specify system assigned managed service identity with specific
* role based access.
*/
interface WithSystemAssignedIdentityBasedAccessOrCreate extends WithCreate {
/**
* Specifies a system assigned managed service identity with access to a specific resource with a specified role.
*
* @param resourceId the id of the resource you are setting up access to
* @param role access role to be assigned to the identity
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedIdentityBasedAccessTo(String resourceId, BuiltInRole role);
/**
* Specifies a system assigned managed service identity with access to the current resource group and with the specified role.
*
* @param role access role to be assigned to the identity
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(BuiltInRole role);
/**
* Specifies a system assigned managed service identity with access to a specific resource with a specified role from the id.
*
* @param resourceId the id of the resource you are setting up access to
* @param roleDefinitionId id of the access role to be assigned to the identity
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedIdentityBasedAccessTo(String resourceId, String roleDefinitionId);
/**
* Specifies a system assigned managed service identity with access to the current resource group and with the specified role from the id.
*
* @param roleDefinitionId id of the access role to be assigned to the identity
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(String roleDefinitionId);
}
/**
* The stage of the container instance definition allowing to specify user assigned managed service identity.
*/
interface WithUserAssignedManagedServiceIdentity {
/**
* Specifies the definition of a not-yet-created user assigned identity to be associated with the virtual machine.
*
* @param creatableIdentity a creatable identity definition
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithCreate withNewUserAssignedManagedServiceIdentity(Creatable<Identity> creatableIdentity);
/**
* Specifies an existing user assigned identity to be associate with the container group.
*
* @param identity the identity
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithCreate withExistingUserAssignedManagedServiceIdentity(Identity identity);
}
/**
* The stage of the container group definition allowing to specify the container group restart policy.
*/
@ -955,15 +1100,91 @@ public interface ContainerGroup extends
WithCreate withDnsPrefix(String dnsPrefix);
}
/**
* The stage of the container group definition allowing to specify the network profile id.
*/
interface WithNetworkProfile {
/**
* Specifies the network profile information for a container group.
*
* @param subscriptionId the ID of the subscription of the network profile
* @param resourceGroupName the name of the resource group of the network profile
* @param networkProfileName the name of the network profile
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
DnsConfigFork withNetworkProfileId(String subscriptionId, String resourceGroupName, String networkProfileName);
}
interface DnsConfigFork extends WithDnsConfig, WithCreate {
}
/**
* The stage of the container group definition allowing to specify the DNS configuration of the container group.
*/
interface WithDnsConfig {
/**
* Specifies the DNS servers for the container group.
*
* @param dnsServerNames the names of the DNS servers
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithCreate withDnsServerNames(List<String> dnsServerNames);
/**
* Specifies the DNS configuration for the container group.
*
* @param dnsServerNames the names of the DNS servers for the container group
* @param dnsSearchDomains the DNS search domains for hostname lookup in the container group
* @param dnsOptions the DNS options for the container group
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithCreate withDnsConfiguration(List<String> dnsServerNames, String dnsSearchDomains, String dnsOptions);
}
/**
* The stage of the container group definition allowing to specify the log analytics platform for the container group.
*/
interface WithLogAnalytics {
/**
* Specifies the log analytics workspace to use for the container group.
*
* @param workspaceId the id of the previously-created log analytics workspace
* @param workspaceKey the key of the previously-created log analytics workspace
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithCreate withLogAnalytics(String workspaceId, String workspaceKey);
/**
* Specifies the log analytics workspace with optional add-ons for the container group.
*
* @param workspaceId the id of the previously-created log analytics workspace
* @param workspaceKey the key of the previously-created log analytics workspace
* @param logType the log type to be used. Possible values include: 'ContainerInsights', 'ContainerInstanceLogs'.
* @param metadata the metadata for log analytics
* @return the next stage of the definition
*/
@Beta(Beta.SinceVersion.V1_23_0)
WithCreate withLogAnalytics(String workspaceId, String workspaceKey, LogAnalyticsLogType logType, Map<String, String> metadata);
}
/**
* 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 for any other optional settings to be specified.
*/
interface WithCreate extends
WithRestartPolicy,
WithDnsPrefix,
Creatable<ContainerGroup>,
Resource.DefinitionWithTags<WithCreate> {
WithRestartPolicy,
WithSystemAssignedManagedServiceIdentity,
WithUserAssignedManagedServiceIdentity,
WithDnsPrefix,
WithNetworkProfile,
WithLogAnalytics,
Creatable<ContainerGroup>,
Resource.DefinitionWithTags<WithCreate> {
}
}
@ -971,8 +1192,8 @@ public interface ContainerGroup extends
* The template for an update operation, containing all the settings that can be modified.
*/
interface Update extends
Resource.UpdateWithTags<Update>,
Appliable<ContainerGroup> {
Resource.UpdateWithTags<Update>,
Appliable<ContainerGroup> {
}
}

Просмотреть файл

@ -21,7 +21,7 @@ public class ContainerGroupDiagnostics {
private LogAnalytics logAnalytics;
/**
* Get the logAnalytics value.
* Get container group log analytics information.
*
* @return the logAnalytics value
*/
@ -30,7 +30,7 @@ public class ContainerGroupDiagnostics {
}
/**
* Set the logAnalytics value.
* Set container group log analytics information.
*
* @param logAnalytics the logAnalytics value to set
* @return the ContainerGroupDiagnostics object itself.

Просмотреть файл

@ -0,0 +1,110 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Identity for the container group.
*/
public class ContainerGroupIdentity {
/**
* The principal id of the container group identity. This property will
* only be provided for a system assigned identity.
*/
@JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY)
private String principalId;
/**
* The tenant id associated with the container group. This property will
* only be provided for a system assigned identity.
*/
@JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY)
private String tenantId;
/**
* The type of identity used for the container group. The type
* 'SystemAssigned, UserAssigned' includes both an implicitly created
* identity and a set of user assigned identities. The type 'None' will
* remove any identities from the container group. Possible values include:
* 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned',
* 'None'.
*/
@JsonProperty(value = "type")
private ResourceIdentityType type;
/**
* The list of user identities associated with the container group. The
* user identity dictionary key references will be ARM resource ids in the
* form:
* '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
*/
@JsonProperty(value = "userAssignedIdentities")
private Map<String, ContainerGroupIdentityUserAssignedIdentitiesValue> userAssignedIdentities;
/**
* Get the principal id of the container group identity. This property will only be provided for a system assigned identity.
*
* @return the principalId value
*/
public String principalId() {
return this.principalId;
}
/**
* Get the tenant id associated with the container group. This property will only be provided for a system assigned identity.
*
* @return the tenantId value
*/
public String tenantId() {
return this.tenantId;
}
/**
* Get the type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None'.
*
* @return the type value
*/
public ResourceIdentityType type() {
return this.type;
}
/**
* Set the type of identity used for the container group. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the container group. Possible values include: 'SystemAssigned', 'UserAssigned', 'SystemAssigned, UserAssigned', 'None'.
*
* @param type the type value to set
* @return the ContainerGroupIdentity object itself.
*/
public ContainerGroupIdentity withType(ResourceIdentityType type) {
this.type = type;
return this;
}
/**
* Get the list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
*
* @return the userAssignedIdentities value
*/
public Map<String, ContainerGroupIdentityUserAssignedIdentitiesValue> userAssignedIdentities() {
return this.userAssignedIdentities;
}
/**
* Set the list of user identities associated with the container group. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
*
* @param userAssignedIdentities the userAssignedIdentities value to set
* @return the ContainerGroupIdentity object itself.
*/
public ContainerGroupIdentity withUserAssignedIdentities(Map<String, ContainerGroupIdentityUserAssignedIdentitiesValue> userAssignedIdentities) {
this.userAssignedIdentities = userAssignedIdentities;
return this;
}
}

Просмотреть файл

@ -0,0 +1,47 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The ContainerGroupIdentityUserAssignedIdentitiesValue model.
*/
public class ContainerGroupIdentityUserAssignedIdentitiesValue {
/**
* The principal id of user assigned identity.
*/
@JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY)
private String principalId;
/**
* The client id of user assigned identity.
*/
@JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY)
private String clientId;
/**
* Get the principal id of user assigned identity.
*
* @return the principalId value
*/
public String principalId() {
return this.principalId;
}
/**
* Get the client id of user assigned identity.
*
* @return the clientId value
*/
public String clientId() {
return this.clientId;
}
}

Просмотреть файл

@ -0,0 +1,41 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.microsoft.rest.ExpandableStringEnum;
/**
* Defines values for ContainerGroupIpAddressType.
*/
public final class ContainerGroupIpAddressType extends ExpandableStringEnum<ContainerGroupIpAddressType> {
/** Static value Public for ContainerGroupIpAddressType. */
public static final ContainerGroupIpAddressType PUBLIC = fromString("Public");
/** Static value Private for ContainerGroupIpAddressType. */
public static final ContainerGroupIpAddressType PRIVATE = fromString("Private");
/**
* Creates or finds a ContainerGroupIpAddressType from its string representation.
* @param name a name to look for
* @return the corresponding ContainerGroupIpAddressType
*/
@JsonCreator
public static ContainerGroupIpAddressType fromString(String name) {
return fromString(name, ContainerGroupIpAddressType.class);
}
/**
* @return known ContainerGroupIpAddressType values
*/
public static Collection<ContainerGroupIpAddressType> values() {
return values(ContainerGroupIpAddressType.class);
}
}

Просмотреть файл

@ -0,0 +1,43 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Container group network profile information.
*/
public class ContainerGroupNetworkProfile {
/**
* The identifier for a network profile.
*/
@JsonProperty(value = "id", required = true)
private String id;
/**
* Get the identifier for a network profile.
*
* @return the id value
*/
public String id() {
return this.id;
}
/**
* Set the identifier for a network profile.
*
* @param id the id value to set
* @return the ContainerGroupNetworkProfile object itself.
*/
public ContainerGroupNetworkProfile withId(String id) {
this.id = id;
return this;
}
}

Просмотреть файл

@ -28,7 +28,7 @@ public class ContainerGroupPropertiesInstanceView {
private String state;
/**
* Get the events value.
* Get the events of this container group.
*
* @return the events value
*/
@ -37,7 +37,7 @@ public class ContainerGroupPropertiesInstanceView {
}
/**
* Get the state value.
* Get the state of the container group. Only valid in response.
*
* @return the state value
*/

Просмотреть файл

@ -20,27 +20,29 @@ import com.microsoft.azure.management.resources.fluentcore.collection.SupportsCr
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsDeletingById;
import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing;
import com.microsoft.azure.management.resources.fluentcore.model.HasInner;
import rx.Completable;
import rx.Observable;
import java.util.List;
import java.util.Set;
/**
* Entry point to the container instance management API.
*/
@Fluent()
@Beta(Beta.SinceVersion.V1_3_0)
@Beta(Beta.SinceVersion.V1_23_0)
public interface ContainerGroups extends
SupportsCreating<ContainerGroup.DefinitionStages.Blank>,
HasManager<ContainerInstanceManager>,
HasInner<ContainerGroupsInner>,
SupportsBatchCreation<ContainerGroup>,
SupportsGettingByResourceGroup<ContainerGroup>,
SupportsGettingById<ContainerGroup>,
SupportsDeletingByResourceGroup,
SupportsDeletingById,
SupportsBatchDeletion,
SupportsListingByResourceGroup<ContainerGroup>,
SupportsListing<ContainerGroup> {
SupportsCreating<ContainerGroup.DefinitionStages.Blank>,
HasManager<ContainerInstanceManager>,
HasInner<ContainerGroupsInner>,
SupportsBatchCreation<ContainerGroup>,
SupportsGettingByResourceGroup<ContainerGroup>,
SupportsGettingById<ContainerGroup>,
SupportsDeletingByResourceGroup,
SupportsDeletingById,
SupportsBatchDeletion,
SupportsListingByResourceGroup<ContainerGroup>,
SupportsListing<ContainerGroup> {
/**
* Get the log content for the specified container instance within a container group.
@ -105,6 +107,61 @@ public interface ContainerGroups extends
*
* @return a representation of the future computation of this call
*/
@Beta(Beta.SinceVersion.V1_5_0)
@Beta(Beta.SinceVersion.V1_23_0)
Observable<Set<Operation>> listOperationsAsync();
/**
* Lists cached images for a subscription in a region.
*
* @param location the identifier for the physical azure location.
* @return all cached images from the specified location
*/
@Beta(Beta.SinceVersion.V1_23_0)
List<CachedImages> listCachedImages(String location);
/**
* Lists cached images for a subscription in a region.
*
* @param location the identifier for the physical azure location.
* @return a representation of the future computation of this call
*/
@Beta(Beta.SinceVersion.V1_23_0)
Observable<CachedImages> listCachedImagesAsync(String location);
/**
* Lists the capabilities of a location.
*
* @param location the identifier for the physical azure location
* @return a list of all of the capabilities of the given location
*/
@Beta(Beta.SinceVersion.V1_23_0)
List<Capabilities> listCapabilities(String location);
/**
* Lists the capabilities of a location.
*
* @param location the identifier for the physical azure location
* @return a representation of the future computation of this call
*/
@Beta(Beta.SinceVersion.V1_23_0)
Observable<Capabilities> listCapabilitiesAsync(String location);
/**
* Starts all containers in a container group.
*
* @param resourceGroupName the name of the resource group of the container group
* @param containerGroupName the name of the container group
*/
@Beta(Beta.SinceVersion.V1_23_0)
void start(String resourceGroupName, String containerGroupName);
/**
* Starts all containers in a container group.
*
* @param resourceGroupName the name of the resource group of the container group
* @param containerGroupName the name of the container group
* @return a representation of the future computation of this call
*/
@Beta(Beta.SinceVersion.V1_23_0)
Completable startAsync(String resourceGroupName, String containerGroupName);
}

Просмотреть файл

@ -33,7 +33,7 @@ public class ContainerHttpGet {
private String scheme;
/**
* Get the path value.
* Get the path to probe.
*
* @return the path value
*/
@ -42,7 +42,7 @@ public class ContainerHttpGet {
}
/**
* Set the path value.
* Set the path to probe.
*
* @param path the path value to set
* @return the ContainerHttpGet object itself.
@ -53,7 +53,7 @@ public class ContainerHttpGet {
}
/**
* Get the port value.
* Get the port number to probe.
*
* @return the port value
*/
@ -62,7 +62,7 @@ public class ContainerHttpGet {
}
/**
* Set the port value.
* Set the port number to probe.
*
* @param port the port value to set
* @return the ContainerHttpGet object itself.
@ -73,7 +73,7 @@ public class ContainerHttpGet {
}
/**
* Get the scheme value.
* Get the scheme. Possible values include: 'http', 'https'.
*
* @return the scheme value
*/
@ -82,7 +82,7 @@ public class ContainerHttpGet {
}
/**
* Set the scheme value.
* Set the scheme. Possible values include: 'http', 'https'.
*
* @param scheme the scheme value to set
* @return the ContainerHttpGet object itself.

Просмотреть файл

@ -28,7 +28,7 @@ public class ContainerPort {
private int port;
/**
* Get the protocol value.
* Get the protocol associated with the port. Possible values include: 'TCP', 'UDP'.
*
* @return the protocol value
*/
@ -37,7 +37,7 @@ public class ContainerPort {
}
/**
* Set the protocol value.
* Set the protocol associated with the port. Possible values include: 'TCP', 'UDP'.
*
* @param protocol the protocol value to set
* @return the ContainerPort object itself.
@ -48,7 +48,7 @@ public class ContainerPort {
}
/**
* Get the port value.
* Get the port number exposed within the container group.
*
* @return the port value
*/
@ -57,7 +57,7 @@ public class ContainerPort {
}
/**
* Set the port value.
* Set the port number exposed within the container group.
*
* @param port the port value to set
* @return the ContainerPort object itself.

Просмотреть файл

@ -57,7 +57,7 @@ public class ContainerProbe {
private Integer timeoutSeconds;
/**
* Get the exec value.
* Get the execution command to probe.
*
* @return the exec value
*/
@ -66,7 +66,7 @@ public class ContainerProbe {
}
/**
* Set the exec value.
* Set the execution command to probe.
*
* @param exec the exec value to set
* @return the ContainerProbe object itself.
@ -77,7 +77,7 @@ public class ContainerProbe {
}
/**
* Get the httpGet value.
* Get the Http Get settings to probe.
*
* @return the httpGet value
*/
@ -86,7 +86,7 @@ public class ContainerProbe {
}
/**
* Set the httpGet value.
* Set the Http Get settings to probe.
*
* @param httpGet the httpGet value to set
* @return the ContainerProbe object itself.
@ -97,7 +97,7 @@ public class ContainerProbe {
}
/**
* Get the initialDelaySeconds value.
* Get the initial delay seconds.
*
* @return the initialDelaySeconds value
*/
@ -106,7 +106,7 @@ public class ContainerProbe {
}
/**
* Set the initialDelaySeconds value.
* Set the initial delay seconds.
*
* @param initialDelaySeconds the initialDelaySeconds value to set
* @return the ContainerProbe object itself.
@ -117,7 +117,7 @@ public class ContainerProbe {
}
/**
* Get the periodSeconds value.
* Get the period seconds.
*
* @return the periodSeconds value
*/
@ -126,7 +126,7 @@ public class ContainerProbe {
}
/**
* Set the periodSeconds value.
* Set the period seconds.
*
* @param periodSeconds the periodSeconds value to set
* @return the ContainerProbe object itself.
@ -137,7 +137,7 @@ public class ContainerProbe {
}
/**
* Get the failureThreshold value.
* Get the failure threshold.
*
* @return the failureThreshold value
*/
@ -146,7 +146,7 @@ public class ContainerProbe {
}
/**
* Set the failureThreshold value.
* Set the failure threshold.
*
* @param failureThreshold the failureThreshold value to set
* @return the ContainerProbe object itself.
@ -157,7 +157,7 @@ public class ContainerProbe {
}
/**
* Get the successThreshold value.
* Get the success threshold.
*
* @return the successThreshold value
*/
@ -166,7 +166,7 @@ public class ContainerProbe {
}
/**
* Set the successThreshold value.
* Set the success threshold.
*
* @param successThreshold the successThreshold value to set
* @return the ContainerProbe object itself.
@ -177,7 +177,7 @@ public class ContainerProbe {
}
/**
* Get the timeoutSeconds value.
* Get the timeout seconds.
*
* @return the timeoutSeconds value
*/
@ -186,7 +186,7 @@ public class ContainerProbe {
}
/**
* Set the timeoutSeconds value.
* Set the timeout seconds.
*
* @param timeoutSeconds the timeoutSeconds value to set
* @return the ContainerProbe object itself.

Просмотреть файл

@ -40,7 +40,7 @@ public class ContainerPropertiesInstanceView {
private List<Event> events;
/**
* Get the restartCount value.
* Get the number of times that the container instance has been restarted.
*
* @return the restartCount value
*/
@ -49,7 +49,7 @@ public class ContainerPropertiesInstanceView {
}
/**
* Get the currentState value.
* Get current container instance state.
*
* @return the currentState value
*/
@ -58,7 +58,7 @@ public class ContainerPropertiesInstanceView {
}
/**
* Get the previousState value.
* Get previous container instance state.
*
* @return the previousState value
*/
@ -67,7 +67,7 @@ public class ContainerPropertiesInstanceView {
}
/**
* Get the events value.
* Get the events of the container instance.
*
* @return the events value
*/

Просмотреть файл

@ -47,7 +47,7 @@ public class ContainerState {
private String detailStatus;
/**
* Get the state value.
* Get the state of the container instance.
*
* @return the state value
*/
@ -56,7 +56,7 @@ public class ContainerState {
}
/**
* Set the state value.
* Set the state of the container instance.
*
* @param state the state value to set
* @return the ContainerState object itself.
@ -67,7 +67,7 @@ public class ContainerState {
}
/**
* Get the startTime value.
* Get the date-time when the container instance state started.
*
* @return the startTime value
*/
@ -76,7 +76,7 @@ public class ContainerState {
}
/**
* Set the startTime value.
* Set the date-time when the container instance state started.
*
* @param startTime the startTime value to set
* @return the ContainerState object itself.
@ -87,7 +87,7 @@ public class ContainerState {
}
/**
* Get the exitCode value.
* Get the container instance exit codes correspond to those from the `docker run` command.
*
* @return the exitCode value
*/
@ -96,7 +96,7 @@ public class ContainerState {
}
/**
* Set the exitCode value.
* Set the container instance exit codes correspond to those from the `docker run` command.
*
* @param exitCode the exitCode value to set
* @return the ContainerState object itself.
@ -107,7 +107,7 @@ public class ContainerState {
}
/**
* Get the finishTime value.
* Get the date-time when the container instance state finished.
*
* @return the finishTime value
*/
@ -116,7 +116,7 @@ public class ContainerState {
}
/**
* Set the finishTime value.
* Set the date-time when the container instance state finished.
*
* @param finishTime the finishTime value to set
* @return the ContainerState object itself.
@ -127,7 +127,7 @@ public class ContainerState {
}
/**
* Get the detailStatus value.
* Get the human-readable status of the container instance state.
*
* @return the detailStatus value
*/
@ -136,7 +136,7 @@ public class ContainerState {
}
/**
* Set the detailStatus value.
* Set the human-readable status of the container instance state.
*
* @param detailStatus the detailStatus value to set
* @return the ContainerState object itself.

Просмотреть файл

@ -0,0 +1,96 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* DNS configuration for the container group.
*/
public class DnsConfiguration {
/**
* The DNS servers for the container group.
*/
@JsonProperty(value = "nameServers", required = true)
private List<String> nameServers;
/**
* The DNS search domains for hostname lookup in the container group.
*/
@JsonProperty(value = "searchDomains")
private String searchDomains;
/**
* The DNS options for the container group.
*/
@JsonProperty(value = "options")
private String options;
/**
* Get the DNS servers for the container group.
*
* @return the nameServers value
*/
public List<String> nameServers() {
return this.nameServers;
}
/**
* Set the DNS servers for the container group.
*
* @param nameServers the nameServers value to set
* @return the DnsConfiguration object itself.
*/
public DnsConfiguration withNameServers(List<String> nameServers) {
this.nameServers = nameServers;
return this;
}
/**
* Get the DNS search domains for hostname lookup in the container group.
*
* @return the searchDomains value
*/
public String searchDomains() {
return this.searchDomains;
}
/**
* Set the DNS search domains for hostname lookup in the container group.
*
* @param searchDomains the searchDomains value to set
* @return the DnsConfiguration object itself.
*/
public DnsConfiguration withSearchDomains(String searchDomains) {
this.searchDomains = searchDomains;
return this;
}
/**
* Get the DNS options for the container group.
*
* @return the options value
*/
public String options() {
return this.options;
}
/**
* Set the DNS options for the container group.
*
* @param options the options value to set
* @return the DnsConfiguration object itself.
*/
public DnsConfiguration withOptions(String options) {
this.options = options;
return this;
}
}

Просмотреть файл

@ -33,7 +33,7 @@ public class EnvironmentVariable {
private String secureValue;
/**
* Get the name value.
* Get the name of the environment variable.
*
* @return the name value
*/
@ -42,7 +42,7 @@ public class EnvironmentVariable {
}
/**
* Set the name value.
* Set the name of the environment variable.
*
* @param name the name value to set
* @return the EnvironmentVariable object itself.
@ -53,7 +53,7 @@ public class EnvironmentVariable {
}
/**
* Get the value value.
* Get the value of the environment variable.
*
* @return the value value
*/
@ -62,7 +62,7 @@ public class EnvironmentVariable {
}
/**
* Set the value value.
* Set the value of the environment variable.
*
* @param value the value value to set
* @return the EnvironmentVariable object itself.
@ -73,7 +73,7 @@ public class EnvironmentVariable {
}
/**
* Get the secureValue value.
* Get the value of the secure environment variable.
*
* @return the secureValue value
*/
@ -82,7 +82,7 @@ public class EnvironmentVariable {
}
/**
* Set the secureValue value.
* Set the value of the secure environment variable.
*
* @param secureValue the secureValue value to set
* @return the EnvironmentVariable object itself.

Просмотреть файл

@ -52,7 +52,7 @@ public class Event {
private String type;
/**
* Get the count value.
* Get the count of the event.
*
* @return the count value
*/
@ -61,7 +61,7 @@ public class Event {
}
/**
* Set the count value.
* Set the count of the event.
*
* @param count the count value to set
* @return the Event object itself.
@ -72,7 +72,7 @@ public class Event {
}
/**
* Get the firstTimestamp value.
* Get the date-time of the earliest logged event.
*
* @return the firstTimestamp value
*/
@ -81,7 +81,7 @@ public class Event {
}
/**
* Set the firstTimestamp value.
* Set the date-time of the earliest logged event.
*
* @param firstTimestamp the firstTimestamp value to set
* @return the Event object itself.
@ -92,7 +92,7 @@ public class Event {
}
/**
* Get the lastTimestamp value.
* Get the date-time of the latest logged event.
*
* @return the lastTimestamp value
*/
@ -101,7 +101,7 @@ public class Event {
}
/**
* Set the lastTimestamp value.
* Set the date-time of the latest logged event.
*
* @param lastTimestamp the lastTimestamp value to set
* @return the Event object itself.
@ -112,7 +112,7 @@ public class Event {
}
/**
* Get the name value.
* Get the event name.
*
* @return the name value
*/
@ -121,7 +121,7 @@ public class Event {
}
/**
* Set the name value.
* Set the event name.
*
* @param name the name value to set
* @return the Event object itself.
@ -132,7 +132,7 @@ public class Event {
}
/**
* Get the message value.
* Get the event message.
*
* @return the message value
*/
@ -141,7 +141,7 @@ public class Event {
}
/**
* Set the message value.
* Set the event message.
*
* @param message the message value to set
* @return the Event object itself.
@ -152,7 +152,7 @@ public class Event {
}
/**
* Get the type value.
* Get the event type.
*
* @return the type value
*/
@ -161,7 +161,7 @@ public class Event {
}
/**
* Set the type value.
* Set the event type.
*
* @param type the type value to set
* @return the Event object itself.

Просмотреть файл

@ -36,7 +36,7 @@ public class GitRepoVolume {
private String revision;
/**
* Get the directory value.
* Get target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.
*
* @return the directory value
*/
@ -45,7 +45,7 @@ public class GitRepoVolume {
}
/**
* Set the directory value.
* Set target directory name. Must not contain or start with '..'. If '.' is supplied, the volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository in the subdirectory with the given name.
*
* @param directory the directory value to set
* @return the GitRepoVolume object itself.
@ -56,7 +56,7 @@ public class GitRepoVolume {
}
/**
* Get the repository value.
* Get repository URL.
*
* @return the repository value
*/
@ -65,7 +65,7 @@ public class GitRepoVolume {
}
/**
* Set the repository value.
* Set repository URL.
*
* @param repository the repository value to set
* @return the GitRepoVolume object itself.
@ -76,7 +76,7 @@ public class GitRepoVolume {
}
/**
* Get the revision value.
* Get commit hash for the specified revision.
*
* @return the revision value
*/
@ -85,7 +85,7 @@ public class GitRepoVolume {
}
/**
* Set the revision value.
* Set commit hash for the specified revision.
*
* @param revision the revision value to set
* @return the GitRepoVolume object itself.

Просмотреть файл

@ -0,0 +1,70 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The GPU resource.
*/
public class GpuResource {
/**
* The count of the GPU resource.
*/
@JsonProperty(value = "count", required = true)
private int count;
/**
* The SKU of the GPU resource. Possible values include: 'K80', 'P100',
* 'V100'.
*/
@JsonProperty(value = "sku", required = true)
private GpuSku sku;
/**
* Get the count of the GPU resource.
*
* @return the count value
*/
public int count() {
return this.count;
}
/**
* Set the count of the GPU resource.
*
* @param count the count value to set
* @return the GpuResource object itself.
*/
public GpuResource withCount(int count) {
this.count = count;
return this;
}
/**
* Get the SKU of the GPU resource. Possible values include: 'K80', 'P100', 'V100'.
*
* @return the sku value
*/
public GpuSku sku() {
return this.sku;
}
/**
* Set the SKU of the GPU resource. Possible values include: 'K80', 'P100', 'V100'.
*
* @param sku the sku value to set
* @return the GpuResource object itself.
*/
public GpuResource withSku(GpuSku sku) {
this.sku = sku;
return this;
}
}

Просмотреть файл

@ -0,0 +1,44 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.microsoft.rest.ExpandableStringEnum;
/**
* Defines values for GpuSku.
*/
public final class GpuSku extends ExpandableStringEnum<GpuSku> {
/** Static value K80 for GpuSku. */
public static final GpuSku K80 = fromString("K80");
/** Static value P100 for GpuSku. */
public static final GpuSku P100 = fromString("P100");
/** Static value V100 for GpuSku. */
public static final GpuSku V100 = fromString("V100");
/**
* Creates or finds a GpuSku from its string representation.
* @param name a name to look for
* @return the corresponding GpuSku
*/
@JsonCreator
public static GpuSku fromString(String name) {
return fromString(name, GpuSku.class);
}
/**
* @return known GpuSku values
*/
public static Collection<GpuSku> values() {
return values(GpuSku.class);
}
}

Просмотреть файл

@ -34,7 +34,7 @@ public class ImageRegistryCredential {
private String password;
/**
* Get the server value.
* Get the Docker image registry server without a protocol such as "http" and "https".
*
* @return the server value
*/
@ -43,7 +43,7 @@ public class ImageRegistryCredential {
}
/**
* Set the server value.
* Set the Docker image registry server without a protocol such as "http" and "https".
*
* @param server the server value to set
* @return the ImageRegistryCredential object itself.
@ -54,7 +54,7 @@ public class ImageRegistryCredential {
}
/**
* Get the username value.
* Get the username for the private registry.
*
* @return the username value
*/
@ -63,7 +63,7 @@ public class ImageRegistryCredential {
}
/**
* Set the username value.
* Set the username for the private registry.
*
* @param username the username value to set
* @return the ImageRegistryCredential object itself.
@ -74,7 +74,7 @@ public class ImageRegistryCredential {
}
/**
* Get the password value.
* Get the password for the private registry.
*
* @return the password value
*/
@ -83,7 +83,7 @@ public class ImageRegistryCredential {
}
/**
* Set the password value.
* Set the password for the private registry.
*
* @param password the password value to set
* @return the ImageRegistryCredential object itself.

Просмотреть файл

@ -22,10 +22,11 @@ public class IpAddress {
private List<Port> ports;
/**
* Specifies if the IP is exposed to the public internet.
* Specifies if the IP is exposed to the public internet or private VNET.
* Possible values include: 'Public', 'Private'.
*/
@JsonProperty(value = "type", required = true)
private String type;
private ContainerGroupIpAddressType type;
/**
* The IP exposed to the public internet.
@ -46,14 +47,7 @@ public class IpAddress {
private String fqdn;
/**
* Creates an instance of IpAddress class.
*/
public IpAddress() {
type = "Public";
}
/**
* Get the ports value.
* Get the list of ports exposed on the container group.
*
* @return the ports value
*/
@ -62,7 +56,7 @@ public class IpAddress {
}
/**
* Set the ports value.
* Set the list of ports exposed on the container group.
*
* @param ports the ports value to set
* @return the IpAddress object itself.
@ -73,27 +67,27 @@ public class IpAddress {
}
/**
* Get the type value.
* Get specifies if the IP is exposed to the public internet or private VNET. Possible values include: 'Public', 'Private'.
*
* @return the type value
*/
public String type() {
public ContainerGroupIpAddressType type() {
return this.type;
}
/**
* Set the type value.
* Set specifies if the IP is exposed to the public internet or private VNET. Possible values include: 'Public', 'Private'.
*
* @param type the type value to set
* @return the IpAddress object itself.
*/
public IpAddress withType(String type) {
public IpAddress withType(ContainerGroupIpAddressType type) {
this.type = type;
return this;
}
/**
* Get the ip value.
* Get the IP exposed to the public internet.
*
* @return the ip value
*/
@ -102,7 +96,7 @@ public class IpAddress {
}
/**
* Set the ip value.
* Set the IP exposed to the public internet.
*
* @param ip the ip value to set
* @return the IpAddress object itself.
@ -113,7 +107,7 @@ public class IpAddress {
}
/**
* Get the dnsNameLabel value.
* Get the Dns name label for the IP.
*
* @return the dnsNameLabel value
*/
@ -122,7 +116,7 @@ public class IpAddress {
}
/**
* Set the dnsNameLabel value.
* Set the Dns name label for the IP.
*
* @param dnsNameLabel the dnsNameLabel value to set
* @return the IpAddress object itself.
@ -133,7 +127,7 @@ public class IpAddress {
}
/**
* Get the fqdn value.
* Get the FQDN for the IP.
*
* @return the fqdn value
*/

Просмотреть файл

@ -8,6 +8,7 @@
package com.microsoft.azure.management.containerinstance;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
@ -27,7 +28,20 @@ public class LogAnalytics {
private String workspaceKey;
/**
* Get the workspaceId value.
* The log type to be used. Possible values include: 'ContainerInsights',
* 'ContainerInstanceLogs'.
*/
@JsonProperty(value = "logType")
private LogAnalyticsLogType logType;
/**
* Metadata for log analytics.
*/
@JsonProperty(value = "metadata")
private Map<String, String> metadata;
/**
* Get the workspace id for log analytics.
*
* @return the workspaceId value
*/
@ -36,7 +50,7 @@ public class LogAnalytics {
}
/**
* Set the workspaceId value.
* Set the workspace id for log analytics.
*
* @param workspaceId the workspaceId value to set
* @return the LogAnalytics object itself.
@ -47,7 +61,7 @@ public class LogAnalytics {
}
/**
* Get the workspaceKey value.
* Get the workspace key for log analytics.
*
* @return the workspaceKey value
*/
@ -56,7 +70,7 @@ public class LogAnalytics {
}
/**
* Set the workspaceKey value.
* Set the workspace key for log analytics.
*
* @param workspaceKey the workspaceKey value to set
* @return the LogAnalytics object itself.
@ -66,4 +80,44 @@ public class LogAnalytics {
return this;
}
/**
* Get the log type to be used. Possible values include: 'ContainerInsights', 'ContainerInstanceLogs'.
*
* @return the logType value
*/
public LogAnalyticsLogType logType() {
return this.logType;
}
/**
* Set the log type to be used. Possible values include: 'ContainerInsights', 'ContainerInstanceLogs'.
*
* @param logType the logType value to set
* @return the LogAnalytics object itself.
*/
public LogAnalytics withLogType(LogAnalyticsLogType logType) {
this.logType = logType;
return this;
}
/**
* Get metadata for log analytics.
*
* @return the metadata value
*/
public Map<String, String> metadata() {
return this.metadata;
}
/**
* Set metadata for log analytics.
*
* @param metadata the metadata value to set
* @return the LogAnalytics object itself.
*/
public LogAnalytics withMetadata(Map<String, String> metadata) {
this.metadata = metadata;
return this;
}
}

Просмотреть файл

@ -0,0 +1,41 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import java.util.Collection;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.microsoft.rest.ExpandableStringEnum;
/**
* Defines values for LogAnalyticsLogType.
*/
public final class LogAnalyticsLogType extends ExpandableStringEnum<LogAnalyticsLogType> {
/** Static value ContainerInsights for LogAnalyticsLogType. */
public static final LogAnalyticsLogType CONTAINER_INSIGHTS = fromString("ContainerInsights");
/** Static value ContainerInstanceLogs for LogAnalyticsLogType. */
public static final LogAnalyticsLogType CONTAINER_INSTANCE_LOGS = fromString("ContainerInstanceLogs");
/**
* Creates or finds a LogAnalyticsLogType from its string representation.
* @param name a name to look for
* @return the corresponding LogAnalyticsLogType
*/
@JsonCreator
public static LogAnalyticsLogType fromString(String name) {
return fromString(name, LogAnalyticsLogType.class);
}
/**
* @return known LogAnalyticsLogType values
*/
public static Collection<LogAnalyticsLogType> values() {
return values(LogAnalyticsLogType.class);
}
}

Просмотреть файл

@ -2,8 +2,6 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
@ -26,6 +24,12 @@ public class Operation {
@JsonProperty(value = "display", required = true)
private OperationDisplay display;
/**
* The additional properties.
*/
@JsonProperty(value = "properties")
private Object properties;
/**
* The intended executor of the operation. Possible values include: 'User',
* 'System'.
@ -34,7 +38,7 @@ public class Operation {
private ContainerInstanceOperationsOrigin origin;
/**
* Get the name value.
* Get the name of the operation.
*
* @return the name value
*/
@ -43,7 +47,7 @@ public class Operation {
}
/**
* Set the name value.
* Set the name of the operation.
*
* @param name the name value to set
* @return the Operation object itself.
@ -54,7 +58,7 @@ public class Operation {
}
/**
* Get the display value.
* Get the display information of the operation.
*
* @return the display value
*/
@ -63,7 +67,7 @@ public class Operation {
}
/**
* Set the display value.
* Set the display information of the operation.
*
* @param display the display value to set
* @return the Operation object itself.
@ -74,7 +78,27 @@ public class Operation {
}
/**
* Get the origin value.
* Get the additional properties.
*
* @return the properties value
*/
public Object properties() {
return this.properties;
}
/**
* Set the additional properties.
*
* @param properties the properties value to set
* @return the Operation object itself.
*/
public Operation withProperties(Object properties) {
this.properties = properties;
return this;
}
/**
* Get the intended executor of the operation. Possible values include: 'User', 'System'.
*
* @return the origin value
*/
@ -83,7 +107,7 @@ public class Operation {
}
/**
* Set the origin value.
* Set the intended executor of the operation. Possible values include: 'User', 'System'.
*
* @param origin the origin value to set
* @return the Operation object itself.

Просмотреть файл

@ -39,7 +39,7 @@ public class OperationDisplay {
private String description;
/**
* Get the provider value.
* Get the name of the provider of the operation.
*
* @return the provider value
*/
@ -48,7 +48,7 @@ public class OperationDisplay {
}
/**
* Set the provider value.
* Set the name of the provider of the operation.
*
* @param provider the provider value to set
* @return the OperationDisplay object itself.
@ -59,7 +59,7 @@ public class OperationDisplay {
}
/**
* Get the resource value.
* Get the name of the resource type of the operation.
*
* @return the resource value
*/
@ -68,7 +68,7 @@ public class OperationDisplay {
}
/**
* Set the resource value.
* Set the name of the resource type of the operation.
*
* @param resource the resource value to set
* @return the OperationDisplay object itself.
@ -79,7 +79,7 @@ public class OperationDisplay {
}
/**
* Get the operation value.
* Get the friendly name of the operation.
*
* @return the operation value
*/
@ -88,7 +88,7 @@ public class OperationDisplay {
}
/**
* Set the operation value.
* Set the friendly name of the operation.
*
* @param operation the operation value to set
* @return the OperationDisplay object itself.
@ -99,7 +99,7 @@ public class OperationDisplay {
}
/**
* Get the description value.
* Get the description of the operation.
*
* @return the description value
*/
@ -108,7 +108,7 @@ public class OperationDisplay {
}
/**
* Set the description value.
* Set the description of the operation.
*
* @param description the description value to set
* @return the OperationDisplay object itself.

Просмотреть файл

@ -28,7 +28,7 @@ public class Port {
private int port;
/**
* Get the protocol value.
* Get the protocol associated with the port. Possible values include: 'TCP', 'UDP'.
*
* @return the protocol value
*/
@ -37,7 +37,7 @@ public class Port {
}
/**
* Set the protocol value.
* Set the protocol associated with the port. Possible values include: 'TCP', 'UDP'.
*
* @param protocol the protocol value to set
* @return the Port object itself.
@ -48,7 +48,7 @@ public class Port {
}
/**
* Get the port value.
* Get the port number.
*
* @return the port value
*/
@ -57,7 +57,7 @@ public class Port {
}
/**
* Set the port value.
* Set the port number.
*
* @param port the port value to set
* @return the Port object itself.

Просмотреть файл

@ -0,0 +1,59 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* Defines values for ResourceIdentityType.
*/
public enum ResourceIdentityType {
/** Enum value SystemAssigned. */
SYSTEM_ASSIGNED("SystemAssigned"),
/** Enum value UserAssigned. */
USER_ASSIGNED("UserAssigned"),
/** Enum value SystemAssigned, UserAssigned. */
SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"),
/** Enum value None. */
NONE("None");
/** The actual serialized value for a ResourceIdentityType instance. */
private String value;
ResourceIdentityType(String value) {
this.value = value;
}
/**
* Parses a serialized value to a ResourceIdentityType instance.
*
* @param value the serialized value to parse.
* @return the parsed ResourceIdentityType object, or null if unable to parse.
*/
@JsonCreator
public static ResourceIdentityType fromString(String value) {
ResourceIdentityType[] items = ResourceIdentityType.values();
for (ResourceIdentityType item : items) {
if (item.toString().equalsIgnoreCase(value)) {
return item;
}
}
return null;
}
@JsonValue
@Override
public String toString() {
return this.value;
}
}

Просмотреть файл

@ -27,7 +27,13 @@ public class ResourceLimits {
private Double cpu;
/**
* Get the memoryInGB value.
* The GPU limit of this container instance.
*/
@JsonProperty(value = "gpu")
private GpuResource gpu;
/**
* Get the memory limit in GB of this container instance.
*
* @return the memoryInGB value
*/
@ -36,7 +42,7 @@ public class ResourceLimits {
}
/**
* Set the memoryInGB value.
* Set the memory limit in GB of this container instance.
*
* @param memoryInGB the memoryInGB value to set
* @return the ResourceLimits object itself.
@ -47,7 +53,7 @@ public class ResourceLimits {
}
/**
* Get the cpu value.
* Get the CPU limit of this container instance.
*
* @return the cpu value
*/
@ -56,7 +62,7 @@ public class ResourceLimits {
}
/**
* Set the cpu value.
* Set the CPU limit of this container instance.
*
* @param cpu the cpu value to set
* @return the ResourceLimits object itself.
@ -66,4 +72,24 @@ public class ResourceLimits {
return this;
}
/**
* Get the GPU limit of this container instance.
*
* @return the gpu value
*/
public GpuResource gpu() {
return this.gpu;
}
/**
* Set the GPU limit of this container instance.
*
* @param gpu the gpu value to set
* @return the ResourceLimits object itself.
*/
public ResourceLimits withGpu(GpuResource gpu) {
this.gpu = gpu;
return this;
}
}

Просмотреть файл

@ -27,7 +27,13 @@ public class ResourceRequests {
private double cpu;
/**
* Get the memoryInGB value.
* The GPU request of this container instance.
*/
@JsonProperty(value = "gpu")
private GpuResource gpu;
/**
* Get the memory request in GB of this container instance.
*
* @return the memoryInGB value
*/
@ -36,7 +42,7 @@ public class ResourceRequests {
}
/**
* Set the memoryInGB value.
* Set the memory request in GB of this container instance.
*
* @param memoryInGB the memoryInGB value to set
* @return the ResourceRequests object itself.
@ -47,7 +53,7 @@ public class ResourceRequests {
}
/**
* Get the cpu value.
* Get the CPU request of this container instance.
*
* @return the cpu value
*/
@ -56,7 +62,7 @@ public class ResourceRequests {
}
/**
* Set the cpu value.
* Set the CPU request of this container instance.
*
* @param cpu the cpu value to set
* @return the ResourceRequests object itself.
@ -66,4 +72,24 @@ public class ResourceRequests {
return this;
}
/**
* Get the GPU request of this container instance.
*
* @return the gpu value
*/
public GpuResource gpu() {
return this.gpu;
}
/**
* Set the GPU request of this container instance.
*
* @param gpu the gpu value to set
* @return the ResourceRequests object itself.
*/
public ResourceRequests withGpu(GpuResource gpu) {
this.gpu = gpu;
return this;
}
}

Просмотреть файл

@ -27,7 +27,7 @@ public class ResourceRequirements {
private ResourceLimits limits;
/**
* Get the requests value.
* Get the resource requests of this container instance.
*
* @return the requests value
*/
@ -36,7 +36,7 @@ public class ResourceRequirements {
}
/**
* Set the requests value.
* Set the resource requests of this container instance.
*
* @param requests the requests value to set
* @return the ResourceRequirements object itself.
@ -47,7 +47,7 @@ public class ResourceRequirements {
}
/**
* Get the limits value.
* Get the resource limits of this container instance.
*
* @return the limits value
*/
@ -56,7 +56,7 @@ public class ResourceRequirements {
}
/**
* Set the limits value.
* Set the resource limits of this container instance.
*
* @param limits the limits value to set
* @return the ResourceRequirements object itself.

Просмотреть файл

@ -39,7 +39,7 @@ public class Usage {
private UsageName name;
/**
* Get the unit value.
* Get unit of the usage result.
*
* @return the unit value
*/
@ -48,7 +48,7 @@ public class Usage {
}
/**
* Get the currentValue value.
* Get the current usage of the resource.
*
* @return the currentValue value
*/
@ -57,7 +57,7 @@ public class Usage {
}
/**
* Get the limit value.
* Get the maximum permitted usage of the resource.
*
* @return the limit value
*/
@ -66,7 +66,7 @@ public class Usage {
}
/**
* Get the name value.
* Get the name object of the resource.
*
* @return the name value
*/

Просмотреть файл

@ -27,7 +27,7 @@ public class UsageName {
private String localizedValue;
/**
* Get the value value.
* Get the name of the resource.
*
* @return the value value
*/
@ -36,7 +36,7 @@ public class UsageName {
}
/**
* Get the localizedValue value.
* Get the localized name of the resource.
*
* @return the localizedValue value
*/

Просмотреть файл

@ -46,7 +46,7 @@ public class Volume {
private GitRepoVolume gitRepo;
/**
* Get the name value.
* Get the name of the volume.
*
* @return the name value
*/
@ -55,7 +55,7 @@ public class Volume {
}
/**
* Set the name value.
* Set the name of the volume.
*
* @param name the name value to set
* @return the Volume object itself.
@ -66,7 +66,7 @@ public class Volume {
}
/**
* Get the azureFile value.
* Get the Azure File volume.
*
* @return the azureFile value
*/
@ -75,7 +75,7 @@ public class Volume {
}
/**
* Set the azureFile value.
* Set the Azure File volume.
*
* @param azureFile the azureFile value to set
* @return the Volume object itself.
@ -86,7 +86,7 @@ public class Volume {
}
/**
* Get the emptyDir value.
* Get the empty directory volume.
*
* @return the emptyDir value
*/
@ -95,7 +95,7 @@ public class Volume {
}
/**
* Set the emptyDir value.
* Set the empty directory volume.
*
* @param emptyDir the emptyDir value to set
* @return the Volume object itself.
@ -106,7 +106,7 @@ public class Volume {
}
/**
* Get the secret value.
* Get the secret volume.
*
* @return the secret value
*/
@ -115,7 +115,7 @@ public class Volume {
}
/**
* Set the secret value.
* Set the secret volume.
*
* @param secret the secret value to set
* @return the Volume object itself.
@ -126,7 +126,7 @@ public class Volume {
}
/**
* Get the gitRepo value.
* Get the git repo volume.
*
* @return the gitRepo value
*/
@ -135,7 +135,7 @@ public class Volume {
}
/**
* Set the gitRepo value.
* Set the git repo volume.
*
* @param gitRepo the gitRepo value to set
* @return the Volume object itself.

Просмотреть файл

@ -34,7 +34,7 @@ public class VolumeMount {
private Boolean readOnly;
/**
* Get the name value.
* Get the name of the volume mount.
*
* @return the name value
*/
@ -43,7 +43,7 @@ public class VolumeMount {
}
/**
* Set the name value.
* Set the name of the volume mount.
*
* @param name the name value to set
* @return the VolumeMount object itself.
@ -54,7 +54,7 @@ public class VolumeMount {
}
/**
* Get the mountPath value.
* Get the path within the container where the volume should be mounted. Must not contain colon (:).
*
* @return the mountPath value
*/
@ -63,7 +63,7 @@ public class VolumeMount {
}
/**
* Set the mountPath value.
* Set the path within the container where the volume should be mounted. Must not contain colon (:).
*
* @param mountPath the mountPath value to set
* @return the VolumeMount object itself.
@ -74,7 +74,7 @@ public class VolumeMount {
}
/**
* Get the readOnly value.
* Get the flag indicating whether the volume mount is read-only.
*
* @return the readOnly value
*/
@ -83,7 +83,7 @@ public class VolumeMount {
}
/**
* Set the readOnly value.
* Set the flag indicating whether the volume mount is read-only.
*
* @param readOnly the readOnly value to set
* @return the VolumeMount object itself.

Просмотреть файл

@ -0,0 +1,71 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance.implementation;
import java.util.List;
import com.microsoft.azure.management.containerinstance.CachedImages;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The response containing cached images.
*/
public class CachedImagesListResultInner {
/**
* The list of cached images.
*/
@JsonProperty(value = "value")
private List<CachedImages> value;
/**
* The URI to fetch the next page of cached images.
*/
@JsonProperty(value = "nextLink")
private String nextLink;
/**
* Get the list of cached images.
*
* @return the value value
*/
public List<CachedImages> value() {
return this.value;
}
/**
* Set the list of cached images.
*
* @param value the value value to set
* @return the CachedImagesListResultInner object itself.
*/
public CachedImagesListResultInner withValue(List<CachedImages> value) {
this.value = value;
return this;
}
/**
* Get the URI to fetch the next page of cached images.
*
* @return the nextLink value
*/
public String nextLink() {
return this.nextLink;
}
/**
* Set the URI to fetch the next page of cached images.
*
* @param nextLink the nextLink value to set
* @return the CachedImagesListResultInner object itself.
*/
public CachedImagesListResultInner withNextLink(String nextLink) {
this.nextLink = nextLink;
return this;
}
}

Просмотреть файл

@ -0,0 +1,71 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance.implementation;
import java.util.List;
import com.microsoft.azure.management.containerinstance.Capabilities;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The response containing list of capabilities.
*/
public class CapabilitiesListResultInner {
/**
* The list of capabilities.
*/
@JsonProperty(value = "value")
private List<Capabilities> value;
/**
* The URI to fetch the next page of capabilities.
*/
@JsonProperty(value = "nextLink")
private String nextLink;
/**
* Get the list of capabilities.
*
* @return the value value
*/
public List<Capabilities> value() {
return this.value;
}
/**
* Set the list of capabilities.
*
* @param value the value value to set
* @return the CapabilitiesListResultInner object itself.
*/
public CapabilitiesListResultInner withValue(List<Capabilities> value) {
this.value = value;
return this;
}
/**
* Get the URI to fetch the next page of capabilities.
*
* @return the nextLink value
*/
public String nextLink() {
return this.nextLink;
}
/**
* Set the URI to fetch the next page of capabilities.
*
* @param nextLink the nextLink value to set
* @return the CapabilitiesListResultInner object itself.
*/
public CapabilitiesListResultInner withNextLink(String nextLink) {
this.nextLink = nextLink;
return this;
}
}

Просмотреть файл

@ -27,7 +27,7 @@ public class ContainerExecResponseInner {
private String password;
/**
* Get the webSocketUri value.
* Get the uri for the exec websocket.
*
* @return the webSocketUri value
*/
@ -36,7 +36,7 @@ public class ContainerExecResponseInner {
}
/**
* Set the webSocketUri value.
* Set the uri for the exec websocket.
*
* @param webSocketUri the webSocketUri value to set
* @return the ContainerExecResponseInner object itself.
@ -47,7 +47,7 @@ public class ContainerExecResponseInner {
}
/**
* Get the password value.
* Get the password to start the exec command.
*
* @return the password value
*/
@ -56,7 +56,7 @@ public class ContainerExecResponseInner {
}
/**
* Set the password value.
* Set the password to start the exec command.
*
* @param password the password value to set
* @return the ContainerExecResponseInner object itself.

Просмотреть файл

@ -9,17 +9,29 @@ package com.microsoft.azure.management.containerinstance.implementation;
import com.microsoft.azure.Resource;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.containerinstance.Container;
import com.microsoft.azure.management.containerinstance.ContainerExecRequest;
import com.microsoft.azure.management.containerinstance.ContainerExecRequestTerminalSize;
import com.microsoft.azure.management.containerinstance.ContainerExecResponse;
import com.microsoft.azure.management.containerinstance.ContainerGroup;
import com.microsoft.azure.management.containerinstance.ContainerGroupDiagnostics;
import com.microsoft.azure.management.containerinstance.ContainerGroupIpAddressType;
import com.microsoft.azure.management.containerinstance.ContainerGroupNetworkProfile;
import com.microsoft.azure.management.containerinstance.ContainerGroupNetworkProtocol;
import com.microsoft.azure.management.containerinstance.ContainerGroupRestartPolicy;
import com.microsoft.azure.management.containerinstance.DnsConfiguration;
import com.microsoft.azure.management.containerinstance.Event;
import com.microsoft.azure.management.containerinstance.ImageRegistryCredential;
import com.microsoft.azure.management.containerinstance.IpAddress;
import com.microsoft.azure.management.containerinstance.LogAnalytics;
import com.microsoft.azure.management.containerinstance.LogAnalyticsLogType;
import com.microsoft.azure.management.containerinstance.OperatingSystemTypes;
import com.microsoft.azure.management.containerinstance.Port;
import com.microsoft.azure.management.containerinstance.ResourceIdentityType;
import com.microsoft.azure.management.containerinstance.Volume;
import com.microsoft.azure.management.graphrbac.BuiltInRole;
import com.microsoft.azure.management.graphrbac.implementation.GraphRbacManager;
import com.microsoft.azure.management.graphrbac.implementation.RoleAssignmentHelper;
import com.microsoft.azure.management.msi.Identity;
import com.microsoft.azure.management.resources.fluentcore.arm.models.implementation.GroupableParentResourceImpl;
import com.microsoft.azure.management.resources.fluentcore.model.Creatable;
import com.microsoft.azure.management.resources.fluentcore.utils.SdkContext;
@ -54,15 +66,15 @@ import java.util.concurrent.Callable;
*/
@LangDefinition
public class ContainerGroupImpl
extends
GroupableParentResourceImpl<
extends
GroupableParentResourceImpl<
ContainerGroup,
ContainerGroupInner,
ContainerGroupImpl,
ContainerInstanceManager>
implements ContainerGroup,
ContainerGroup.Definition,
ContainerGroup.Update {
implements ContainerGroup,
ContainerGroup.Definition,
ContainerGroup.Update {
private final StorageManager storageManager;
private String creatableStorageAccountKey;
@ -73,10 +85,12 @@ public class ContainerGroupImpl
private List<String> imageRegistryServers;
private int[] externalTcpPorts;
private int[] externalUdpPorts;
private ContainerGroupMsiHandler containerGroupMsiHandler;
protected ContainerGroupImpl(String name, ContainerGroupInner innerObject, ContainerInstanceManager manager, final StorageManager storageManager) {
protected ContainerGroupImpl(String name, ContainerGroupInner innerObject, ContainerInstanceManager manager, final StorageManager storageManager, final GraphRbacManager rbacManager) {
super(name, innerObject, manager);
this.storageManager = storageManager;
this.containerGroupMsiHandler = new ContainerGroupMsiHandler(rbacManager, this);
}
@Override
@ -85,6 +99,8 @@ public class ContainerGroupImpl
@Override
protected Observable<ContainerGroupInner> createInner() {
this.containerGroupMsiHandler.processCreatedExternalIdentities();
this.containerGroupMsiHandler.handleExternalIdentities();
final ContainerGroupImpl self = this;
if (!isInCreateMode()) {
@ -92,77 +108,77 @@ public class ContainerGroupImpl
resource.withLocation(self.regionName());
resource.withTags(self.tags());
return self.manager().inner().containerGroups()
.updateAsync(self.resourceGroupName(), self.name(), resource)
.flatMap(new Func1<ContainerGroupInner, Observable<ContainerGroupInner>>() {
@Override
public Observable<ContainerGroupInner> call(ContainerGroupInner containerGroupInner) {
return self.manager().inner().containerGroups()
.getByResourceGroupAsync(self.resourceGroupName(), self.name());
}
});
.updateAsync(self.resourceGroupName(), self.name(), resource)
.flatMap(new Func1<ContainerGroupInner, Observable<ContainerGroupInner>>() {
@Override
public Observable<ContainerGroupInner> call(ContainerGroupInner containerGroupInner) {
return self.manager().inner().containerGroups()
.getByResourceGroupAsync(self.resourceGroupName(), self.name());
}
});
} else if (newFileShares == null || creatableStorageAccountKey == null) {
return self.manager().inner().containerGroups().createOrUpdateAsync(self.resourceGroupName(), self.name(), self.inner());
} else {
final StorageAccount storageAccount = this.<StorageAccount>taskResult(this.creatableStorageAccountKey);
return createFileShareAsync(storageAccount)
.collect(new Func0<List<Triple<String, String, String>>>() {
@Override
public List<Triple<String, String, String>> call() {
return new ArrayList<>();
}
}, new Action2<List<Triple<String, String, String>>, Triple<String, String, String>>() {
@Override
public void call(List<Triple<String, String, String>> cloudFileShares, Triple<String, String, String> fileShare) {
cloudFileShares.add(fileShare);
}
})
.flatMap(new Func1<List<Triple<String, String, String>>, Observable<? extends ContainerGroupInner>>() {
@Override
public Observable<? extends ContainerGroupInner> call(List<Triple<String, String, String>> fileShares) {
for (Triple<String, String, String> fileShareEntry : fileShares) {
self.defineVolume(fileShareEntry.getLeft())
.withExistingReadWriteAzureFileShare(fileShareEntry.getMiddle())
.withStorageAccountName(storageAccount.name())
.withStorageAccountKey(fileShareEntry.getRight())
.attach();
.collect(new Func0<List<Triple<String, String, String>>>() {
@Override
public List<Triple<String, String, String>> call() {
return new ArrayList<>();
}
return self.manager().inner().containerGroups().createOrUpdateAsync(self.resourceGroupName(), self.name(), self.inner());
}
});
}, new Action2<List<Triple<String, String, String>>, Triple<String, String, String>>() {
@Override
public void call(List<Triple<String, String, String>> cloudFileShares, Triple<String, String, String> fileShare) {
cloudFileShares.add(fileShare);
}
})
.flatMap(new Func1<List<Triple<String, String, String>>, Observable<? extends ContainerGroupInner>>() {
@Override
public Observable<? extends ContainerGroupInner> call(List<Triple<String, String, String>> fileShares) {
for (Triple<String, String, String> fileShareEntry : fileShares) {
self.defineVolume(fileShareEntry.getLeft())
.withExistingReadWriteAzureFileShare(fileShareEntry.getMiddle())
.withStorageAccountName(storageAccount.name())
.withStorageAccountKey(fileShareEntry.getRight())
.attach();
}
return self.manager().inner().containerGroups().createOrUpdateAsync(self.resourceGroupName(), self.name(), self.inner());
}
});
}
}
private Observable<Triple<String, String, String>> createFileShareAsync(final StorageAccount storageAccount) {
return storageAccount.getKeysAsync()
.map(new Func1<List<StorageAccountKey>, String>() {
@Override
public String call(List<StorageAccountKey> storageAccountKeys) {
return storageAccountKeys.get(0).value();
}
})
.flatMap(new Func1<String, Observable<Triple<String, String, String>>>() {
CloudFileClient cloudFileClient;
@Override
public Observable<Triple<String, String, String>> call(final String storageAccountKey) {
try {
cloudFileClient = CloudStorageAccount.parse(String.format("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=core.windows.net",
storageAccount.name(),
storageAccountKey))
.createCloudFileClient();
} catch (URISyntaxException syntaxException) {
throw Exceptions.propagate(syntaxException);
} catch (InvalidKeyException keyException) {
throw Exceptions.propagate(keyException);
}
return Observable.from(newFileShares.entrySet())
.flatMap(new Func1<Map.Entry<String, String>, Observable<Triple<String, String, String>>>() {
@Override
public Observable<Triple<String, String, String>> call(Map.Entry<String, String> fileShareEntry) {
return createSingleFileShareAsync(cloudFileClient, fileShareEntry.getKey(), fileShareEntry.getValue(), storageAccountKey);
.map(new Func1<List<StorageAccountKey>, String>() {
@Override
public String call(List<StorageAccountKey> storageAccountKeys) {
return storageAccountKeys.get(0).value();
}
})
.flatMap(new Func1<String, Observable<Triple<String, String, String>>>() {
CloudFileClient cloudFileClient;
@Override
public Observable<Triple<String, String, String>> call(final String storageAccountKey) {
try {
cloudFileClient = CloudStorageAccount.parse(String.format("DefaultEndpointsProtocol=https;AccountName=%s;AccountKey=%s;EndpointSuffix=core.windows.net",
storageAccount.name(),
storageAccountKey))
.createCloudFileClient();
} catch (URISyntaxException syntaxException) {
throw Exceptions.propagate(syntaxException);
} catch (InvalidKeyException keyException) {
throw Exceptions.propagate(keyException);
}
});
}
});
return Observable.from(newFileShares.entrySet())
.flatMap(new Func1<Map.Entry<String, String>, Observable<Triple<String, String, String>>>() {
@Override
public Observable<Triple<String, String, String>> call(Map.Entry<String, String> fileShareEntry) {
return createSingleFileShareAsync(cloudFileClient, fileShareEntry.getKey(), fileShareEntry.getValue(), storageAccountKey);
}
});
}
});
}
private Observable<Triple<String, String, String>> createSingleFileShareAsync(final CloudFileClient client, final String volumeName, final String fileShareName, final String storageAccountKey) {
@ -266,6 +282,48 @@ public class ContainerGroupImpl
return this;
}
@Override
public ContainerGroupImpl withSystemAssignedManagedServiceIdentity() {
this.containerGroupMsiHandler.withLocalManagedServiceIdentity();
return this;
}
@Override
public ContainerGroupImpl withSystemAssignedIdentityBasedAccessTo(String resourceId, BuiltInRole role) {
this.containerGroupMsiHandler.withAccessTo(resourceId, role);
return this;
}
@Override
public ContainerGroupImpl withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(BuiltInRole role) {
this.containerGroupMsiHandler.withAccessToCurrentResourceGroup(role);
return this;
}
@Override
public ContainerGroupImpl withSystemAssignedIdentityBasedAccessTo(String resourceId, String roleDefinitionId) {
this.containerGroupMsiHandler.withAccessTo(resourceId, roleDefinitionId);
return this;
}
@Override
public ContainerGroupImpl withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(String roleDefinitionId) {
this.containerGroupMsiHandler.withAccessToCurrentResourceGroup(roleDefinitionId);
return this;
}
@Override
public ContainerGroupImpl withNewUserAssignedManagedServiceIdentity(Creatable<Identity> creatableIdentity) {
this.containerGroupMsiHandler.withNewExternalManagedServiceIdentity(creatableIdentity);
return this;
}
@Override
public ContainerGroupImpl withExistingUserAssignedManagedServiceIdentity(Identity identity) {
this.containerGroupMsiHandler.withExistingExternalManagedServiceIdentity(identity);
return this;
}
@Override
public ContainerGroupImpl withPublicImageRegistryOnly() {
this.inner().withImageRegistryCredentials(null);
@ -279,9 +337,9 @@ public class ContainerGroupImpl
this.inner().withImageRegistryCredentials(new ArrayList<ImageRegistryCredential>());
}
this.inner().imageRegistryCredentials().add(new ImageRegistryCredential()
.withServer(server)
.withUsername(username)
.withPassword(password));
.withServer(server)
.withUsername(username)
.withPassword(password));
return this;
}
@ -290,9 +348,9 @@ public class ContainerGroupImpl
public ContainerGroupImpl withNewAzureFileShareVolume(String volumeName, String shareName) {
if (this.newFileShares == null || this.creatableStorageAccountKey == null) {
StorageAccount.DefinitionStages.WithGroup definitionWithGroup = this.storageManager
.storageAccounts()
.define(SdkContext.randomResourceName("fs", 24))
.withRegion(this.regionName());
.storageAccounts()
.define(SdkContext.randomResourceName("fs", 24))
.withRegion(this.regionName());
Creatable<StorageAccount> creatable;
if (this.creatableGroup != null) {
creatable = definitionWithGroup.withNewResourceGroup(this.creatableGroup);
@ -313,8 +371,8 @@ public class ContainerGroupImpl
this.inner().withVolumes(new ArrayList<Volume>());
}
this.inner().volumes().add(new Volume()
.withName(volumeName)
.withEmptyDir(new Object()));
.withName(volumeName)
.withEmptyDir(new Object()));
return this;
}
@ -339,21 +397,21 @@ public class ContainerGroupImpl
@Override
public ContainerGroupImpl withContainerInstance(String imageName) {
return this.defineContainerInstance(this.name())
.withImage(imageName)
.withoutPorts()
.withCpuCoreCount(1)
.withMemorySizeInGB(1.5)
.attach();
.withImage(imageName)
.withoutPorts()
.withCpuCoreCount(1)
.withMemorySizeInGB(1.5)
.attach();
}
@Override
public ContainerGroupImpl withContainerInstance(String imageName, int port) {
return this.defineContainerInstance(this.name())
.withImage(imageName)
.withExternalTcpPort(port)
.withCpuCoreCount(1)
.withMemorySizeInGB(1.5)
.attach();
.withImage(imageName)
.withExternalTcpPort(port)
.withCpuCoreCount(1)
.withMemorySizeInGB(1.5)
.attach();
}
@Override
@ -368,11 +426,46 @@ public class ContainerGroupImpl
if (this.inner().ipAddress() == null) {
this.inner().withIpAddress(new IpAddress());
}
this.inner().ipAddress().withDnsNameLabel(dnsPrefix);
this.inner().ipAddress().withDnsNameLabel(dnsPrefix).withType(ContainerGroupIpAddressType.PUBLIC);
return this;
}
@Override
public ContainerGroupImpl withNetworkProfileId(String subscriptionId, String resourceGroupName, String networkProfileName) {
String networkProfileId = "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/networkProfiles/" + networkProfileName;
this.inner().withNetworkProfile(new ContainerGroupNetworkProfile().withId(networkProfileId));
if (this.inner().ipAddress() == null) {
this.inner().withIpAddress(new IpAddress());
}
this.inner().ipAddress().withType(ContainerGroupIpAddressType.PRIVATE);
return this;
}
@Override
public ContainerGroupImpl withDnsServerNames(List<String> dnsServerNames) {
this.inner().withDnsConfig(new DnsConfiguration().withNameServers(dnsServerNames));
return this;
}
@Override
public ContainerGroupImpl withDnsConfiguration(List<String> dnsServerNames, String dnsSearchDomains, String dnsOptions) {
this.inner().withDnsConfig(new DnsConfiguration().withNameServers(dnsServerNames).withSearchDomains(dnsSearchDomains).withOptions(dnsOptions));
return this;
}
@Override
public ContainerGroupImpl withLogAnalytics(String workspaceId, String workspaceKey) {
this.inner().withDiagnostics(new ContainerGroupDiagnostics().withLogAnalytics(new LogAnalytics().withWorkspaceId(workspaceId).withWorkspaceKey(workspaceKey)));
return this;
}
@Override
public ContainerGroupImpl withLogAnalytics(String workspaceId, String workspaceKey, LogAnalyticsLogType logType, Map<String, String> metadata) {
this.inner().withDiagnostics(new ContainerGroupDiagnostics().withLogAnalytics(new LogAnalytics().withWorkspaceId(workspaceId).withWorkspaceKey(workspaceKey).withLogType(logType).withMetadata(metadata)));
return this;
}
@Override
public Map<String, Container> containers() {
return Collections.unmodifiableMap(this.containers);
@ -381,8 +474,8 @@ public class ContainerGroupImpl
@Override
public Set<Port> externalPorts() {
return Collections.unmodifiableSet(this.inner().ipAddress() != null && this.inner().ipAddress().ports() != null
? new HashSet<Port>(this.inner().ipAddress().ports())
: new HashSet<Port>());
? new HashSet<Port>(this.inner().ipAddress().ports())
: new HashSet<Port>());
}
@Override
@ -439,7 +532,12 @@ public class ContainerGroupImpl
@Override
public boolean isIPAddressPublic() {
return this.inner().ipAddress() != null && this.inner().ipAddress().type() != null && this.inner().ipAddress().type().toLowerCase().equals("public");
return this.inner().ipAddress() != null && this.inner().ipAddress().type() != null && this.inner().ipAddress().type() == ContainerGroupIpAddressType.PUBLIC;
}
@Override
public boolean isIPAddressPrivate() {
return this.inner().ipAddress() != null && this.inner().ipAddress().type() != null && this.inner().ipAddress().type() == ContainerGroupIpAddressType.PRIVATE;
}
@Override
@ -468,8 +566,61 @@ public class ContainerGroupImpl
@Override
public Set<Event> events() {
return Collections.unmodifiableSet(this.inner().instanceView() != null && this.inner().instanceView().events() != null
? new HashSet<Event>(this.inner().instanceView().events())
: new HashSet<Event>());
? new HashSet<Event>(this.inner().instanceView().events())
: new HashSet<Event>());
}
@Override
public DnsConfiguration dnsConfig() {
return this.inner().dnsConfig();
}
@Override
public String networkProfileId() {
return this.inner().networkProfile().id();
}
@Override
public boolean isManagedServiceIdentityEnabled() {
ResourceIdentityType type = this.managedServiceIdentityType();
return type != null && !type.equals(ResourceIdentityType.NONE);
}
@Override
public String systemAssignedManagedServiceIdentityTenantId() {
if (this.inner().identity() != null) {
return this.inner().identity().tenantId();
}
return null;
}
@Override
public String systemAssignedManagedServiceIdentityPrincipalId() {
if (this.inner().identity() != null) {
return this.inner().identity().principalId();
}
return null;
}
@Override
public ResourceIdentityType managedServiceIdentityType() {
if (this.inner().identity() != null) {
return this.inner().identity().type();
}
return null;
}
@Override
public Set<String> userAssignedManagedServiceIdentityIds() {
if (this.inner().identity() != null && this.inner().identity().userAssignedIdentities() != null) {
return Collections.unmodifiableSet(new HashSet<String>(this.inner().identity().userAssignedIdentities().keySet()));
}
return Collections.unmodifiableSet(new HashSet<String>());
}
@Override
public LogAnalytics logAnalytics() {
return this.inner().diagnostics().logAnalytics();
}
@Override
@ -515,28 +666,50 @@ public class ContainerGroupImpl
@Override
public ContainerExecResponse executeCommand(String containerName, String command, int row, int column) {
return new ContainerExecResponseImpl(this.manager().inner().containers()
.executeCommand(this.resourceGroupName(), this.name(), containerName,
new ContainerExecRequestInner()
.withCommand(command)
.withTerminalSize(new ContainerExecRequestTerminalSize()
.withRows(row)
.withCols(column))));
.executeCommand(this.resourceGroupName(), this.name(), containerName,
new ContainerExecRequest()
.withCommand(command)
.withTerminalSize(new ContainerExecRequestTerminalSize()
.withRows(row)
.withCols(column))));
}
@Override
public Observable<ContainerExecResponse> executeCommandAsync(String containerName, String command, int row, int column) {
return this.manager().inner().containers()
.executeCommandAsync(this.resourceGroupName(), this.name(), containerName,
new ContainerExecRequestInner()
.withCommand(command)
.withTerminalSize(new ContainerExecRequestTerminalSize()
.withRows(row)
.withCols(column)))
.map(new Func1<ContainerExecResponseInner, ContainerExecResponse>() {
@Override
public ContainerExecResponse call(ContainerExecResponseInner containerExecResponseInner) {
return new ContainerExecResponseImpl(containerExecResponseInner);
.executeCommandAsync(this.resourceGroupName(), this.name(), containerName,
new ContainerExecRequest()
.withCommand(command)
.withTerminalSize(new ContainerExecRequestTerminalSize()
.withRows(row)
.withCols(column)))
.map(new Func1<ContainerExecResponseInner, ContainerExecResponse>() {
@Override
public ContainerExecResponse call(ContainerExecResponseInner containerExecResponseInner) {
return new ContainerExecResponseImpl(containerExecResponseInner);
}
});
}
RoleAssignmentHelper.IdProvider idProvider() {
return new RoleAssignmentHelper.IdProvider() {
@Override
public String principalId() {
if (inner() != null && inner().identity() != null) {
return inner().identity().principalId();
} else {
return null;
}
});
}
@Override
public String resourceId() {
if (inner() != null) {
return inner().id();
} else {
return null;
}
}
};
}
}

Просмотреть файл

@ -8,8 +8,9 @@
package com.microsoft.azure.management.containerinstance.implementation;
import java.util.List;
import com.microsoft.azure.management.containerinstance.Container;
import com.microsoft.azure.management.containerinstance.ContainerGroupIdentity;
import java.util.List;
import com.microsoft.azure.management.containerinstance.ImageRegistryCredential;
import com.microsoft.azure.management.containerinstance.ContainerGroupRestartPolicy;
import com.microsoft.azure.management.containerinstance.IpAddress;
@ -17,15 +18,25 @@ import com.microsoft.azure.management.containerinstance.OperatingSystemTypes;
import com.microsoft.azure.management.containerinstance.Volume;
import com.microsoft.azure.management.containerinstance.ContainerGroupPropertiesInstanceView;
import com.microsoft.azure.management.containerinstance.ContainerGroupDiagnostics;
import com.microsoft.azure.management.containerinstance.ContainerGroupNetworkProfile;
import com.microsoft.azure.management.containerinstance.DnsConfiguration;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.rest.serializer.JsonFlatten;
import com.microsoft.rest.SkipParentValidation;
import com.microsoft.azure.Resource;
/**
* A container group.
*/
@JsonFlatten
@SkipParentValidation
public class ContainerGroupInner extends Resource {
/**
* The identity of the container group, if configured.
*/
@JsonProperty(value = "identity")
private ContainerGroupIdentity identity;
/**
* The provisioning state of the container group. This only appears in the
* response.
@ -89,7 +100,39 @@ public class ContainerGroupInner extends Resource {
private ContainerGroupDiagnostics diagnostics;
/**
* Get the provisioningState value.
* The network profile information for a container group.
*/
@JsonProperty(value = "properties.networkProfile")
private ContainerGroupNetworkProfile networkProfile;
/**
* The DNS config information for a container group.
*/
@JsonProperty(value = "properties.dnsConfig")
private DnsConfiguration dnsConfig;
/**
* Get the identity of the container group, if configured.
*
* @return the identity value
*/
public ContainerGroupIdentity identity() {
return this.identity;
}
/**
* Set the identity of the container group, if configured.
*
* @param identity the identity value to set
* @return the ContainerGroupInner object itself.
*/
public ContainerGroupInner withIdentity(ContainerGroupIdentity identity) {
this.identity = identity;
return this;
}
/**
* Get the provisioning state of the container group. This only appears in the response.
*
* @return the provisioningState value
*/
@ -98,7 +141,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Get the containers value.
* Get the containers within the container group.
*
* @return the containers value
*/
@ -107,7 +150,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Set the containers value.
* Set the containers within the container group.
*
* @param containers the containers value to set
* @return the ContainerGroupInner object itself.
@ -118,7 +161,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Get the imageRegistryCredentials value.
* Get the image registry credentials by which the container group is created from.
*
* @return the imageRegistryCredentials value
*/
@ -127,7 +170,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Set the imageRegistryCredentials value.
* Set the image registry credentials by which the container group is created from.
*
* @param imageRegistryCredentials the imageRegistryCredentials value to set
* @return the ContainerGroupInner object itself.
@ -138,7 +181,11 @@ public class ContainerGroupInner extends Resource {
}
/**
* Get the restartPolicy value.
* Get restart policy for all containers within the container group.
- `Always` Always restart
- `OnFailure` Restart on failure
- `Never` Never restart
. Possible values include: 'Always', 'OnFailure', 'Never'.
*
* @return the restartPolicy value
*/
@ -147,7 +194,11 @@ public class ContainerGroupInner extends Resource {
}
/**
* Set the restartPolicy value.
* Set restart policy for all containers within the container group.
- `Always` Always restart
- `OnFailure` Restart on failure
- `Never` Never restart
. Possible values include: 'Always', 'OnFailure', 'Never'.
*
* @param restartPolicy the restartPolicy value to set
* @return the ContainerGroupInner object itself.
@ -158,7 +209,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Get the ipAddress value.
* Get the IP address type of the container group.
*
* @return the ipAddress value
*/
@ -167,7 +218,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Set the ipAddress value.
* Set the IP address type of the container group.
*
* @param ipAddress the ipAddress value to set
* @return the ContainerGroupInner object itself.
@ -178,7 +229,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Get the osType value.
* Get the operating system type required by the containers in the container group. Possible values include: 'Windows', 'Linux'.
*
* @return the osType value
*/
@ -187,7 +238,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Set the osType value.
* Set the operating system type required by the containers in the container group. Possible values include: 'Windows', 'Linux'.
*
* @param osType the osType value to set
* @return the ContainerGroupInner object itself.
@ -198,7 +249,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Get the volumes value.
* Get the list of volumes that can be mounted by containers in this container group.
*
* @return the volumes value
*/
@ -207,7 +258,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Set the volumes value.
* Set the list of volumes that can be mounted by containers in this container group.
*
* @param volumes the volumes value to set
* @return the ContainerGroupInner object itself.
@ -218,7 +269,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Get the instanceView value.
* Get the instance view of the container group. Only valid in response.
*
* @return the instanceView value
*/
@ -227,7 +278,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Get the diagnostics value.
* Get the diagnostic information for a container group.
*
* @return the diagnostics value
*/
@ -236,7 +287,7 @@ public class ContainerGroupInner extends Resource {
}
/**
* Set the diagnostics value.
* Set the diagnostic information for a container group.
*
* @param diagnostics the diagnostics value to set
* @return the ContainerGroupInner object itself.
@ -246,4 +297,44 @@ public class ContainerGroupInner extends Resource {
return this;
}
/**
* Get the network profile information for a container group.
*
* @return the networkProfile value
*/
public ContainerGroupNetworkProfile networkProfile() {
return this.networkProfile;
}
/**
* Set the network profile information for a container group.
*
* @param networkProfile the networkProfile value to set
* @return the ContainerGroupInner object itself.
*/
public ContainerGroupInner withNetworkProfile(ContainerGroupNetworkProfile networkProfile) {
this.networkProfile = networkProfile;
return this;
}
/**
* Get the DNS config information for a container group.
*
* @return the dnsConfig value
*/
public DnsConfiguration dnsConfig() {
return this.dnsConfig;
}
/**
* Set the DNS config information for a container group.
*
* @param dnsConfig the dnsConfig value to set
* @return the ContainerGroupInner object itself.
*/
public ContainerGroupInner withDnsConfig(DnsConfiguration dnsConfig) {
this.dnsConfig = dnsConfig;
return this;
}
}

Просмотреть файл

@ -0,0 +1,120 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.management.containerinstance.implementation;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.containerinstance.ContainerGroupIdentity;
import com.microsoft.azure.management.containerinstance.ContainerGroupIdentityUserAssignedIdentitiesValue;
import com.microsoft.azure.management.containerinstance.ResourceIdentityType;
import com.microsoft.azure.management.graphrbac.implementation.GraphRbacManager;
import com.microsoft.azure.management.graphrbac.implementation.RoleAssignmentHelper;
import com.microsoft.azure.management.resources.fluentcore.dag.TaskGroup;
import com.microsoft.azure.management.resources.fluentcore.model.Creatable;
import com.microsoft.azure.management.msi.Identity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@LangDefinition
class ContainerGroupMsiHandler extends RoleAssignmentHelper {
private final ContainerGroupImpl containerGroup;
private List<String> creatableIdentityKeys;
private Map<String, ContainerGroupIdentityUserAssignedIdentitiesValue> userAssignedIdentities;
ContainerGroupMsiHandler(final GraphRbacManager rbacManager, ContainerGroupImpl containerGroup) {
super(rbacManager, containerGroup.taskGroup(), containerGroup.idProvider());
this.containerGroup = containerGroup;
this.creatableIdentityKeys = new ArrayList<>();
this.userAssignedIdentities = new HashMap<>();
}
void processCreatedExternalIdentities() {
for (String key : this.creatableIdentityKeys) {
Identity identity = (Identity) this.containerGroup.taskGroup().taskResult(key);
Objects.requireNonNull(identity);
this.userAssignedIdentities.put(identity.id(), new ContainerGroupIdentityUserAssignedIdentitiesValue());
}
this.creatableIdentityKeys.clear();
}
void handleExternalIdentities() {
if (!this.userAssignedIdentities.isEmpty()) {
this.containerGroup.inner().identity().withUserAssignedIdentities(this.userAssignedIdentities);
}
}
/**
* Specifies that Local Managed Service Identity needs to be enabled in the virtual machine.
* If MSI extension is not already installed then it will be installed with access token
* port as 50342.
*
* @return ContainerGroupMsiHandler
*/
ContainerGroupMsiHandler withLocalManagedServiceIdentity() {
this.initContainerInstanceIdentity(ResourceIdentityType.SYSTEM_ASSIGNED);
return this;
}
/**
* Specifies that given identity should be set as one of the External Managed Service Identity
* of the container instance.
*
* @param creatableIdentity yet-to-be-created identity to be associated with the container instance
* @return ContainerGroupMsiHandler
*/
ContainerGroupMsiHandler withNewExternalManagedServiceIdentity(Creatable<Identity> creatableIdentity) {
this.initContainerInstanceIdentity(ResourceIdentityType.USER_ASSIGNED);
TaskGroup.HasTaskGroup dependency = (TaskGroup.HasTaskGroup) creatableIdentity;
Objects.requireNonNull(dependency);
this.containerGroup.taskGroup().addDependency(dependency);
this.creatableIdentityKeys.add(creatableIdentity.key());
return this;
}
/**
* Specifies that given identity should be set as one of the External Managed Service Identity
* of the container instance.
*
* @param identity an identity to associate
* @return ContainerGroupMsiHandler
*/
ContainerGroupMsiHandler withExistingExternalManagedServiceIdentity(Identity identity) {
this.initContainerInstanceIdentity(ResourceIdentityType.USER_ASSIGNED);
this.userAssignedIdentities.put(identity.id(), new ContainerGroupIdentityUserAssignedIdentitiesValue());
return this;
}
/**
* Initialize Container Instance's identity property.
*
* @param identityType the identity type to set
*/
private void initContainerInstanceIdentity(ResourceIdentityType identityType) {
if (!identityType.equals(ResourceIdentityType.USER_ASSIGNED)
&& !identityType.equals(ResourceIdentityType.SYSTEM_ASSIGNED)) {
throw new IllegalArgumentException("Invalid argument: " + identityType);
}
ContainerGroupInner containerGroupInner = this.containerGroup.inner();
if (containerGroupInner.identity() == null) {
containerGroupInner.withIdentity(new ContainerGroupIdentity());
}
if (containerGroupInner.identity().type() == null
|| containerGroupInner.identity().type().equals(ResourceIdentityType.NONE)
|| containerGroupInner.identity().type().equals(identityType)) {
containerGroupInner.identity().withType(identityType);
} else {
containerGroupInner.identity().withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED);
}
}
}

Просмотреть файл

@ -9,9 +9,12 @@ package com.microsoft.azure.management.containerinstance.implementation;
import com.microsoft.azure.PagedList;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.containerinstance.CachedImages;
import com.microsoft.azure.management.containerinstance.Capabilities;
import com.microsoft.azure.management.containerinstance.ContainerGroup;
import com.microsoft.azure.management.containerinstance.ContainerGroups;
import com.microsoft.azure.management.containerinstance.Operation;
import com.microsoft.azure.management.graphrbac.implementation.GraphRbacManager;
import com.microsoft.azure.management.resources.fluentcore.arm.collection.implementation.TopLevelModifiableResourcesImpl;
import com.microsoft.azure.management.resources.fluentcore.utils.PagedListConverter;
import com.microsoft.azure.management.storage.implementation.StorageManager;
@ -21,6 +24,7 @@ import rx.functions.Func1;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
@ -28,25 +32,27 @@ import java.util.Set;
*/
@LangDefinition
public class ContainerGroupsImpl
extends
TopLevelModifiableResourcesImpl<
extends
TopLevelModifiableResourcesImpl<
ContainerGroup,
ContainerGroupImpl,
ContainerGroupInner,
ContainerGroupsInner,
ContainerInstanceManager>
implements ContainerGroups {
implements ContainerGroups {
private final StorageManager storageManager;
private final GraphRbacManager rbacManager;
protected ContainerGroupsImpl(final ContainerInstanceManager manager, final StorageManager storageManager) {
protected ContainerGroupsImpl(final ContainerInstanceManager manager, final StorageManager storageManager, final GraphRbacManager rbacManager) {
super(manager.inner().containerGroups(), manager);
this.storageManager = storageManager;
this.rbacManager = rbacManager;
}
@Override
protected ContainerGroupImpl wrapModel(String name) {
return new ContainerGroupImpl(name, new ContainerGroupInner(), this.manager(), this.storageManager);
return new ContainerGroupImpl(name, new ContainerGroupInner(), this.manager(), this.storageManager, this.rbacManager);
}
@Override
@ -54,7 +60,7 @@ public class ContainerGroupsImpl
if (inner == null) {
return null;
}
return new ContainerGroupImpl(inner.name(), inner, this.manager(), this.storageManager);
return new ContainerGroupImpl(inner.name(), inner, this.manager(), this.storageManager, this.rbacManager);
}
@Override
@ -84,23 +90,23 @@ public class ContainerGroupsImpl
@Override
public Observable<String> getLogContentAsync(String resourceGroupName, String containerGroupName, String containerName) {
return this.manager().inner().containers().listLogsAsync(resourceGroupName, containerGroupName, containerName)
.map(new Func1<LogsInner, String>() {
@Override
public String call(LogsInner logsInner) {
return logsInner.content();
}
});
.map(new Func1<LogsInner, String>() {
@Override
public String call(LogsInner logsInner) {
return logsInner.content();
}
});
}
@Override
public Observable<String> getLogContentAsync(String resourceGroupName, String containerGroupName, String containerName, int tailLineCount) {
return this.manager().inner().containers().listLogsAsync(resourceGroupName, containerGroupName, containerName, tailLineCount)
.map(new Func1<LogsInner, String>() {
@Override
public String call(LogsInner logsInner) {
return logsInner.content();
}
});
.map(new Func1<LogsInner, String>() {
@Override
public String call(LogsInner logsInner) {
return logsInner.content();
}
});
}
@Override
@ -108,43 +114,85 @@ public class ContainerGroupsImpl
OperationListResultInner operationListResultInner = this.manager().inner().operations().list();
return Collections.unmodifiableSet(operationListResultInner != null && operationListResultInner.value() != null
? new HashSet<Operation>(operationListResultInner.value())
: new HashSet<Operation>());
? new HashSet<Operation>(operationListResultInner.value())
: new HashSet<Operation>());
}
@Override
public Observable<Set<Operation>> listOperationsAsync() {
return this.manager().inner().operations().listAsync()
.map(new Func1<OperationListResultInner, Set<Operation>>() {
@Override
public Set<Operation> call(OperationListResultInner operationListResultInner) {
return Collections.unmodifiableSet(operationListResultInner != null && operationListResultInner.value() != null
? new HashSet<Operation>(operationListResultInner.value())
: new HashSet<Operation>());
}
});
.map(new Func1<OperationListResultInner, Set<Operation>>() {
@Override
public Set<Operation> call(OperationListResultInner operationListResultInner) {
return Collections.unmodifiableSet(operationListResultInner != null && operationListResultInner.value() != null
? new HashSet<Operation>(operationListResultInner.value())
: new HashSet<Operation>());
}
});
}
@Override
public List<CachedImages> listCachedImages(String location) {
return this.manager().inner().listCachedImages(location).value();
}
@Override
public Observable<CachedImages> listCachedImagesAsync(String location) {
return this.manager().inner().listCachedImagesAsync(location)
.flatMap(new Func1<CachedImagesListResultInner, Observable<CachedImages>>() {
@Override
public Observable<CachedImages> call(CachedImagesListResultInner cachedImagesListResultInner) {
return Observable.from(cachedImagesListResultInner.value());
}
});
}
@Override
public List<Capabilities> listCapabilities(String location) {
return this.manager().inner().listCapabilities(location).value();
}
@Override
public Observable<Capabilities> listCapabilitiesAsync(String location) {
return this.manager().inner().listCapabilitiesAsync(location)
.flatMap(new Func1<CapabilitiesListResultInner, Observable<Capabilities>>() {
@Override
public Observable<Capabilities> call(CapabilitiesListResultInner capabilitiesListResultInner) {
return Observable.from(capabilitiesListResultInner.value());
}
});
}
@Override
public void start(String resourceGroupName, String containerGroupName) {
this.manager().inner().containerGroups().start(resourceGroupName, containerGroupName);
}
@Override
public Completable startAsync(String resourceGroupName, String containerGroupName) {
return this.manager().inner().containerGroups().startAsync(resourceGroupName, containerGroupName).toCompletable();
}
@Override
public Observable<ContainerGroup> listAsync() {
return wrapPageAsync(inner().listAsync())
.flatMap(new Func1<ContainerGroup, Observable<ContainerGroup>>() {
@Override
public Observable<ContainerGroup> call(ContainerGroup containerGroup) {
return containerGroup.refreshAsync();
}
});
.flatMap(new Func1<ContainerGroup, Observable<ContainerGroup>>() {
@Override
public Observable<ContainerGroup> call(ContainerGroup containerGroup) {
return containerGroup.refreshAsync();
}
});
}
@Override
public Observable<ContainerGroup> listByResourceGroupAsync(String resourceGroupName) {
return wrapPageAsync(inner().listByResourceGroupAsync(resourceGroupName))
.flatMap(new Func1<ContainerGroup, Observable<ContainerGroup>>() {
@Override
public Observable<ContainerGroup> call(ContainerGroup containerGroup) {
return containerGroup.refreshAsync();
}
});
.flatMap(new Func1<ContainerGroup, Observable<ContainerGroup>>() {
@Override
public Observable<ContainerGroup> call(ContainerGroup containerGroup) {
return containerGroup.refreshAsync();
}
});
}
@Override

Просмотреть файл

@ -107,6 +107,14 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/stop")
Observable<Response<ResponseBody>> stop(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ContainerGroups start" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start")
Observable<Response<ResponseBody>> start(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ContainerGroups beginStart" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/start")
Observable<Response<ResponseBody>> beginStart(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ContainerGroups listNext" })
@GET
Observable<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@ -810,7 +818,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Restarts all containers in a container group.
* Restarts all containers in a contaienr group in place. If container image has updates, new image will be downloaded.
* Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -824,7 +832,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Restarts all containers in a container group.
* Restarts all containers in a contaienr group in place. If container image has updates, new image will be downloaded.
* Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -838,7 +846,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Restarts all containers in a container group.
* Restarts all containers in a contaienr group in place. If container image has updates, new image will be downloaded.
* Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -856,7 +864,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Restarts all containers in a container group.
* Restarts all containers in a contaienr group in place. If container image has updates, new image will be downloaded.
* Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -882,7 +890,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Restarts all containers in a container group.
* Restarts all containers in a contaienr group in place. If container image has updates, new image will be downloaded.
* Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -896,7 +904,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Restarts all containers in a container group.
* Restarts all containers in a contaienr group in place. If container image has updates, new image will be downloaded.
* Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -910,7 +918,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Restarts all containers in a container group.
* Restarts all containers in a contaienr group in place. If container image has updates, new image will be downloaded.
* Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -928,7 +936,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Restarts all containers in a container group.
* Restarts all containers in a contaienr group in place. If container image has updates, new image will be downloaded.
* Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -971,7 +979,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Stops all containers in a container group.
* Stops all containers in a contaienr group. Compute resources will be deallocated and billing will stop.
* Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -985,7 +993,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Stops all containers in a container group.
* Stops all containers in a contaienr group. Compute resources will be deallocated and billing will stop.
* Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -999,7 +1007,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Stops all containers in a container group.
* Stops all containers in a contaienr group. Compute resources will be deallocated and billing will stop.
* Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -1017,7 +1025,7 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
/**
* Stops all containers in a container group.
* Stops all containers in a contaienr group. Compute resources will be deallocated and billing will stop.
* Stops all containers in a container group. Compute resources will be deallocated and billing will stop.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
@ -1058,6 +1066,167 @@ public class ContainerGroupsInner implements InnerSupportsGet<ContainerGroupInne
.build(response);
}
/**
* Starts all containers in a container group.
* Starts all containers in a container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void start(String resourceGroupName, String containerGroupName) {
startWithServiceResponseAsync(resourceGroupName, containerGroupName).toBlocking().last().body();
}
/**
* Starts all containers in a container group.
* Starts all containers in a container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<Void> startAsync(String resourceGroupName, String containerGroupName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(startWithServiceResponseAsync(resourceGroupName, containerGroupName), serviceCallback);
}
/**
* Starts all containers in a container group.
* Starts all containers in a container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<Void> startAsync(String resourceGroupName, String containerGroupName) {
return startWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
/**
* Starts all containers in a container group.
* Starts all containers in a container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/
public Observable<ServiceResponse<Void>> startWithServiceResponseAsync(String resourceGroupName, String containerGroupName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (containerGroupName == null) {
throw new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Observable<Response<ResponseBody>> observable = service.start(this.client.subscriptionId(), resourceGroupName, containerGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
}
/**
* Starts all containers in a container group.
* Starts all containers in a container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void beginStart(String resourceGroupName, String containerGroupName) {
beginStartWithServiceResponseAsync(resourceGroupName, containerGroupName).toBlocking().single().body();
}
/**
* Starts all containers in a container group.
* Starts all containers in a container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<Void> beginStartAsync(String resourceGroupName, String containerGroupName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginStartWithServiceResponseAsync(resourceGroupName, containerGroupName), serviceCallback);
}
/**
* Starts all containers in a container group.
* Starts all containers in a container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<Void> beginStartAsync(String resourceGroupName, String containerGroupName) {
return beginStartWithServiceResponseAsync(resourceGroupName, containerGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
/**
* Starts all containers in a container group.
* Starts all containers in a container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> beginStartWithServiceResponseAsync(String resourceGroupName, String containerGroupName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (containerGroupName == null) {
throw new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.beginStart(this.client.subscriptionId(), resourceGroupName, containerGroupName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = beginStartDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<Void> beginStartDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
.register(204, new TypeToken<Void>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Get a list of container groups in the specified subscription.
* Get a list of container groups in the specified subscription. This operation returns properties of each container group including containers, image registry credentials, restart policy, IP address type, OS type, state, and volumes.

Просмотреть файл

@ -8,10 +8,13 @@ package com.microsoft.azure.management.containerinstance.implementation;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.containerinstance.Container;
import com.microsoft.azure.management.containerinstance.ContainerGroup;
import com.microsoft.azure.management.containerinstance.ContainerGroupIpAddressType;
import com.microsoft.azure.management.containerinstance.ContainerGroupNetworkProtocol;
import com.microsoft.azure.management.containerinstance.ContainerNetworkProtocol;
import com.microsoft.azure.management.containerinstance.ContainerPort;
import com.microsoft.azure.management.containerinstance.EnvironmentVariable;
import com.microsoft.azure.management.containerinstance.GpuResource;
import com.microsoft.azure.management.containerinstance.GpuSku;
import com.microsoft.azure.management.containerinstance.IpAddress;
import com.microsoft.azure.management.containerinstance.Port;
import com.microsoft.azure.management.containerinstance.ResourceRequests;
@ -26,18 +29,18 @@ import java.util.Map;
*/
@LangDefinition
class ContainerImpl implements
ContainerGroup.DefinitionStages.ContainerInstanceDefinitionStages.ContainerInstanceDefinition<ContainerGroup.DefinitionStages.WithNextContainerInstance> {
ContainerGroup.DefinitionStages.ContainerInstanceDefinitionStages.ContainerInstanceDefinition<ContainerGroup.DefinitionStages.WithNextContainerInstance> {
private Container innerContainer;
private ContainerGroupImpl parent;
ContainerImpl(ContainerGroupImpl parent, String containerName) {
this.parent = parent;
this.innerContainer = new Container()
.withName(containerName)
.withResources(new ResourceRequirements()
.withRequests(new ResourceRequests()
.withCpu(1)
.withMemoryInGB(1.5)));
.withName(containerName)
.withResources(new ResourceRequirements()
.withRequests(new ResourceRequests()
.withCpu(1)
.withMemoryInGB(1.5)));
}
@Override
@ -75,8 +78,8 @@ class ContainerImpl implements
@Override
public ContainerImpl withExternalTcpPort(int port) {
ensureParentIpAddress().ports().add(new Port()
.withPort(port)
.withProtocol(ContainerGroupNetworkProtocol.TCP));
.withPort(port)
.withProtocol(ContainerGroupNetworkProtocol.TCP));
this.withInternalTcpPort(port);
return this;
@ -86,7 +89,11 @@ class ContainerImpl implements
if (parent.inner().ipAddress() == null) {
parent.inner().withIpAddress(new IpAddress());
}
parent.inner().ipAddress().withType("Public");
if (parent.inner().ipAddress().type() == null && parent.inner().ipAddress().dnsNameLabel() == null) {
parent.inner().ipAddress().withType(ContainerGroupIpAddressType.PRIVATE);
} else {
parent.inner().ipAddress().withType(ContainerGroupIpAddressType.PUBLIC);
}
if (parent.inner().ipAddress().ports() == null) {
parent.inner().ipAddress().withPorts(new ArrayList<Port>());
}
@ -106,8 +113,8 @@ class ContainerImpl implements
@Override
public ContainerImpl withExternalUdpPort(int port) {
ensureParentIpAddress().ports().add(new Port()
.withPort(port)
.withProtocol(ContainerGroupNetworkProtocol.UDP));
.withPort(port)
.withProtocol(ContainerGroupNetworkProtocol.UDP));
this.withInternalUdpPort(port);
return this;
@ -154,7 +161,12 @@ class ContainerImpl implements
@Override
public ContainerImpl withCpuCoreCount(double cpuCoreCount) {
innerContainer.resources().requests().withCpu(cpuCoreCount);
return this;
}
@Override
public ContainerImpl withGpuResource(int gpuCoreCount, GpuSku gpuSku) {
innerContainer.resources().requests().withGpu(new GpuResource().withCount(gpuCoreCount).withSku(gpuSku));
return this;
}
@ -203,8 +215,8 @@ class ContainerImpl implements
}
innerContainer.environmentVariables().add(new EnvironmentVariable()
.withName(envName)
.withValue(envValue));
.withName(envName)
.withValue(envValue));
return this;
}
@ -225,8 +237,8 @@ class ContainerImpl implements
}
innerContainer.environmentVariables().add(new EnvironmentVariable()
.withName(envName)
.withSecureValue(securedValue));
.withName(envName)
.withSecureValue(securedValue));
return this;
}
@ -237,9 +249,9 @@ class ContainerImpl implements
innerContainer.withVolumeMounts(new ArrayList<VolumeMount>());
}
innerContainer.volumeMounts().add(new VolumeMount()
.withName(volumeName)
.withMountPath(mountPath)
.withReadOnly(false));
.withName(volumeName)
.withMountPath(mountPath)
.withReadOnly(false));
return this;
}
@ -259,9 +271,9 @@ class ContainerImpl implements
innerContainer.withVolumeMounts(new ArrayList<VolumeMount>());
}
innerContainer.volumeMounts().add(new VolumeMount()
.withName(volumeName)
.withMountPath(mountPath)
.withReadOnly(true));
.withName(volumeName)
.withMountPath(mountPath)
.withReadOnly(true));
return this;
}

Просмотреть файл

@ -8,15 +8,32 @@
package com.microsoft.azure.management.containerinstance.implementation;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureClient;
import com.microsoft.azure.AzureServiceClient;
import com.microsoft.azure.CloudException;
import com.microsoft.rest.credentials.ServiceClientCredentials;
import com.microsoft.rest.RestClient;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* Initializes a new instance of the ContainerInstanceManagementClientImpl class.
*/
public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
/** The Retrofit service to perform REST calls. */
private ContainerInstanceManagementClientService service;
/** the {@link AzureClient} used for long running operations. */
private AzureClient azureClient;
@ -63,11 +80,11 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
return this.apiVersion;
}
/** Gets or sets the preferred language for the response. */
/** The preferred language for the response. */
private String acceptLanguage;
/**
* Gets Gets or sets the preferred language for the response.
* Gets The preferred language for the response.
*
* @return the acceptLanguage value.
*/
@ -76,7 +93,7 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
}
/**
* Sets Gets or sets the preferred language for the response.
* Sets The preferred language for the response.
*
* @param acceptLanguage the acceptLanguage value.
* @return the service client itself
@ -86,11 +103,11 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
return this;
}
/** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */
/** The retry timeout in seconds for Long Running Operations. Default value is 30. */
private int longRunningOperationRetryTimeout;
/**
* Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* Gets The retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @return the longRunningOperationRetryTimeout value.
*/
@ -99,7 +116,7 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
}
/**
* Sets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30.
* Sets The retry timeout in seconds for Long Running Operations. Default value is 30.
*
* @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value.
* @return the service client itself
@ -109,11 +126,11 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
return this;
}
/** When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */
/** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */
private boolean generateClientRequestId;
/**
* Gets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
* Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
* @return the generateClientRequestId value.
*/
@ -122,7 +139,7 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
}
/**
* Sets When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
* Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.
*
* @param generateClientRequestId the generateClientRequestId value.
* @return the service client itself
@ -184,6 +201,19 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
return this.containers;
}
/**
* The ServiceAssociationLinksInner object to access its operations.
*/
private ServiceAssociationLinksInner serviceAssociationLinks;
/**
* Gets the ServiceAssociationLinksInner object to access its operations.
* @return the ServiceAssociationLinksInner object.
*/
public ServiceAssociationLinksInner serviceAssociationLinks() {
return this.serviceAssociationLinks;
}
/**
* Initializes an instance of ContainerInstanceManagementClient client.
*
@ -215,7 +245,7 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
}
protected void initialize() {
this.apiVersion = "2018-06-01";
this.apiVersion = "2018-10-01";
this.acceptLanguage = "en-US";
this.longRunningOperationRetryTimeout = 30;
this.generateClientRequestId = true;
@ -223,7 +253,9 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
this.operations = new OperationsInner(restClient().retrofit(), this);
this.containerGroupUsages = new ContainerGroupUsagesInner(restClient().retrofit(), this);
this.containers = new ContainersInner(restClient().retrofit(), this);
this.serviceAssociationLinks = new ServiceAssociationLinksInner(restClient().retrofit(), this);
this.azureClient = new AzureClient(this);
initializeService();
}
/**
@ -233,6 +265,192 @@ public class ContainerInstanceManagementClientImpl extends AzureServiceClient {
*/
@Override
public String userAgent() {
return String.format("%s (%s, %s)", super.userAgent(), "ContainerInstanceManagementClient", "2018-06-01");
return String.format("%s (%s, %s)", super.userAgent(), "ContainerInstanceManagementClient", "2018-10-01");
}
private void initializeService() {
service = restClient().retrofit().create(ContainerInstanceManagementClientService.class);
}
/**
* The interface defining all the services for ContainerInstanceManagementClient to be
* used by Retrofit to perform actually REST calls.
*/
interface ContainerInstanceManagementClientService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ContainerInstanceManagementClient listCachedImages" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages")
Observable<Response<ResponseBody>> listCachedImages(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ContainerInstanceManagementClient listCapabilities" })
@GET("subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities")
Observable<Response<ResponseBody>> listCapabilities(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
/**
* Get the list of cached images.
* Get the list of cached images on specific OS type for a subscription in a region.
*
* @param location The identifier for the physical azure location.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the CachedImagesListResultInner object if successful.
*/
public CachedImagesListResultInner listCachedImages(String location) {
return listCachedImagesWithServiceResponseAsync(location).toBlocking().single().body();
}
/**
* Get the list of cached images.
* Get the list of cached images on specific OS type for a subscription in a region.
*
* @param location The identifier for the physical azure location.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<CachedImagesListResultInner> listCachedImagesAsync(String location, final ServiceCallback<CachedImagesListResultInner> serviceCallback) {
return ServiceFuture.fromResponse(listCachedImagesWithServiceResponseAsync(location), serviceCallback);
}
/**
* Get the list of cached images.
* Get the list of cached images on specific OS type for a subscription in a region.
*
* @param location The identifier for the physical azure location.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CachedImagesListResultInner object
*/
public Observable<CachedImagesListResultInner> listCachedImagesAsync(String location) {
return listCachedImagesWithServiceResponseAsync(location).map(new Func1<ServiceResponse<CachedImagesListResultInner>, CachedImagesListResultInner>() {
@Override
public CachedImagesListResultInner call(ServiceResponse<CachedImagesListResultInner> response) {
return response.body();
}
});
}
/**
* Get the list of cached images.
* Get the list of cached images on specific OS type for a subscription in a region.
*
* @param location The identifier for the physical azure location.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CachedImagesListResultInner object
*/
public Observable<ServiceResponse<CachedImagesListResultInner>> listCachedImagesWithServiceResponseAsync(String location) {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (location == null) {
throw new IllegalArgumentException("Parameter location is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
return service.listCachedImages(this.subscriptionId(), location, this.apiVersion(), this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CachedImagesListResultInner>>>() {
@Override
public Observable<ServiceResponse<CachedImagesListResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CachedImagesListResultInner> clientResponse = listCachedImagesDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<CachedImagesListResultInner> listCachedImagesDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.restClient().responseBuilderFactory().<CachedImagesListResultInner, CloudException>newInstance(this.serializerAdapter())
.register(200, new TypeToken<CachedImagesListResultInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
/**
* Get the list of capabilities of the location.
* Get the list of CPU/memory/GPU capabilities of a region.
*
* @param location The identifier for the physical azure location.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the CapabilitiesListResultInner object if successful.
*/
public CapabilitiesListResultInner listCapabilities(String location) {
return listCapabilitiesWithServiceResponseAsync(location).toBlocking().single().body();
}
/**
* Get the list of capabilities of the location.
* Get the list of CPU/memory/GPU capabilities of a region.
*
* @param location The identifier for the physical azure location.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<CapabilitiesListResultInner> listCapabilitiesAsync(String location, final ServiceCallback<CapabilitiesListResultInner> serviceCallback) {
return ServiceFuture.fromResponse(listCapabilitiesWithServiceResponseAsync(location), serviceCallback);
}
/**
* Get the list of capabilities of the location.
* Get the list of CPU/memory/GPU capabilities of a region.
*
* @param location The identifier for the physical azure location.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CapabilitiesListResultInner object
*/
public Observable<CapabilitiesListResultInner> listCapabilitiesAsync(String location) {
return listCapabilitiesWithServiceResponseAsync(location).map(new Func1<ServiceResponse<CapabilitiesListResultInner>, CapabilitiesListResultInner>() {
@Override
public CapabilitiesListResultInner call(ServiceResponse<CapabilitiesListResultInner> response) {
return response.body();
}
});
}
/**
* Get the list of capabilities of the location.
* Get the list of CPU/memory/GPU capabilities of a region.
*
* @param location The identifier for the physical azure location.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the CapabilitiesListResultInner object
*/
public Observable<ServiceResponse<CapabilitiesListResultInner>> listCapabilitiesWithServiceResponseAsync(String location) {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (location == null) {
throw new IllegalArgumentException("Parameter location is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
return service.listCapabilities(this.subscriptionId(), location, this.apiVersion(), this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CapabilitiesListResultInner>>>() {
@Override
public Observable<ServiceResponse<CapabilitiesListResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CapabilitiesListResultInner> clientResponse = listCapabilitiesDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<CapabilitiesListResultInner> listCapabilitiesDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.restClient().responseBuilderFactory().<CapabilitiesListResultInner, CloudException>newInstance(this.serializerAdapter())
.register(200, new TypeToken<CapabilitiesListResultInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}

Просмотреть файл

@ -11,7 +11,9 @@ import com.microsoft.azure.AzureResponseBuilder;
import com.microsoft.azure.credentials.AzureTokenCredentials;
import com.microsoft.azure.management.apigeneration.Beta;
import com.microsoft.azure.management.apigeneration.Beta.SinceVersion;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.containerinstance.ContainerGroups;
import com.microsoft.azure.management.graphrbac.implementation.GraphRbacManager;
import com.microsoft.azure.management.resources.fluentcore.arm.AzureConfigurable;
import com.microsoft.azure.management.resources.fluentcore.arm.implementation.AzureConfigurableImpl;
import com.microsoft.azure.management.resources.fluentcore.arm.implementation.Manager;
@ -24,12 +26,14 @@ import com.microsoft.rest.RestClient;
/**
* Entry point to Azure container instance management.
*/
@LangDefinition
@Beta(SinceVersion.V1_3_0)
public final class ContainerInstanceManager extends Manager<ContainerInstanceManager, ContainerInstanceManagementClientImpl> {
// The service managers
private ContainerGroupsImpl containerGroups;
private StorageManager storageManager;
private GraphRbacManager rbacManager;
/**
* Get a Configurable instance that can be used to create ContainerInstanceManager with optional configuration.
@ -100,16 +104,17 @@ public final class ContainerInstanceManager extends Manager<ContainerInstanceMan
new ContainerInstanceManagementClientImpl(restClient).withSubscriptionId(subscriptionId));
this.storageManager = StorageManager.authenticate(restClient, subscriptionId);
this.rbacManager = GraphRbacManager.authenticate(restClient, ((AzureTokenCredentials) (restClient.credentials())).domain());
}
/**
* @return the resource management API entry point
*/
public ContainerGroups containerGroups() {
if (containerGroups == null) {
containerGroups = new ContainerGroupsImpl(this, this.storageManager);
if (this.containerGroups == null) {
this.containerGroups = new ContainerGroupsImpl(this, this.storageManager, this.rbacManager);
}
return containerGroups;
return this.containerGroups;
}
}

Просмотреть файл

@ -1,252 +0,0 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance.implementation;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.CloudException;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* An instance of this class provides access to all the operations defined
* in ContainerLogs.
*/
public class ContainerLogsInner {
/** The Retrofit service to perform REST calls. */
private ContainerLogsService service;
/** The service client containing this operation class. */
private ContainerInstanceManagementClientImpl client;
/**
* Initializes an instance of ContainerLogsInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public ContainerLogsInner(Retrofit retrofit, ContainerInstanceManagementClientImpl client) {
this.service = retrofit.create(ContainerLogsService.class);
this.client = client;
}
/**
* The interface defining all the services for ContainerLogs to be
* used by Retrofit to perform actually REST calls.
*/
interface ContainerLogsService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ContainerLogs list" })
@GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/logs")
Observable<Response<ResponseBody>> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Query("tail") Integer tail, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
/**
* Get the logs for a specified container instance.
* Get the logs for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the LogsInner object if successful.
*/
public LogsInner list(String resourceGroupName, String containerGroupName, String containerName) {
return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName).toBlocking().single().body();
}
/**
* Get the logs for a specified container instance.
* Get the logs for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<LogsInner> listAsync(String resourceGroupName, String containerGroupName, String containerName, final ServiceCallback<LogsInner> serviceCallback) {
return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName), serviceCallback);
}
/**
* Get the logs for a specified container instance.
* Get the logs for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the LogsInner object
*/
public Observable<LogsInner> listAsync(String resourceGroupName, String containerGroupName, String containerName) {
return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName).map(new Func1<ServiceResponse<LogsInner>, LogsInner>() {
@Override
public LogsInner call(ServiceResponse<LogsInner> response) {
return response.body();
}
});
}
/**
* Get the logs for a specified container instance.
* Get the logs for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the LogsInner object
*/
public Observable<ServiceResponse<LogsInner>> listWithServiceResponseAsync(String resourceGroupName, String containerGroupName, String containerName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (containerGroupName == null) {
throw new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.");
}
if (containerName == null) {
throw new IllegalArgumentException("Parameter containerName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final Integer tail = null;
return service.list(this.client.subscriptionId(), resourceGroupName, containerGroupName, containerName, this.client.apiVersion(), tail, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<LogsInner>>>() {
@Override
public Observable<ServiceResponse<LogsInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<LogsInner> clientResponse = listDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
/**
* Get the logs for a specified container instance.
* Get the logs for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param tail The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the LogsInner object if successful.
*/
public LogsInner list(String resourceGroupName, String containerGroupName, String containerName, Integer tail) {
return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail).toBlocking().single().body();
}
/**
* Get the logs for a specified container instance.
* Get the logs for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param tail The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<LogsInner> listAsync(String resourceGroupName, String containerGroupName, String containerName, Integer tail, final ServiceCallback<LogsInner> serviceCallback) {
return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail), serviceCallback);
}
/**
* Get the logs for a specified container instance.
* Get the logs for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param tail The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the LogsInner object
*/
public Observable<LogsInner> listAsync(String resourceGroupName, String containerGroupName, String containerName, Integer tail) {
return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail).map(new Func1<ServiceResponse<LogsInner>, LogsInner>() {
@Override
public LogsInner call(ServiceResponse<LogsInner> response) {
return response.body();
}
});
}
/**
* Get the logs for a specified container instance.
* Get the logs for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param tail The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the LogsInner object
*/
public Observable<ServiceResponse<LogsInner>> listWithServiceResponseAsync(String resourceGroupName, String containerGroupName, String containerName, Integer tail) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (containerGroupName == null) {
throw new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.");
}
if (containerName == null) {
throw new IllegalArgumentException("Parameter containerName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.list(this.client.subscriptionId(), resourceGroupName, containerGroupName, containerName, this.client.apiVersion(), tail, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<LogsInner>>>() {
@Override
public Observable<ServiceResponse<LogsInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<LogsInner> clientResponse = listDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<LogsInner> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<LogsInner, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<LogsInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}

Просмотреть файл

@ -11,6 +11,7 @@ package com.microsoft.azure.management.containerinstance.implementation;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.CloudException;
import com.microsoft.azure.management.containerinstance.ContainerExecRequest;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
@ -60,7 +61,7 @@ public class ContainersInner {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.Containers executeCommand" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec")
Observable<Response<ResponseBody>> executeCommand(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body ContainerExecRequestInner containerExecRequest, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Observable<Response<ResponseBody>> executeCommand(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body ContainerExecRequest containerExecRequest, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
@ -269,7 +270,7 @@ public class ContainersInner {
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ContainerExecResponseInner object if successful.
*/
public ContainerExecResponseInner executeCommand(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) {
public ContainerExecResponseInner executeCommand(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) {
return executeCommandWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body();
}
@ -285,7 +286,7 @@ public class ContainersInner {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<ContainerExecResponseInner> executeCommandAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest, final ServiceCallback<ContainerExecResponseInner> serviceCallback) {
public ServiceFuture<ContainerExecResponseInner> executeCommandAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest, final ServiceCallback<ContainerExecResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(executeCommandWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest), serviceCallback);
}
@ -300,7 +301,7 @@ public class ContainersInner {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ContainerExecResponseInner object
*/
public Observable<ContainerExecResponseInner> executeCommandAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) {
public Observable<ContainerExecResponseInner> executeCommandAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) {
return executeCommandWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).map(new Func1<ServiceResponse<ContainerExecResponseInner>, ContainerExecResponseInner>() {
@Override
public ContainerExecResponseInner call(ServiceResponse<ContainerExecResponseInner> response) {
@ -320,7 +321,7 @@ public class ContainersInner {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ContainerExecResponseInner object
*/
public Observable<ServiceResponse<ContainerExecResponseInner>> executeCommandWithServiceResponseAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) {
public Observable<ServiceResponse<ContainerExecResponseInner>> executeCommandWithServiceResponseAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequest containerExecRequest) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}

Просмотреть файл

@ -21,7 +21,7 @@ public class LogsInner {
private String content;
/**
* Get the content value.
* Get the content of the log.
*
* @return the content value
*/
@ -30,7 +30,7 @@ public class LogsInner {
}
/**
* Set the content value.
* Set the content of the log.
*
* @param content the content value to set
* @return the LogsInner object itself.

Просмотреть файл

@ -9,8 +9,8 @@
package com.microsoft.azure.management.containerinstance.implementation;
import java.util.List;
import com.microsoft.azure.management.containerinstance.Operation;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.microsoft.azure.management.containerinstance.Operation;
/**
* The operation list response that contains all operations for Azure Container
@ -30,7 +30,7 @@ public class OperationListResultInner {
private String nextLink;
/**
* Get the value value.
* Get the list of operations.
*
* @return the value value
*/
@ -39,7 +39,7 @@ public class OperationListResultInner {
}
/**
* Set the value value.
* Set the list of operations.
*
* @param value the value value to set
* @return the OperationListResultInner object itself.
@ -50,7 +50,7 @@ public class OperationListResultInner {
}
/**
* Get the nextLink value.
* Get the URI to fetch the next page of operations.
*
* @return the nextLink value
*/
@ -59,7 +59,7 @@ public class OperationListResultInner {
}
/**
* Set the nextLink value.
* Set the URI to fetch the next page of operations.
*
* @param nextLink the nextLink value to set
* @return the OperationListResultInner object itself.

Просмотреть файл

@ -0,0 +1,157 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance.implementation;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.CloudException;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.HTTP;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* An instance of this class provides access to all the operations defined
* in ServiceAssociationLinks.
*/
public class ServiceAssociationLinksInner {
/** The Retrofit service to perform REST calls. */
private ServiceAssociationLinksService service;
/** The service client containing this operation class. */
private ContainerInstanceManagementClientImpl client;
/**
* Initializes an instance of ServiceAssociationLinksInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public ServiceAssociationLinksInner(Retrofit retrofit, ContainerInstanceManagementClientImpl client) {
this.service = retrofit.create(ServiceAssociationLinksService.class);
this.client = client;
}
/**
* The interface defining all the services for ServiceAssociationLinks to be
* used by Retrofit to perform actually REST calls.
*/
interface ServiceAssociationLinksService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.ServiceAssociationLinks delete" })
@HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default", method = "DELETE", hasBody = true)
Observable<Response<ResponseBody>> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("virtualNetworkName") String virtualNetworkName, @Path("subnetName") String subnetName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
/**
* Delete the container instance service association link for the subnet.
* Delete the container instance service association link for the subnet. This operation unblocks user from deleting subnet.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkName The name of the virtual network.
* @param subnetName The name of the subnet.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/
public void delete(String resourceGroupName, String virtualNetworkName, String subnetName) {
deleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).toBlocking().single().body();
}
/**
* Delete the container instance service association link for the subnet.
* Delete the container instance service association link for the subnet. This operation unblocks user from deleting subnet.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkName The name of the virtual network.
* @param subnetName The name of the subnet.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<Void> deleteAsync(String resourceGroupName, String virtualNetworkName, String subnetName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName), serviceCallback);
}
/**
* Delete the container instance service association link for the subnet.
* Delete the container instance service association link for the subnet. This operation unblocks user from deleting subnet.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkName The name of the virtual network.
* @param subnetName The name of the subnet.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<Void> deleteAsync(String resourceGroupName, String virtualNetworkName, String subnetName) {
return deleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, subnetName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
}
/**
* Delete the container instance service association link for the subnet.
* Delete the container instance service association link for the subnet. This operation unblocks user from deleting subnet.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkName The name of the virtual network.
* @param subnetName The name of the subnet.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String virtualNetworkName, String subnetName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (virtualNetworkName == null) {
throw new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null.");
}
if (subnetName == null) {
throw new IllegalArgumentException("Parameter subnetName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.delete(this.client.subscriptionId(), resourceGroupName, virtualNetworkName, subnetName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = deleteDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<Void> deleteDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<Void>() { }.getType())
.register(204, new TypeToken<Void>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}

Просмотреть файл

@ -1,167 +0,0 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.containerinstance.implementation;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.CloudException;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.Validator;
import java.io.IOException;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Path;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.Response;
import rx.functions.Func1;
import rx.Observable;
/**
* An instance of this class provides access to all the operations defined
* in StartContainers.
*/
public class StartContainersInner {
/** The Retrofit service to perform REST calls. */
private StartContainersService service;
/** The service client containing this operation class. */
private ContainerInstanceManagementClientImpl client;
/**
* Initializes an instance of StartContainersInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public StartContainersInner(Retrofit retrofit, ContainerInstanceManagementClientImpl client) {
this.service = retrofit.create(StartContainersService.class);
this.client = client;
}
/**
* The interface defining all the services for StartContainers to be
* used by Retrofit to perform actually REST calls.
*/
interface StartContainersService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.containerinstance.StartContainers launchExec" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance/containerGroups/{containerGroupName}/containers/{containerName}/exec")
Observable<Response<ResponseBody>> launchExec(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("containerGroupName") String containerGroupName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body ContainerExecRequestInner containerExecRequest, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
/**
* Starts the exec command for a specific container instance.
* Starts the exec command for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param containerExecRequest The request for the exec command.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ContainerExecResponseInner object if successful.
*/
public ContainerExecResponseInner launchExec(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) {
return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).toBlocking().single().body();
}
/**
* Starts the exec command for a specific container instance.
* Starts the exec command for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param containerExecRequest The request for the exec command.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<ContainerExecResponseInner> launchExecAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest, final ServiceCallback<ContainerExecResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest), serviceCallback);
}
/**
* Starts the exec command for a specific container instance.
* Starts the exec command for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param containerExecRequest The request for the exec command.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ContainerExecResponseInner object
*/
public Observable<ContainerExecResponseInner> launchExecAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) {
return launchExecWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).map(new Func1<ServiceResponse<ContainerExecResponseInner>, ContainerExecResponseInner>() {
@Override
public ContainerExecResponseInner call(ServiceResponse<ContainerExecResponseInner> response) {
return response.body();
}
});
}
/**
* Starts the exec command for a specific container instance.
* Starts the exec command for a specified container instance in a specified resource group and container group.
*
* @param resourceGroupName The name of the resource group.
* @param containerGroupName The name of the container group.
* @param containerName The name of the container instance.
* @param containerExecRequest The request for the exec command.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ContainerExecResponseInner object
*/
public Observable<ServiceResponse<ContainerExecResponseInner>> launchExecWithServiceResponseAsync(String resourceGroupName, String containerGroupName, String containerName, ContainerExecRequestInner containerExecRequest) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (containerGroupName == null) {
throw new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.");
}
if (containerName == null) {
throw new IllegalArgumentException("Parameter containerName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (containerExecRequest == null) {
throw new IllegalArgumentException("Parameter containerExecRequest is required and cannot be null.");
}
Validator.validate(containerExecRequest);
return service.launchExec(this.client.subscriptionId(), resourceGroupName, containerGroupName, containerName, this.client.apiVersion(), containerExecRequest, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ContainerExecResponseInner>>>() {
@Override
public Observable<ServiceResponse<ContainerExecResponseInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ContainerExecResponseInner> clientResponse = launchExecDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<ContainerExecResponseInner> launchExecDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<ContainerExecResponseInner, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<ContainerExecResponseInner>() { }.getType())
.registerError(CloudException.class)
.build(response);
}
}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -22,8 +22,16 @@ import com.microsoft.azure.management.compute.VirtualMachineOffer;
import com.microsoft.azure.management.compute.VirtualMachinePublisher;
import com.microsoft.azure.management.compute.VirtualMachineSizeTypes;
import com.microsoft.azure.management.compute.VirtualMachineSku;
import com.microsoft.azure.management.containerinstance.Container;
import com.microsoft.azure.management.containerinstance.ContainerGroup;
import com.microsoft.azure.management.containerinstance.ContainerGroupRestartPolicy;
import com.microsoft.azure.management.containerinstance.Operation;
import com.microsoft.azure.management.containerinstance.ResourceIdentityType;
import com.microsoft.azure.management.graphrbac.BuiltInRole;
import com.microsoft.azure.management.locks.LockLevel;
import com.microsoft.azure.management.locks.ManagementLock;
import com.microsoft.azure.management.msi.Identity;
import com.microsoft.azure.management.msi.implementation.MSIManager;
import com.microsoft.azure.management.network.Access;
import com.microsoft.azure.management.network.ConnectionMonitor;
import com.microsoft.azure.management.network.ConnectionMonitorQueryResult;
@ -67,20 +75,24 @@ import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class AzureTests extends TestBase {
private Azure azure;
private MSIManager msiManager;
@Override
protected void initializeClients(RestClient restClient, String defaultSubscription, String domain) {
Azure.Authenticated azureAuthed = Azure.authenticate(restClient, defaultSubscription, domain);
azure = azureAuthed.withSubscription(defaultSubscription);
this.msiManager = MSIManager.authenticate(restClient, defaultSubscription);
}
@Override
@ -1090,9 +1102,129 @@ public class AzureTests extends TestBase {
}
@Test
public void testContainerInstance() throws Exception {
new TestContainerInstance()
.runTest(azure.containerGroups(), azure.resourceGroups());
public void testContainerInstanceWithPublicIpAddressWithSystemAssignedMsi() throws Exception {
new TestContainerInstanceWithPublicIpAddressWithSystemAssignedMSI().runTest(azure.containerGroups(), azure.resourceGroups(), azure.subscriptionId());
}
@Test
public void testContainerInstanceWithPublicIpAddressWithUserAssignedMsi() throws Exception {
final String cgName = SdkContext.randomResourceName("aci", 10);
final String rgName = SdkContext.randomResourceName("rgaci", 10);
String identityName1 = generateRandomResourceName("msi-id", 15);
String identityName2 = generateRandomResourceName("msi-id", 15);
final Identity createdIdentity = msiManager.identities()
.define(identityName1)
.withRegion(Region.US_WEST)
.withNewResourceGroup(rgName)
.withAccessToCurrentResourceGroup(BuiltInRole.READER)
.create();
Creatable<Identity> creatableIdentity = msiManager.identities()
.define(identityName2)
.withRegion(Region.US_WEST)
.withExistingResourceGroup(rgName)
.withAccessToCurrentResourceGroup(BuiltInRole.CONTRIBUTOR);
List<String> dnsServers = new ArrayList<String>();
dnsServers.add("dnsServer1");
ContainerGroup containerGroup = azure.containerGroups().define(cgName)
.withRegion(Region.US_EAST2)
.withExistingResourceGroup(rgName)
.withLinux()
.withPublicImageRegistryOnly()
.withEmptyDirectoryVolume("emptydir1")
.defineContainerInstance("tomcat")
.withImage("tomcat")
.withExternalTcpPort(8080)
.withCpuCoreCount(1)
.withEnvironmentVariable("ENV1", "value1")
.attach()
.defineContainerInstance("nginx")
.withImage("nginx")
.withExternalTcpPort(80)
.withEnvironmentVariableWithSecuredValue("ENV2", "securedValue1")
.attach()
.withExistingUserAssignedManagedServiceIdentity(createdIdentity)
.withNewUserAssignedManagedServiceIdentity(creatableIdentity)
.withRestartPolicy(ContainerGroupRestartPolicy.NEVER)
.withDnsPrefix(cgName)
.withTag("tag1", "value1")
.create();
Assert.assertEquals(cgName, containerGroup.name());
Assert.assertEquals("Linux", containerGroup.osType().toString());
Assert.assertEquals(0, containerGroup.imageRegistryServers().size());
Assert.assertEquals(1, containerGroup.volumes().size());
Assert.assertNotNull(containerGroup.volumes().get("emptydir1"));
Assert.assertNotNull(containerGroup.ipAddress());
Assert.assertTrue(containerGroup.isIPAddressPublic());
Assert.assertEquals(2, containerGroup.externalTcpPorts().length);
Assert.assertEquals(2, containerGroup.externalPorts().size());
Assert.assertEquals(2, containerGroup.externalTcpPorts().length);
Assert.assertEquals(8080, containerGroup.externalTcpPorts()[0]);
Assert.assertEquals(80, containerGroup.externalTcpPorts()[1]);
Assert.assertEquals(2, containerGroup.containers().size());
Container tomcatContainer = containerGroup.containers().get("tomcat");
Assert.assertNotNull(tomcatContainer);
Container nginxContainer = containerGroup.containers().get("nginx");
Assert.assertNotNull(nginxContainer);
Assert.assertEquals("tomcat", tomcatContainer.name());
Assert.assertEquals("tomcat", tomcatContainer.image());
Assert.assertEquals(1.0, tomcatContainer.resources().requests().cpu(), .1);
Assert.assertEquals(1.5, tomcatContainer.resources().requests().memoryInGB(), .1);
Assert.assertEquals(1, tomcatContainer.ports().size());
Assert.assertEquals(8080, tomcatContainer.ports().get(0).port());
Assert.assertNull(tomcatContainer.volumeMounts());
Assert.assertNull(tomcatContainer.command());
Assert.assertNotNull(tomcatContainer.environmentVariables());
Assert.assertEquals(1, tomcatContainer.environmentVariables().size());
Assert.assertEquals("nginx", nginxContainer.name());
Assert.assertEquals("nginx", nginxContainer.image());
Assert.assertEquals(1.0, nginxContainer.resources().requests().cpu(), .1);
Assert.assertEquals(1.5, nginxContainer.resources().requests().memoryInGB(), .1);
Assert.assertEquals(1, nginxContainer.ports().size());
Assert.assertEquals(80, nginxContainer.ports().get(0).port());
Assert.assertNull(nginxContainer.volumeMounts());
Assert.assertNull(nginxContainer.command());
Assert.assertNotNull(nginxContainer.environmentVariables());
Assert.assertEquals(1, nginxContainer.environmentVariables().size());
Assert.assertTrue(containerGroup.tags().containsKey("tag1"));
Assert.assertEquals(ContainerGroupRestartPolicy.NEVER, containerGroup.restartPolicy());
Assert.assertTrue(containerGroup.isManagedServiceIdentityEnabled());
Assert.assertEquals(ResourceIdentityType.USER_ASSIGNED, containerGroup.managedServiceIdentityType());
Assert.assertNull(containerGroup.systemAssignedManagedServiceIdentityPrincipalId()); // No Local MSI enabled
// Ensure the "User Assigned (External) MSI" id can be retrieved from the virtual machine
//
Set<String> emsiIds = containerGroup.userAssignedManagedServiceIdentityIds();
Assert.assertNotNull(emsiIds);
Assert.assertEquals(2, emsiIds.size());
Assert.assertEquals(cgName, containerGroup.dnsPrefix());
//TODO: add network and dns testing when questions have been answered
ContainerGroup containerGroup2 = azure.containerGroups().getByResourceGroup(rgName, cgName);
List<ContainerGroup> containerGroupList = azure.containerGroups().listByResourceGroup(rgName);
Assert.assertTrue(containerGroupList.size() > 0);
Assert.assertNotNull(containerGroupList.get(0).state());
containerGroup.refresh();
Set<Operation> containerGroupOperations = azure.containerGroups().listOperations();
// Number of supported operation can change hence don't assert with a predefined number.
Assert.assertTrue(containerGroupOperations.size() > 0);
}
@Test
public void testContainerInstanceWithPrivateIpAddress() throws Exception {
//LIVE ONLY TEST BECAUSE IT REQUIRES SUBSCRIPTION ID
if (!isPlaybackMode()) {
new TestContainerInstanceWithPrivateIpAddress()
.runTest(azure.containerGroups(), azure.resourceGroups(), azure.subscriptionId());
}
}
@Test

Просмотреть файл

@ -0,0 +1,216 @@
package com.microsoft.azure.management;
import com.microsoft.azure.management.containerinstance.Container;
import com.microsoft.azure.management.containerinstance.ContainerGroup;
import com.microsoft.azure.management.containerinstance.ContainerGroupRestartPolicy;
import com.microsoft.azure.management.containerinstance.ContainerGroups;
import com.microsoft.azure.management.containerinstance.ContainerPort;
import com.microsoft.azure.management.containerinstance.EnvironmentVariable;
import com.microsoft.azure.management.containerinstance.Operation;
import com.microsoft.azure.management.containerinstance.ResourceIdentityType;
import com.microsoft.azure.management.containerinstance.Volume;
import com.microsoft.azure.management.containerinstance.VolumeMount;
import com.microsoft.azure.management.graphrbac.BuiltInRole;
import com.microsoft.azure.management.resources.core.TestBase;
import com.microsoft.azure.management.resources.fluentcore.arm.Region;
import org.junit.Assert;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class TestContainerInstanceWithPrivateIpAddress extends TestTemplate<ContainerGroup, ContainerGroups> {
@Override
public ContainerGroup createResource(ContainerGroups containerGroups) throws Exception {
final String cgName = "aci" + this.testId;
final String rgName = "rgaci" + this.testId;
final String logAnalyticsWorkspaceId = "REPLACE WITH YOUR LOG ANALYTICS WORKSPACE ID";
final String logAnalyticsWorkspaceKey = "REPLACE WITH YOUR LOG ANALYTICS WORKSPACE KEY";
final String networkProfileSubscriptionId = "REPLACE WITH YOUR NETWORK PROFILE SUBSCRIPTION ID";
final String networkProfileResourceGroupName = "REPLACE WITH YOUR NETWORK PROFILE RESOURCE GROUP NAME";
final String networkProfileName = "REPLEACE WITH YOUR NETWORK PROFILE NAME";
final List<String> dnsServerNames = new ArrayList<String>();
dnsServerNames.add("dnsServer1");
List<String> dnsServers = new ArrayList<String>();
dnsServers.add("dnsServer1");
ContainerGroup containerGroup = containerGroups.define(cgName)
.withRegion(Region.US_WEST)
.withNewResourceGroup(rgName)
.withLinux()
.withPublicImageRegistryOnly()
.withEmptyDirectoryVolume("emptydir1")
.defineContainerInstance("tomcat")
.withImage("tomcat")
.withExternalTcpPort(8080)
.withCpuCoreCount(1)
.withEnvironmentVariable("ENV1", "value1")
.attach()
.defineContainerInstance("nginx")
.withImage("nginx")
.withExternalTcpPort(80)
.withEnvironmentVariableWithSecuredValue("ENV2", "securedValue1")
.attach()
.withSystemAssignedManagedServiceIdentity()
.withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(BuiltInRole.CONTRIBUTOR)
.withRestartPolicy(ContainerGroupRestartPolicy.NEVER)
.withLogAnalytics(logAnalyticsWorkspaceId, logAnalyticsWorkspaceKey)
.withNetworkProfileId(networkProfileSubscriptionId, networkProfileResourceGroupName, networkProfileName)
.withDnsConfiguration(dnsServerNames, "dnsSearchDomains", "dnsOptions")
.withTag("tag1", "value1")
.create();
Assert.assertEquals(cgName, containerGroup.name());
Assert.assertEquals("Linux", containerGroup.osType().toString());
Assert.assertEquals(0, containerGroup.imageRegistryServers().size());
Assert.assertEquals(1, containerGroup.volumes().size());
Assert.assertNotNull(containerGroup.volumes().get("emptydir1"));
Assert.assertNotNull(containerGroup.ipAddress());
Assert.assertTrue(containerGroup.isIPAddressPrivate());
Assert.assertEquals(2, containerGroup.externalTcpPorts().length);
Assert.assertEquals(2, containerGroup.externalPorts().size());
Assert.assertEquals(2, containerGroup.externalTcpPorts().length);
Assert.assertEquals(8080, containerGroup.externalTcpPorts()[0]);
Assert.assertEquals(80, containerGroup.externalTcpPorts()[1]);
Assert.assertEquals(2, containerGroup.containers().size());
Container tomcatContainer = containerGroup.containers().get("tomcat");
Assert.assertNotNull(tomcatContainer);
Container nginxContainer = containerGroup.containers().get("nginx");
Assert.assertNotNull(nginxContainer);
Assert.assertEquals("tomcat", tomcatContainer.name());
Assert.assertEquals("tomcat", tomcatContainer.image());
Assert.assertEquals(1.0, tomcatContainer.resources().requests().cpu(), .1);
Assert.assertEquals(1.5, tomcatContainer.resources().requests().memoryInGB(), .1);
Assert.assertEquals(1, tomcatContainer.ports().size());
Assert.assertEquals(8080, tomcatContainer.ports().get(0).port());
Assert.assertNull(tomcatContainer.volumeMounts());
Assert.assertNull(tomcatContainer.command());
Assert.assertNotNull(tomcatContainer.environmentVariables());
Assert.assertEquals(1, tomcatContainer.environmentVariables().size());
Assert.assertEquals("nginx", nginxContainer.name());
Assert.assertEquals("nginx", nginxContainer.image());
Assert.assertEquals(1.0, nginxContainer.resources().requests().cpu(), .1);
Assert.assertEquals(1.5, nginxContainer.resources().requests().memoryInGB(), .1);
Assert.assertEquals(1, nginxContainer.ports().size());
Assert.assertEquals(80, nginxContainer.ports().get(0).port());
Assert.assertNull(nginxContainer.volumeMounts());
Assert.assertNull(nginxContainer.command());
Assert.assertNotNull(nginxContainer.environmentVariables());
Assert.assertEquals(1, nginxContainer.environmentVariables().size());
Assert.assertTrue(containerGroup.tags().containsKey("tag1"));
Assert.assertEquals(ContainerGroupRestartPolicy.NEVER, containerGroup.restartPolicy());
Assert.assertTrue(containerGroup.isManagedServiceIdentityEnabled());
Assert.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, containerGroup.managedServiceIdentityType());
Assert.assertEquals(logAnalyticsWorkspaceId, containerGroup.logAnalytics().workspaceId());
Assert.assertEquals("/subscriptions/" + networkProfileSubscriptionId + "/resourceGroups/" + networkProfileResourceGroupName + "/providers/Microsoft.Network/networkProfiles/" + networkProfileName, containerGroup.networkProfileId());
Assert.assertEquals("dnsServer1", containerGroup.dnsConfig().nameServers().get(0));
Assert.assertEquals("dnsSearchDomains", containerGroup.dnsConfig().searchDomains());
Assert.assertEquals("dnsOptions", containerGroup.dnsConfig().options());
ContainerGroup containerGroup2 = containerGroups.getByResourceGroup(rgName, cgName);
List<ContainerGroup> containerGroupList = containerGroups.listByResourceGroup(rgName);
Assert.assertTrue(containerGroupList.size() > 0);
Assert.assertNotNull(containerGroupList.get(0).state());
containerGroup.refresh();
Set<Operation> containerGroupOperations = containerGroups.listOperations();
// Number of supported operation can change hence don't assert with a predefined number.
Assert.assertTrue(containerGroupOperations.size() > 0);
return containerGroup;
}
@Override
public ContainerGroup updateResource(ContainerGroup containerGroup) throws Exception {
containerGroup.update()
.withoutTag("tag1")
.withTag("tag2", "value2")
.apply();
Assert.assertFalse(containerGroup.tags().containsKey("tag"));
Assert.assertTrue(containerGroup.tags().containsKey("tag2"));
containerGroup.restart();
containerGroup.stop();
return containerGroup;
}
@Override
public void print(ContainerGroup resource) {
StringBuilder info = new StringBuilder().append("Container Group: ").append(resource.id())
.append("Name: ").append(resource.name())
.append("\n\tResource group: ").append(resource.resourceGroupName())
.append("\n\tRegion: ").append(resource.region())
.append("\n\tTags: ").append(resource.tags())
.append("\n\tOS type: ").append(resource.osType());
if (resource.ipAddress() != null) {
info.append("\n\tPublic IP address: ").append(resource.ipAddress());
}
if (resource.externalTcpPorts() != null) {
info.append("\n\tExternal TCP ports:");
for (int port : resource.externalTcpPorts()) {
info.append(" ").append(port);
}
}
if (resource.externalUdpPorts() != null) {
info.append("\n\tExternal UDP ports:");
for (int port : resource.externalUdpPorts()) {
info.append(" ").append(port);
}
}
if (resource.imageRegistryServers() != null) {
info.append("\n\tPrivate Docker image registries:");
for (String server : resource.imageRegistryServers()) {
info.append(" ").append(server);
}
}
if (resource.volumes() != null) {
info.append("\n\tVolume mapping: ");
for (Map.Entry<String, Volume> entry: resource.volumes().entrySet()) {
info.append("\n\t\tName: ").append(entry.getKey()).append(" -> ")
.append(entry.getValue().azureFile() != null ? entry.getValue().azureFile().shareName() : "empty direcory volume");
}
}
if (resource.containers() != null) {
info.append("\n\tContainer instances: ");
for (Map.Entry<String, Container> entry: resource.containers().entrySet()) {
Container container = entry.getValue();
info.append("\n\t\tName: ").append(entry.getKey()).append(" -> ").append(container.image());
info.append("\n\t\t\tResources: ");
info.append(container.resources().requests().cpu()).append("CPUs ");
info.append(container.resources().requests().memoryInGB()).append("GB");
info.append("\n\t\t\tPorts:");
for (ContainerPort port : container.ports()) {
info.append(" ").append(port.port());
}
if (container.volumeMounts() != null) {
info.append("\n\t\t\tVolume mounts:");
for (VolumeMount volumeMount : container.volumeMounts()) {
info.append(" ").append(volumeMount.name()).append("->").append(volumeMount.mountPath());
}
}
if (container.command() != null) {
info.append("\n\t\t\tStart commands:");
for (String command : container.command()) {
info.append("\n\t\t\t\t").append(command);
}
}
if (container.environmentVariables() != null) {
info.append("\n\t\t\tENV vars:");
for (EnvironmentVariable envVar : container.environmentVariables()) {
info.append("\n\t\t\t\t").append(envVar.name()).append("=").append(envVar.value());
}
}
}
}
System.out.println(info.toString());
}
}

Просмотреть файл

@ -1,5 +1,6 @@
package com.microsoft.azure.management;
import com.microsoft.azure.management.containerinstance.ResourceIdentityType;
import com.microsoft.azure.management.containerinstance.Container;
import com.microsoft.azure.management.containerinstance.ContainerGroup;
import com.microsoft.azure.management.containerinstance.ContainerGroupRestartPolicy;
@ -9,19 +10,27 @@ import com.microsoft.azure.management.containerinstance.EnvironmentVariable;
import com.microsoft.azure.management.containerinstance.Operation;
import com.microsoft.azure.management.containerinstance.Volume;
import com.microsoft.azure.management.containerinstance.VolumeMount;
import com.microsoft.azure.management.graphrbac.BuiltInRole;
import com.microsoft.azure.management.msi.Identity;
import com.microsoft.azure.management.msi.implementation.MSIManager;
import com.microsoft.azure.management.resources.fluentcore.arm.Region;
import org.junit.Assert;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class TestContainerInstance extends TestTemplate<ContainerGroup, ContainerGroups> {
public class TestContainerInstanceWithPublicIpAddressWithSystemAssignedMSI extends TestTemplate<ContainerGroup, ContainerGroups> {
@Override
public ContainerGroup createResource(ContainerGroups containerGroups) throws Exception {
final String cgName = "aci" + this.testId;
final String rgName = "rgaci" + this.testId;
List<String> dnsServers = new ArrayList<String>();
dnsServers.add("dnsServer1");
ContainerGroup containerGroup = containerGroups.define(cgName)
.withRegion(Region.US_EAST2)
.withNewResourceGroup(rgName)
@ -39,6 +48,8 @@ public class TestContainerInstance extends TestTemplate<ContainerGroup, Containe
.withExternalTcpPort(80)
.withEnvironmentVariableWithSecuredValue("ENV2", "securedValue1")
.attach()
.withSystemAssignedManagedServiceIdentity()
.withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(BuiltInRole.CONTRIBUTOR)
.withRestartPolicy(ContainerGroupRestartPolicy.NEVER)
.withDnsPrefix(cgName)
.withTag("tag1", "value1")
@ -83,8 +94,9 @@ public class TestContainerInstance extends TestTemplate<ContainerGroup, Containe
Assert.assertEquals(1, nginxContainer.environmentVariables().size());
Assert.assertTrue(containerGroup.tags().containsKey("tag1"));
Assert.assertEquals(ContainerGroupRestartPolicy.NEVER, containerGroup.restartPolicy());
Assert.assertTrue(containerGroup.isManagedServiceIdentityEnabled());
Assert.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, containerGroup.managedServiceIdentityType());
Assert.assertEquals(cgName, containerGroup.dnsPrefix());
ContainerGroup containerGroup2 = containerGroups.getByResourceGroup(rgName, cgName);
List<ContainerGroup> containerGroupList = containerGroups.listByResourceGroup(rgName);

Просмотреть файл

@ -158,4 +158,58 @@ public abstract class TestTemplate<
Assert.assertFalse(message, failedUpdate);
Assert.assertFalse(message, failedDelete);
}
/**
* Runs the test.
* @param collection collection of resources to test
* @param resourceGroups the resource groups collection
* @throws Exception if anything goes wrong
*/
public void runTest(CollectionT collection, ResourceGroups resourceGroups, String subscription) throws Exception {
this.collection = collection;
this.resourceGroups = resourceGroups;
// Initial listing
verifyListing();
// Verify creation
this.resource = createResource(collection);
System.out.println("\n------------\nAfter creation:\n");
print(this.resource);
// Verify listing
verifyListing();
// Verify getting
this.resource = verifyGetting();
Assert.assertTrue(this.resource != null);
System.out.println("\n------------\nRetrieved resource:\n");
print(this.resource);
boolean failedUpdate = false;
String message = "Update Failed";
// Verify update
try {
this.resource = updateResource(this.resource);
Assert.assertTrue(this.resource != null);
System.out.println("\n------------\nUpdated resource:\n");
message = "Print failed";
print(this.resource);
} catch (Exception e) {
e.printStackTrace();
failedUpdate = true;
}
// Verify deletion
boolean failedDelete = false;
try {
message = "Delete failed";
verifyDeleting();
} catch (Exception e) {
e.printStackTrace();
failedDelete = true;
}
Assert.assertFalse(message, failedUpdate);
Assert.assertFalse(message, failedDelete);
}
}

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Двоичные данные
serial.output Normal file

Двоичный файл не отображается.