/
TaskContainerSettings.cs
134 lines (114 loc) · 5.22 KB
/
TaskContainerSettings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
// 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.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
//
// This file was autogenerated by a tool.
// Do not modify it.
//
namespace Microsoft.Azure.Batch
{
using Models = Microsoft.Azure.Batch.Protocol.Models;
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// The container settings for a task.
/// </summary>
public partial class TaskContainerSettings : ITransportObjectProvider<Models.TaskContainerSettings>, IPropertyMetadata
{
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="TaskContainerSettings"/> class.
/// </summary>
/// <param name='imageName'>The image to use to create the container in which the task will run.</param>
/// <param name='containerRunOptions'>Additional options to the container create command.</param>
/// <param name='registry'>The private registry which contains the container image.</param>
/// <param name='workingDirectory'>The location of the container task working directory.</param>
public TaskContainerSettings(
string imageName,
string containerRunOptions = default(string),
ContainerRegistry registry = default(ContainerRegistry),
Common.ContainerWorkingDirectory? workingDirectory = default(Common.ContainerWorkingDirectory?))
{
this.ImageName = imageName;
this.ContainerRunOptions = containerRunOptions;
this.Registry = registry;
this.WorkingDirectory = workingDirectory;
}
internal TaskContainerSettings(Models.TaskContainerSettings protocolObject)
{
this.ContainerRunOptions = protocolObject.ContainerRunOptions;
this.ImageName = protocolObject.ImageName;
this.Registry = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Registry, o => new ContainerRegistry(o).Freeze());
this.WorkingDirectory = UtilitiesInternal.MapNullableEnum<Models.ContainerWorkingDirectory, Common.ContainerWorkingDirectory>(protocolObject.WorkingDirectory);
}
#endregion Constructors
#region TaskContainerSettings
/// <summary>
/// Gets additional options to the container create command.
/// </summary>
/// <remarks>
/// These additional options are supplied as arguments to the "docker create" command, in addition to those controlled
/// by the Batch Service.
/// </remarks>
public string ContainerRunOptions { get; }
/// <summary>
/// Gets the image to use to create the container in which the task will run.
/// </summary>
/// <remarks>
/// This is the full image reference, as would be specified to "docker pull". If no tag is provided as part of the
/// image name, the tag ":latest" is used as a default.
/// </remarks>
public string ImageName { get; }
/// <summary>
/// Gets the private registry which contains the container image.
/// </summary>
/// <remarks>
/// This setting can be omitted if was already provided at pool creation.
/// </remarks>
public ContainerRegistry Registry { get; }
/// <summary>
/// Gets the location of the container task working directory.
/// </summary>
/// <remarks>
/// If not specified, the default is <see cref="Common.ContainerWorkingDirectory.TaskWorkingDirectory"/>.
/// </remarks>
public Common.ContainerWorkingDirectory? WorkingDirectory { get; }
#endregion // TaskContainerSettings
#region IPropertyMetadata
bool IModifiable.HasBeenModified
{
//This class is compile time readonly so it cannot have been modified
get { return false; }
}
bool IReadOnly.IsReadOnly
{
get { return true; }
set
{
// This class is compile time readonly already
}
}
#endregion // IPropertyMetadata
#region Internal/private methods
/// <summary>
/// Return a protocol object of the requested type.
/// </summary>
/// <returns>The protocol object of the requested type.</returns>
Models.TaskContainerSettings ITransportObjectProvider<Models.TaskContainerSettings>.GetTransportObject()
{
Models.TaskContainerSettings result = new Models.TaskContainerSettings()
{
ContainerRunOptions = this.ContainerRunOptions,
ImageName = this.ImageName,
Registry = UtilitiesInternal.CreateObjectWithNullCheck(this.Registry, (o) => o.GetTransportObject()),
WorkingDirectory = UtilitiesInternal.MapNullableEnum<Common.ContainerWorkingDirectory, Models.ContainerWorkingDirectory>(this.WorkingDirectory),
};
return result;
}
#endregion // Internal/private methods
}
}