| | | 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 certificate that can be installed on compute nodes and can be used to authenticate operations on a node. |
| | | 22 | | /// </summary> |
| | | 23 | | public partial class Certificate : ITransportObjectProvider<Models.CertificateAddParameter>, IInheritedBehaviors, IP |
| | | 24 | | { |
| | | 25 | | private class PropertyContainer : PropertyCollection |
| | | 26 | | { |
| | | 27 | | public readonly PropertyAccessor<Common.CertificateFormat?> CertificateFormatProperty; |
| | | 28 | | public readonly PropertyAccessor<string> DataProperty; |
| | | 29 | | public readonly PropertyAccessor<DeleteCertificateError> DeleteCertificateErrorProperty; |
| | | 30 | | public readonly PropertyAccessor<string> PasswordProperty; |
| | | 31 | | public readonly PropertyAccessor<Common.CertificateState?> PreviousStateProperty; |
| | | 32 | | public readonly PropertyAccessor<DateTime?> PreviousStateTransitionTimeProperty; |
| | | 33 | | public readonly PropertyAccessor<string> PublicDataProperty; |
| | | 34 | | public readonly PropertyAccessor<Common.CertificateState?> StateProperty; |
| | | 35 | | public readonly PropertyAccessor<DateTime?> StateTransitionTimeProperty; |
| | | 36 | | public readonly PropertyAccessor<string> ThumbprintProperty; |
| | | 37 | | public readonly PropertyAccessor<string> ThumbprintAlgorithmProperty; |
| | | 38 | | public readonly PropertyAccessor<string> UrlProperty; |
| | | 39 | | |
| | 4 | 40 | | public PropertyContainer() : base(BindingState.Unbound) |
| | | 41 | | { |
| | 4 | 42 | | this.CertificateFormatProperty = this.CreatePropertyAccessor<Common.CertificateFormat?>(nameof(Certifica |
| | 4 | 43 | | this.DataProperty = this.CreatePropertyAccessor<string>(nameof(Data), BindingAccess.Read | BindingAccess |
| | 4 | 44 | | this.DeleteCertificateErrorProperty = this.CreatePropertyAccessor<DeleteCertificateError>(nameof(DeleteC |
| | 4 | 45 | | this.PasswordProperty = this.CreatePropertyAccessor<string>(nameof(Password), BindingAccess.Read | Bindi |
| | 4 | 46 | | this.PreviousStateProperty = this.CreatePropertyAccessor<Common.CertificateState?>(nameof(PreviousState) |
| | 4 | 47 | | this.PreviousStateTransitionTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(PreviousStateTr |
| | 4 | 48 | | this.PublicDataProperty = this.CreatePropertyAccessor<string>(nameof(PublicData), BindingAccess.None); |
| | 4 | 49 | | this.StateProperty = this.CreatePropertyAccessor<Common.CertificateState?>(nameof(State), BindingAccess. |
| | 4 | 50 | | this.StateTransitionTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(StateTransitionTime), B |
| | 4 | 51 | | this.ThumbprintProperty = this.CreatePropertyAccessor<string>(nameof(Thumbprint), BindingAccess.Read | B |
| | 4 | 52 | | this.ThumbprintAlgorithmProperty = this.CreatePropertyAccessor<string>(nameof(ThumbprintAlgorithm), Bind |
| | 4 | 53 | | this.UrlProperty = this.CreatePropertyAccessor<string>(nameof(Url), BindingAccess.None); |
| | 4 | 54 | | } |
| | | 55 | | |
| | 0 | 56 | | public PropertyContainer(Models.Certificate protocolObject) : base(BindingState.Bound) |
| | | 57 | | { |
| | 0 | 58 | | this.CertificateFormatProperty = this.CreatePropertyAccessor<Common.CertificateFormat?>( |
| | 0 | 59 | | nameof(CertificateFormat), |
| | 0 | 60 | | BindingAccess.None); |
| | 0 | 61 | | this.DataProperty = this.CreatePropertyAccessor<string>( |
| | 0 | 62 | | nameof(Data), |
| | 0 | 63 | | BindingAccess.None); |
| | 0 | 64 | | this.DeleteCertificateErrorProperty = this.CreatePropertyAccessor( |
| | 0 | 65 | | UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.DeleteCertificateError, o => new DeleteCe |
| | 0 | 66 | | nameof(DeleteCertificateError), |
| | 0 | 67 | | BindingAccess.Read); |
| | 0 | 68 | | this.PasswordProperty = this.CreatePropertyAccessor<string>( |
| | 0 | 69 | | nameof(Password), |
| | 0 | 70 | | BindingAccess.None); |
| | 0 | 71 | | this.PreviousStateProperty = this.CreatePropertyAccessor( |
| | 0 | 72 | | UtilitiesInternal.MapNullableEnum<Models.CertificateState, Common.CertificateState>(protocolObject.P |
| | 0 | 73 | | nameof(PreviousState), |
| | 0 | 74 | | BindingAccess.Read); |
| | 0 | 75 | | this.PreviousStateTransitionTimeProperty = this.CreatePropertyAccessor( |
| | 0 | 76 | | protocolObject.PreviousStateTransitionTime, |
| | 0 | 77 | | nameof(PreviousStateTransitionTime), |
| | 0 | 78 | | BindingAccess.Read); |
| | 0 | 79 | | this.PublicDataProperty = this.CreatePropertyAccessor( |
| | 0 | 80 | | protocolObject.PublicData, |
| | 0 | 81 | | nameof(PublicData), |
| | 0 | 82 | | BindingAccess.Read); |
| | 0 | 83 | | this.StateProperty = this.CreatePropertyAccessor( |
| | 0 | 84 | | UtilitiesInternal.MapNullableEnum<Models.CertificateState, Common.CertificateState>(protocolObject.S |
| | 0 | 85 | | nameof(State), |
| | 0 | 86 | | BindingAccess.Read); |
| | 0 | 87 | | this.StateTransitionTimeProperty = this.CreatePropertyAccessor( |
| | 0 | 88 | | protocolObject.StateTransitionTime, |
| | 0 | 89 | | nameof(StateTransitionTime), |
| | 0 | 90 | | BindingAccess.Read); |
| | 0 | 91 | | this.ThumbprintProperty = this.CreatePropertyAccessor( |
| | 0 | 92 | | protocolObject.Thumbprint, |
| | 0 | 93 | | nameof(Thumbprint), |
| | 0 | 94 | | BindingAccess.Read); |
| | 0 | 95 | | this.ThumbprintAlgorithmProperty = this.CreatePropertyAccessor( |
| | 0 | 96 | | protocolObject.ThumbprintAlgorithm, |
| | 0 | 97 | | nameof(ThumbprintAlgorithm), |
| | 0 | 98 | | BindingAccess.Read); |
| | 0 | 99 | | this.UrlProperty = this.CreatePropertyAccessor( |
| | 0 | 100 | | protocolObject.Url, |
| | 0 | 101 | | nameof(Url), |
| | 0 | 102 | | BindingAccess.Read); |
| | 0 | 103 | | } |
| | | 104 | | } |
| | | 105 | | |
| | | 106 | | private PropertyContainer propertyContainer; |
| | | 107 | | |
| | | 108 | | private readonly BatchClient parentBatchClient; |
| | | 109 | | |
| | | 110 | | #region Constructors |
| | | 111 | | |
| | | 112 | | /// <summary> |
| | | 113 | | /// Initializes a new instance of the <see cref="Certificate"/> class. |
| | | 114 | | /// </summary> |
| | | 115 | | /// <param name='parentBatchClient'>The parent <see cref="BatchClient"/> to use.</param> |
| | | 116 | | /// <param name='baseBehaviors'>The base behaviors to use.</param> |
| | | 117 | | /// <param name='data'>The base64-encoded raw certificate data (contents of the .pfx or .cer file or data from w |
| | | 118 | | /// was created).</param> |
| | | 119 | | /// <param name='thumbprint'>The thumbprint of the certificate. This is a sequence of up to 40 hex digits.</para |
| | | 120 | | /// <param name='thumbprintAlgorithm'>The algorithm used to derive the thumbprint.</param> |
| | | 121 | | /// <param name='certificateFormat'>The format of the certificate data.</param> |
| | | 122 | | /// <param name='password'>The password to access the certificate private key.</param> |
| | 4 | 123 | | internal Certificate( |
| | 4 | 124 | | BatchClient parentBatchClient, |
| | 4 | 125 | | IEnumerable<BatchClientBehavior> baseBehaviors, |
| | 4 | 126 | | string data, |
| | 4 | 127 | | string thumbprint, |
| | 4 | 128 | | string thumbprintAlgorithm, |
| | 4 | 129 | | Common.CertificateFormat? certificateFormat = default(Common.CertificateFormat?), |
| | 4 | 130 | | string password = default(string)) |
| | | 131 | | { |
| | 4 | 132 | | this.propertyContainer = new PropertyContainer(); |
| | 4 | 133 | | this.parentBatchClient = parentBatchClient; |
| | 4 | 134 | | this.Data = data; |
| | 4 | 135 | | this.Thumbprint = thumbprint; |
| | 4 | 136 | | this.ThumbprintAlgorithm = thumbprintAlgorithm; |
| | 4 | 137 | | this.CertificateFormat = certificateFormat; |
| | 4 | 138 | | this.Password = password; |
| | 4 | 139 | | InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors); |
| | 4 | 140 | | } |
| | | 141 | | |
| | 0 | 142 | | internal Certificate( |
| | 0 | 143 | | BatchClient parentBatchClient, |
| | 0 | 144 | | Models.Certificate protocolObject, |
| | 0 | 145 | | IEnumerable<BatchClientBehavior> baseBehaviors) |
| | | 146 | | { |
| | 0 | 147 | | this.parentBatchClient = parentBatchClient; |
| | 0 | 148 | | InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors); |
| | 0 | 149 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| | 0 | 150 | | } |
| | | 151 | | |
| | | 152 | | #endregion Constructors |
| | | 153 | | |
| | | 154 | | #region IInheritedBehaviors |
| | | 155 | | |
| | | 156 | | /// <summary> |
| | | 157 | | /// Gets or sets a list of behaviors that modify or customize requests to the Batch service |
| | | 158 | | /// made via this <see cref="Certificate"/>. |
| | | 159 | | /// </summary> |
| | | 160 | | /// <remarks> |
| | | 161 | | /// <para>These behaviors are inherited by child objects.</para> |
| | | 162 | | /// <para>Modifications are applied in the order of the collection. The last write wins.</para> |
| | | 163 | | /// </remarks> |
| | 0 | 164 | | public IList<BatchClientBehavior> CustomBehaviors { get; set; } |
| | | 165 | | |
| | | 166 | | #endregion IInheritedBehaviors |
| | | 167 | | |
| | | 168 | | #region Certificate |
| | | 169 | | |
| | | 170 | | /// <summary> |
| | | 171 | | /// Gets the format of the certificate data. |
| | | 172 | | /// </summary> |
| | | 173 | | public Common.CertificateFormat? CertificateFormat |
| | | 174 | | { |
| | 0 | 175 | | get { return this.propertyContainer.CertificateFormatProperty.Value; } |
| | 8 | 176 | | private set { this.propertyContainer.CertificateFormatProperty.Value = value; } |
| | | 177 | | } |
| | | 178 | | |
| | | 179 | | /// <summary> |
| | | 180 | | /// Gets the base64-encoded raw certificate data (contents of the .pfx or .cer file or data from which the <see |
| | | 181 | | /// was created). |
| | | 182 | | /// </summary> |
| | | 183 | | /// <remarks> |
| | | 184 | | /// <para>This property is set when creating a new <see cref="Certificate"/>. It is not defined for certificates |
| | | 185 | | /// retrieved from the Batch service.</para> <para>The maximum size is 10 KB.</para> |
| | | 186 | | /// </remarks> |
| | | 187 | | public string Data |
| | | 188 | | { |
| | 0 | 189 | | get { return this.propertyContainer.DataProperty.Value; } |
| | 8 | 190 | | private set { this.propertyContainer.DataProperty.Value = value; } |
| | | 191 | | } |
| | | 192 | | |
| | | 193 | | /// <summary> |
| | | 194 | | /// Gets the error that occurred on the last attempt to delete this certificate. |
| | | 195 | | /// </summary> |
| | | 196 | | /// <remarks> |
| | | 197 | | /// This property is null unless the certificate is in the <see cref="Common.CertificateState.DeleteFailed"/> st |
| | | 198 | | /// </remarks> |
| | | 199 | | public DeleteCertificateError DeleteCertificateError |
| | | 200 | | { |
| | 0 | 201 | | get { return this.propertyContainer.DeleteCertificateErrorProperty.Value; } |
| | | 202 | | } |
| | | 203 | | |
| | | 204 | | /// <summary> |
| | | 205 | | /// Gets the password to access the certificate private key. |
| | | 206 | | /// </summary> |
| | | 207 | | /// <remarks> |
| | | 208 | | /// This property is set when creating a new <see cref="Certificate"/> from .pfx format data (see <see cref="Cer |
| | | 209 | | /// string)"/> and <see cref="CertificateOperations.CreateCertificateFromPfx(string, string)"/>). It is not defi |
| | | 210 | | /// certificates retrieved from the Batch service. |
| | | 211 | | /// </remarks> |
| | | 212 | | public string Password |
| | | 213 | | { |
| | 0 | 214 | | get { return this.propertyContainer.PasswordProperty.Value; } |
| | 8 | 215 | | private set { this.propertyContainer.PasswordProperty.Value = value; } |
| | | 216 | | } |
| | | 217 | | |
| | | 218 | | /// <summary> |
| | | 219 | | /// Gets the previous state of the certificate. |
| | | 220 | | /// </summary> |
| | | 221 | | /// <remarks> |
| | | 222 | | /// If the certificate is in its initial <see cref="Common.CertificateState.Active"/> state, the PreviousState p |
| | | 223 | | /// is not defined. |
| | | 224 | | /// </remarks> |
| | | 225 | | public Common.CertificateState? PreviousState |
| | | 226 | | { |
| | 0 | 227 | | get { return this.propertyContainer.PreviousStateProperty.Value; } |
| | | 228 | | } |
| | | 229 | | |
| | | 230 | | /// <summary> |
| | | 231 | | /// Gets the time at which the certificate entered its previous state. |
| | | 232 | | /// </summary> |
| | | 233 | | /// <remarks> |
| | | 234 | | /// If the certificate is in its initial <see cref="Common.CertificateState.Active"/> state, the PreviousStateTr |
| | | 235 | | /// property is not defined. |
| | | 236 | | /// </remarks> |
| | | 237 | | public DateTime? PreviousStateTransitionTime |
| | | 238 | | { |
| | 0 | 239 | | get { return this.propertyContainer.PreviousStateTransitionTimeProperty.Value; } |
| | | 240 | | } |
| | | 241 | | |
| | | 242 | | /// <summary> |
| | | 243 | | /// Gets the public part of the certificate as a string containing base-64 encoded .cer format data. |
| | | 244 | | /// </summary> |
| | | 245 | | public string PublicData |
| | | 246 | | { |
| | 0 | 247 | | get { return this.propertyContainer.PublicDataProperty.Value; } |
| | | 248 | | } |
| | | 249 | | |
| | | 250 | | /// <summary> |
| | | 251 | | /// Gets the current state of the certificate. |
| | | 252 | | /// </summary> |
| | | 253 | | public Common.CertificateState? State |
| | | 254 | | { |
| | 0 | 255 | | get { return this.propertyContainer.StateProperty.Value; } |
| | | 256 | | } |
| | | 257 | | |
| | | 258 | | /// <summary> |
| | | 259 | | /// Gets the time at which the certificate entered its current state. |
| | | 260 | | /// </summary> |
| | | 261 | | public DateTime? StateTransitionTime |
| | | 262 | | { |
| | 0 | 263 | | get { return this.propertyContainer.StateTransitionTimeProperty.Value; } |
| | | 264 | | } |
| | | 265 | | |
| | | 266 | | /// <summary> |
| | | 267 | | /// Gets the thumbprint of the certificate. This is a sequence of up to 40 hex digits. |
| | | 268 | | /// </summary> |
| | | 269 | | public string Thumbprint |
| | | 270 | | { |
| | 4 | 271 | | get { return this.propertyContainer.ThumbprintProperty.Value; } |
| | 8 | 272 | | private set { this.propertyContainer.ThumbprintProperty.Value = value; } |
| | | 273 | | } |
| | | 274 | | |
| | | 275 | | /// <summary> |
| | | 276 | | /// Gets the algorithm used to derive the thumbprint. |
| | | 277 | | /// </summary> |
| | | 278 | | public string ThumbprintAlgorithm |
| | | 279 | | { |
| | 4 | 280 | | get { return this.propertyContainer.ThumbprintAlgorithmProperty.Value; } |
| | 8 | 281 | | private set { this.propertyContainer.ThumbprintAlgorithmProperty.Value = value; } |
| | | 282 | | } |
| | | 283 | | |
| | | 284 | | /// <summary> |
| | | 285 | | /// Gets the URL of the certificate. |
| | | 286 | | /// </summary> |
| | | 287 | | public string Url |
| | | 288 | | { |
| | 0 | 289 | | get { return this.propertyContainer.UrlProperty.Value; } |
| | | 290 | | } |
| | | 291 | | |
| | | 292 | | #endregion // Certificate |
| | | 293 | | |
| | | 294 | | #region IPropertyMetadata |
| | | 295 | | |
| | | 296 | | bool IModifiable.HasBeenModified |
| | | 297 | | { |
| | 0 | 298 | | get { return this.propertyContainer.HasBeenModified; } |
| | | 299 | | } |
| | | 300 | | |
| | | 301 | | bool IReadOnly.IsReadOnly |
| | | 302 | | { |
| | 0 | 303 | | get { return this.propertyContainer.IsReadOnly; } |
| | 0 | 304 | | set { this.propertyContainer.IsReadOnly = value; } |
| | | 305 | | } |
| | | 306 | | |
| | | 307 | | #endregion //IPropertyMetadata |
| | | 308 | | |
| | | 309 | | #region Internal/private methods |
| | | 310 | | /// <summary> |
| | | 311 | | /// Return a protocol object of the requested type. |
| | | 312 | | /// </summary> |
| | | 313 | | /// <returns>The protocol object of the requested type.</returns> |
| | | 314 | | Models.CertificateAddParameter ITransportObjectProvider<Models.CertificateAddParameter>.GetTransportObject() |
| | | 315 | | { |
| | 0 | 316 | | Models.CertificateAddParameter result = new Models.CertificateAddParameter() |
| | 0 | 317 | | { |
| | 0 | 318 | | CertificateFormat = UtilitiesInternal.MapNullableEnum<Common.CertificateFormat, Models.CertificateFormat |
| | 0 | 319 | | Data = this.Data, |
| | 0 | 320 | | Password = this.Password, |
| | 0 | 321 | | Thumbprint = this.Thumbprint, |
| | 0 | 322 | | ThumbprintAlgorithm = this.ThumbprintAlgorithm, |
| | 0 | 323 | | }; |
| | | 324 | | |
| | 0 | 325 | | return result; |
| | | 326 | | } |
| | | 327 | | |
| | | 328 | | |
| | | 329 | | #endregion // Internal/private methods |
| | | 330 | | } |
| | | 331 | | } |