Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Container Instance: Updating for October Release #4851

Merged
merged 5 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SDKs/ContainerInstance/AzSdk.RP.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--This file and it's contents are updated at build time moving or editing might result in build failure. Take due deligence while editing this file-->
<PropertyGroup>
<AzureApiTag>ContainerInstance_2018-04-01;</AzureApiTag>
<AzureApiTag>ContainerInstance_2018-10-01;Network_2018-10-01;</AzureApiTag>
<PackageTags>$(PackageTags);$(CommonTags);$(AzureApiTag);</PackageTags>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,36 @@ public static ContainerGroup CreateTestContainerGroup(string containerGroupName)
image: "alpine",
ports: new List<ContainerPort>() { new ContainerPort(80) },
command: new List<string>() { "/bin/sh", "-c", "while true; do sleep 10; done" },
environmentVariables: new List<EnvironmentVariable>
{
new EnvironmentVariable(name: "secretEnv", secureValue: "secretValue1")
},
livenessProbe: new ContainerProbe(
exec: new ContainerExec(command: new List<string>{ "cat", "/tmp/healthy" }),
periodSeconds: 20),
resources: new ResourceRequirements(requests: new ResourceRequests(memoryInGB: 1.5, cpu: 1.0)))
};

var ipAddress = new IpAddress(
ports: new List<Port>() { new Port(80, "TCP") },
dnsNameLabel: containerGroupName);
dnsNameLabel: containerGroupName,
type: ContainerGroupIpAddressType.Public);

var logAnalytics = new LogAnalytics(
workspaceId: "workspaceid",
workspaceKey: "workspacekey");

var msiIdentity = new ContainerGroupIdentity(type: ResourceIdentityType.SystemAssigned);

var containerGroup = new ContainerGroup(
name: containerGroupName,
location: "westus",
osType: OperatingSystemTypes.Linux,
ipAddress: ipAddress,
restartPolicy: "Never",
containers: containers);
containers: containers,
identity: msiIdentity,
diagnostics: new ContainerGroupDiagnostics(logAnalytics: logAnalytics));

return containerGroup;
}
Expand All @@ -71,13 +87,17 @@ public static void VerifyContainerGroupProperties(ContainerGroup expected, Conta
Assert.Equal(expected.Location, actual.Location);
Assert.Equal(expected.OsType, actual.OsType);
Assert.Equal(expected.RestartPolicy, actual.RestartPolicy);
Assert.Equal(expected.Identity.Type, actual.Identity.Type);
Assert.Equal(expected.Diagnostics.LogAnalytics.WorkspaceId, actual.Diagnostics.LogAnalytics.WorkspaceId);
Assert.NotNull(actual.Containers);
Assert.Equal(1, actual.Containers.Count);
Assert.NotNull(actual.IpAddress);
Assert.NotNull(actual.IpAddress.Ip);
Assert.Equal(expected.IpAddress.DnsNameLabel, actual.IpAddress.DnsNameLabel);
Assert.Equal(expected.Containers[0].Name, actual.Containers[0].Name);
Assert.Equal(expected.Containers[0].Image, actual.Containers[0].Image);
Assert.Equal(expected.Containers[0].LivenessProbe.PeriodSeconds, actual.Containers[0].LivenessProbe.PeriodSeconds);
Assert.Equal(expected.Containers[0].EnvironmentVariables[0].Name, actual.Containers[0].EnvironmentVariables[0].Name);
Assert.Equal(expected.Containers[0].Resources.Requests.Cpu, actual.Containers[0].Resources.Requests.Cpu);
Assert.Equal(expected.Containers[0].Resources.Requests.MemoryInGB, actual.Containers[0].Resources.Requests.MemoryInGB);
}
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,96 @@ public static ContainerGroup Delete(this IContainerGroupsOperations operations,
}
}

/// <summary>
/// Restarts all containers in a container group.
/// </summary>
/// <remarks>
/// Restarts all containers in a container group in place. If container image
/// has updates, new image will be downloaded.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='containerGroupName'>
/// The name of the container group.
/// </param>
public static void Restart(this IContainerGroupsOperations operations, string resourceGroupName, string containerGroupName)
{
operations.RestartAsync(resourceGroupName, containerGroupName).GetAwaiter().GetResult();
}

/// <summary>
/// Restarts all containers in a container group.
/// </summary>
/// <remarks>
/// Restarts all containers in a container group in place. If container image
/// has updates, new image will be downloaded.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='containerGroupName'>
/// The name of the container group.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task RestartAsync(this IContainerGroupsOperations operations, string resourceGroupName, string containerGroupName, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.RestartWithHttpMessagesAsync(resourceGroupName, containerGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}

/// <summary>
/// Stops all containers in a container group.
/// </summary>
/// <remarks>
/// Stops all containers in a container group. Compute resources will be
/// deallocated and billing will stop.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='containerGroupName'>
/// The name of the container group.
/// </param>
public static void Stop(this IContainerGroupsOperations operations, string resourceGroupName, string containerGroupName)
{
operations.StopAsync(resourceGroupName, containerGroupName).GetAwaiter().GetResult();
}

/// <summary>
/// Stops all containers in a container group.
/// </summary>
/// <remarks>
/// Stops all containers in a container group. Compute resources will be
/// deallocated and billing will stop.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='containerGroupName'>
/// The name of the container group.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task StopAsync(this IContainerGroupsOperations operations, string resourceGroupName, string containerGroupName, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.StopWithHttpMessagesAsync(resourceGroupName, containerGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}

/// <summary>
/// Create or update container groups.
/// </summary>
Expand Down Expand Up @@ -367,6 +457,51 @@ public static ContainerGroup BeginCreateOrUpdate(this IContainerGroupsOperations
}
}

/// <summary>
/// Restarts all containers in a container group.
/// </summary>
/// <remarks>
/// Restarts all containers in a container group in place. If container image
/// has updates, new image will be downloaded.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='containerGroupName'>
/// The name of the container group.
/// </param>
public static void BeginRestart(this IContainerGroupsOperations operations, string resourceGroupName, string containerGroupName)
{
operations.BeginRestartAsync(resourceGroupName, containerGroupName).GetAwaiter().GetResult();
}

/// <summary>
/// Restarts all containers in a container group.
/// </summary>
/// <remarks>
/// Restarts all containers in a container group in place. If container image
/// has updates, new image will be downloaded.
/// </remarks>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='resourceGroupName'>
/// The name of the resource group.
/// </param>
/// <param name='containerGroupName'>
/// The name of the container group.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task BeginRestartAsync(this IContainerGroupsOperations operations, string resourceGroupName, string containerGroupName, CancellationToken cancellationToken = default(CancellationToken))
{
(await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, containerGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}

/// <summary>
/// Get a list of container groups in the specified subscription.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,20 @@ public partial class ContainerInstanceManagementClient : ServiceClient<Container
public string ApiVersion { get; private set; }

/// <summary>
/// Gets or sets the preferred language for the response.
/// The preferred language for the response.
/// </summary>
public string AcceptLanguage { get; set; }

/// <summary>
/// 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.
/// </summary>
public int? LongRunningOperationRetryTimeout { get; set; }

/// <summary>
/// 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.
/// </summary>
public bool? GenerateClientRequestId { get; set; }

Expand All @@ -88,14 +89,27 @@ public partial class ContainerInstanceManagementClient : ServiceClient<Container
public virtual IContainerGroupUsageOperations ContainerGroupUsage { get; private set; }

/// <summary>
/// Gets the IContainerLogsOperations.
/// Gets the IContainerOperations.
/// </summary>
public virtual IContainerLogsOperations ContainerLogs { get; private set; }
public virtual IContainerOperations Container { get; private set; }

/// <summary>
/// Gets the IStartContainerOperations.
/// Gets the IServiceAssociationLinkOperations.
/// </summary>
public virtual IStartContainerOperations StartContainer { get; private set; }
public virtual IServiceAssociationLinkOperations ServiceAssociationLink { get; private set; }

/// <summary>
/// Initializes a new instance of the ContainerInstanceManagementClient class.
/// </summary>
/// <param name='httpClient'>
/// HttpClient to be used
/// </param>
/// <param name='disposeHttpClient'>
/// True: will dispose the provided httpClient on calling ContainerInstanceManagementClient.Dispose(). False: will not dispose provided httpClient</param>
protected ContainerInstanceManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
{
Initialize();
}

/// <summary>
/// Initializes a new instance of the ContainerInstanceManagementClient class.
Expand Down Expand Up @@ -192,6 +206,33 @@ public ContainerInstanceManagementClient(ServiceClientCredentials credentials, p
}
}

/// <summary>
/// Initializes a new instance of the ContainerInstanceManagementClient class.
/// </summary>
/// <param name='credentials'>
/// Required. Credentials needed for the client to connect to Azure.
/// </param>
/// <param name='httpClient'>
/// HttpClient to be used
/// </param>
/// <param name='disposeHttpClient'>
/// True: will dispose the provided httpClient on calling ContainerInstanceManagementClient.Dispose(). False: will not dispose provided httpClient</param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public ContainerInstanceManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
{
if (credentials == null)
{
throw new System.ArgumentNullException("credentials");
}
Credentials = credentials;
if (Credentials != null)
{
Credentials.InitializeServiceClient(this);
}
}

/// <summary>
/// Initializes a new instance of the ContainerInstanceManagementClient class.
/// </summary>
Expand Down Expand Up @@ -301,10 +342,10 @@ private void Initialize()
ContainerGroups = new ContainerGroupsOperations(this);
Operations = new Operations(this);
ContainerGroupUsage = new ContainerGroupUsageOperations(this);
ContainerLogs = new ContainerLogsOperations(this);
samkreter marked this conversation as resolved.
Show resolved Hide resolved
StartContainer = new StartContainerOperations(this);
Container = new ContainerOperations(this);
ServiceAssociationLink = new ServiceAssociationLinkOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
ApiVersion = "2018-04-01";
ApiVersion = "2018-10-01";
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
Expand Down
Loading