| | | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 2 | | // Licensed under the MIT License. See License.txt in the project root for license information. |
| | | 3 | | // |
| | | 4 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | | 5 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | | 6 | | // regenerated. |
| | | 7 | | |
| | | 8 | | // |
| | | 9 | | // This file was autogenerated by a tool. |
| | | 10 | | // Do not modify it. |
| | | 11 | | // |
| | | 12 | | |
| | | 13 | | namespace Microsoft.Azure.Batch |
| | | 14 | | { |
| | | 15 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| | | 16 | | using System; |
| | | 17 | | using System.Collections.Generic; |
| | | 18 | | using System.Linq; |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// A inbound NAT pool that can be used to address specific ports on compute nodes in a Batch pool externally. |
| | | 22 | | /// </summary> |
| | | 23 | | public partial class InboundNatPool : ITransportObjectProvider<Models.InboundNATPool>, IPropertyMetadata |
| | | 24 | | { |
| | | 25 | | #region Constructors |
| | | 26 | | /// <summary> |
| | | 27 | | /// Initializes a new instance of the <see cref="InboundNatPool"/> class. |
| | | 28 | | /// </summary> |
| | | 29 | | /// <param name='name'>The name of the endpoint.</param> |
| | | 30 | | /// <param name='protocol'>The protocol of the endpoint.</param> |
| | | 31 | | /// <param name='backendPort'>The port number on the compute node.</param> |
| | | 32 | | /// <param name='frontendPortRangeStart'>The first port number in the range of external ports that will be used |
| | | 33 | | /// on individual compute nodes.</param> |
| | | 34 | | /// <param name='frontendPortRangeEnd'>The last port number in the range of external ports that will be used to |
| | | 35 | | /// on individual compute nodes.</param> |
| | | 36 | | /// <param name='networkSecurityGroupRules'>A list of network security group rules that will be applied to the e |
| | 1068 | 37 | | public InboundNatPool( |
| | 1068 | 38 | | string name, |
| | 1068 | 39 | | Common.InboundEndpointProtocol protocol, |
| | 1068 | 40 | | int backendPort, |
| | 1068 | 41 | | int frontendPortRangeStart, |
| | 1068 | 42 | | int frontendPortRangeEnd, |
| | 1068 | 43 | | IReadOnlyList<NetworkSecurityGroupRule> networkSecurityGroupRules = default(IReadOnlyList<NetworkSecurityGro |
| | | 44 | | { |
| | 1068 | 45 | | this.Name = name; |
| | 1068 | 46 | | this.Protocol = protocol; |
| | 1068 | 47 | | this.BackendPort = backendPort; |
| | 1068 | 48 | | this.FrontendPortRangeStart = frontendPortRangeStart; |
| | 1068 | 49 | | this.FrontendPortRangeEnd = frontendPortRangeEnd; |
| | 1068 | 50 | | this.NetworkSecurityGroupRules = networkSecurityGroupRules; |
| | 1068 | 51 | | } |
| | | 52 | | |
| | 647 | 53 | | internal InboundNatPool(Models.InboundNATPool protocolObject) |
| | | 54 | | { |
| | 647 | 55 | | this.BackendPort = protocolObject.BackendPort; |
| | 647 | 56 | | this.FrontendPortRangeEnd = protocolObject.FrontendPortRangeEnd; |
| | 647 | 57 | | this.FrontendPortRangeStart = protocolObject.FrontendPortRangeStart; |
| | 647 | 58 | | this.Name = protocolObject.Name; |
| | 647 | 59 | | this.NetworkSecurityGroupRules = NetworkSecurityGroupRule.ConvertFromProtocolCollectionReadOnly(protocolObje |
| | 647 | 60 | | this.Protocol = UtilitiesInternal.MapEnum<Models.InboundEndpointProtocol, Common.InboundEndpointProtocol>(pr |
| | 647 | 61 | | } |
| | | 62 | | |
| | | 63 | | #endregion Constructors |
| | | 64 | | |
| | | 65 | | #region InboundNatPool |
| | | 66 | | |
| | | 67 | | /// <summary> |
| | | 68 | | /// Gets the port number on the compute node. |
| | | 69 | | /// </summary> |
| | | 70 | | /// <remarks> |
| | | 71 | | /// This must be unique within a Batch pool. Acceptable values are between 1 and 65535 except for 22, 3389, 2987 |
| | | 72 | | /// and 29877 as these are reserved. |
| | | 73 | | /// </remarks> |
| | 2782 | 74 | | public int BackendPort { get; } |
| | | 75 | | |
| | | 76 | | /// <summary> |
| | | 77 | | /// Gets the last port number in the range of external ports that will be used to provide inbound access to the |
| | | 78 | | /// on individual compute nodes. |
| | | 79 | | /// </summary> |
| | | 80 | | /// <remarks> |
| | | 81 | | /// Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved by the Batch |
| | | 82 | | /// service. All ranges within a pool must be distinct and cannot overlap. |
| | | 83 | | /// </remarks> |
| | 2782 | 84 | | public int FrontendPortRangeEnd { get; } |
| | | 85 | | |
| | | 86 | | /// <summary> |
| | | 87 | | /// Gets the first port number in the range of external ports that will be used to provide inbound access to the |
| | | 88 | | /// backendPort on individual compute nodes. |
| | | 89 | | /// </summary> |
| | | 90 | | /// <remarks> |
| | | 91 | | /// Acceptable values range between 1 and 65534 except ports from 50000 to 55000 which are reserved. All ranges |
| | | 92 | | /// a pool must be distinct and cannot overlap. |
| | | 93 | | /// </remarks> |
| | 2782 | 94 | | public int FrontendPortRangeStart { get; } |
| | | 95 | | |
| | | 96 | | /// <summary> |
| | | 97 | | /// Gets the name of the endpoint. |
| | | 98 | | /// </summary> |
| | | 99 | | /// <remarks> |
| | | 100 | | /// The name must be unique within a Batch pool, can contain letters, numbers, underscores, periods, and hyphens |
| | | 101 | | /// Names must start with a letter or number, must end with a letter, number, or underscore, and cannot exceed 7 |
| | | 102 | | /// characters. |
| | | 103 | | /// </remarks> |
| | 2782 | 104 | | public string Name { get; } |
| | | 105 | | |
| | | 106 | | /// <summary> |
| | | 107 | | /// Gets a list of network security group rules that will be applied to the endpoint. |
| | | 108 | | /// </summary> |
| | | 109 | | /// <remarks> |
| | | 110 | | /// The maximum number of rules that can be specified across all the endpoints on a pool is 25. If no network se |
| | | 111 | | /// group rules are specified, a default rule will be created to allow inbound access to the specified backendPo |
| | | 112 | | /// </remarks> |
| | 2782 | 113 | | public IReadOnlyList<NetworkSecurityGroupRule> NetworkSecurityGroupRules { get; } |
| | | 114 | | |
| | | 115 | | /// <summary> |
| | | 116 | | /// Gets the protocol of the endpoint. |
| | | 117 | | /// </summary> |
| | 2782 | 118 | | public Common.InboundEndpointProtocol Protocol { get; } |
| | | 119 | | |
| | | 120 | | #endregion // InboundNatPool |
| | | 121 | | |
| | | 122 | | #region IPropertyMetadata |
| | | 123 | | |
| | | 124 | | bool IModifiable.HasBeenModified |
| | | 125 | | { |
| | | 126 | | //This class is compile time readonly so it cannot have been modified |
| | 0 | 127 | | get { return false; } |
| | | 128 | | } |
| | | 129 | | |
| | | 130 | | bool IReadOnly.IsReadOnly |
| | | 131 | | { |
| | 0 | 132 | | get { return true; } |
| | | 133 | | set |
| | | 134 | | { |
| | | 135 | | // This class is compile time readonly already |
| | 648 | 136 | | } |
| | | 137 | | } |
| | | 138 | | |
| | | 139 | | #endregion // IPropertyMetadata |
| | | 140 | | |
| | | 141 | | #region Internal/private methods |
| | | 142 | | |
| | | 143 | | /// <summary> |
| | | 144 | | /// Return a protocol object of the requested type. |
| | | 145 | | /// </summary> |
| | | 146 | | /// <returns>The protocol object of the requested type.</returns> |
| | | 147 | | Models.InboundNATPool ITransportObjectProvider<Models.InboundNATPool>.GetTransportObject() |
| | | 148 | | { |
| | 1067 | 149 | | Models.InboundNATPool result = new Models.InboundNATPool() |
| | 1067 | 150 | | { |
| | 1067 | 151 | | BackendPort = this.BackendPort, |
| | 1067 | 152 | | FrontendPortRangeEnd = this.FrontendPortRangeEnd, |
| | 1067 | 153 | | FrontendPortRangeStart = this.FrontendPortRangeStart, |
| | 1067 | 154 | | Name = this.Name, |
| | 1067 | 155 | | NetworkSecurityGroupRules = UtilitiesInternal.ConvertToProtocolCollection(this.NetworkSecurityGroupRules |
| | 1067 | 156 | | Protocol = UtilitiesInternal.MapEnum<Common.InboundEndpointProtocol, Models.InboundEndpointProtocol>(thi |
| | 1067 | 157 | | }; |
| | | 158 | | |
| | 1067 | 159 | | return result; |
| | | 160 | | } |
| | | 161 | | |
| | | 162 | | /// <summary> |
| | | 163 | | /// Converts a collection of protocol layer objects to object layer collection objects. |
| | | 164 | | /// </summary> |
| | | 165 | | internal static IList<InboundNatPool> ConvertFromProtocolCollection(IEnumerable<Models.InboundNATPool> protoColl |
| | | 166 | | { |
| | 0 | 167 | | ConcurrentChangeTrackedModifiableList<InboundNatPool> converted = UtilitiesInternal.CollectionToThreadSafeCo |
| | 0 | 168 | | items: protoCollection, |
| | 0 | 169 | | objectCreationFunc: o => new InboundNatPool(o)); |
| | | 170 | | |
| | 0 | 171 | | return converted; |
| | | 172 | | } |
| | | 173 | | |
| | | 174 | | /// <summary> |
| | | 175 | | /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. |
| | | 176 | | /// </summary> |
| | | 177 | | internal static IList<InboundNatPool> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.InboundNATPool> |
| | | 178 | | { |
| | 0 | 179 | | ConcurrentChangeTrackedModifiableList<InboundNatPool> converted = UtilitiesInternal.CollectionToThreadSafeCo |
| | 0 | 180 | | items: protoCollection, |
| | 0 | 181 | | objectCreationFunc: o => new InboundNatPool(o).Freeze()); |
| | | 182 | | |
| | 0 | 183 | | converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); |
| | | 184 | | |
| | 0 | 185 | | return converted; |
| | | 186 | | } |
| | | 187 | | |
| | | 188 | | /// <summary> |
| | | 189 | | /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked |
| | | 190 | | /// and returned as a readonly collection. |
| | | 191 | | /// </summary> |
| | | 192 | | internal static IReadOnlyList<InboundNatPool> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.InboundNA |
| | | 193 | | { |
| | 295 | 194 | | IReadOnlyList<InboundNatPool> converted = |
| | 295 | 195 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| | 295 | 196 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| | 295 | 197 | | items: protoCollection, |
| | 1091 | 198 | | objectCreationFunc: o => new InboundNatPool(o).Freeze()), o => o.AsReadOnly()); |
| | | 199 | | |
| | 295 | 200 | | return converted; |
| | | 201 | | } |
| | | 202 | | |
| | | 203 | | #endregion // Internal/private methods |
| | | 204 | | } |
| | | 205 | | } |