| | | 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 | | |
| | 0 | 13 | | namespace Microsoft.Azure.Batch |
| | | 14 | | { |
| | 0 | 15 | | using Models = Microsoft.Azure.Batch.Protocol.Models; |
| | 0 | 16 | | using System; |
| | 0 | 17 | | using System.Collections.Generic; |
| | | 18 | | using System.Linq; |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Represents a certificate object of the Azure Batch service. |
| | | 22 | | /// </summary> |
| | | 23 | | public partial class CertificateReference : ITransportObjectProvider<Models.CertificateReference>, IPropertyMetadata |
| | | 24 | | { |
| | | 25 | | private class PropertyContainer : PropertyCollection |
| | | 26 | | { |
| | | 27 | | public readonly PropertyAccessor<Common.CertStoreLocation?> StoreLocationProperty; |
| | | 28 | | public readonly PropertyAccessor<string> StoreNameProperty; |
| | | 29 | | public readonly PropertyAccessor<string> ThumbprintProperty; |
| | | 30 | | public readonly PropertyAccessor<string> ThumbprintAlgorithmProperty; |
| | | 31 | | public readonly PropertyAccessor<Common.CertificateVisibility?> VisibilityProperty; |
| | | 32 | | |
| | 816 | 33 | | public PropertyContainer() : base(BindingState.Unbound) |
| | | 34 | | { |
| | 816 | 35 | | this.StoreLocationProperty = this.CreatePropertyAccessor<Common.CertStoreLocation?>(nameof(StoreLocation |
| | 816 | 36 | | this.StoreNameProperty = this.CreatePropertyAccessor<string>(nameof(StoreName), BindingAccess.Read | Bin |
| | 816 | 37 | | this.ThumbprintProperty = this.CreatePropertyAccessor<string>(nameof(Thumbprint), BindingAccess.Read | B |
| | 816 | 38 | | this.ThumbprintAlgorithmProperty = this.CreatePropertyAccessor<string>(nameof(ThumbprintAlgorithm), Bind |
| | 816 | 39 | | this.VisibilityProperty = this.CreatePropertyAccessor<Common.CertificateVisibility?>(nameof(Visibility), |
| | 816 | 40 | | } |
| | | 41 | | |
| | 4796 | 42 | | public PropertyContainer(Models.CertificateReference protocolObject) : base(BindingState.Bound) |
| | | 43 | | { |
| | 4796 | 44 | | this.StoreLocationProperty = this.CreatePropertyAccessor( |
| | 4796 | 45 | | UtilitiesInternal.MapNullableEnum<Models.CertificateStoreLocation, Common.CertStoreLocation>(protoco |
| | 4796 | 46 | | nameof(StoreLocation), |
| | 4796 | 47 | | BindingAccess.Read | BindingAccess.Write); |
| | 4796 | 48 | | this.StoreNameProperty = this.CreatePropertyAccessor( |
| | 4796 | 49 | | protocolObject.StoreName, |
| | 4796 | 50 | | nameof(StoreName), |
| | 4796 | 51 | | BindingAccess.Read | BindingAccess.Write); |
| | 4796 | 52 | | this.ThumbprintProperty = this.CreatePropertyAccessor( |
| | 4796 | 53 | | protocolObject.Thumbprint, |
| | 4796 | 54 | | nameof(Thumbprint), |
| | 4796 | 55 | | BindingAccess.Read | BindingAccess.Write); |
| | 4796 | 56 | | this.ThumbprintAlgorithmProperty = this.CreatePropertyAccessor( |
| | 4796 | 57 | | protocolObject.ThumbprintAlgorithm, |
| | 4796 | 58 | | nameof(ThumbprintAlgorithm), |
| | 4796 | 59 | | BindingAccess.Read | BindingAccess.Write); |
| | 4796 | 60 | | this.VisibilityProperty = this.CreatePropertyAccessor( |
| | 4796 | 61 | | UtilitiesInternal.ParseCertificateVisibility(protocolObject.Visibility), |
| | 4796 | 62 | | nameof(Visibility), |
| | 4796 | 63 | | BindingAccess.Read | BindingAccess.Write); |
| | 4796 | 64 | | } |
| | | 65 | | } |
| | | 66 | | |
| | | 67 | | private readonly PropertyContainer propertyContainer; |
| | | 68 | | |
| | | 69 | | #region Constructors |
| | | 70 | | |
| | | 71 | | /// <summary> |
| | | 72 | | /// Initializes a new instance of the <see cref="CertificateReference"/> class. |
| | | 73 | | /// </summary> |
| | 816 | 74 | | public CertificateReference() |
| | | 75 | | { |
| | 816 | 76 | | this.propertyContainer = new PropertyContainer(); |
| | 816 | 77 | | } |
| | | 78 | | |
| | 4796 | 79 | | internal CertificateReference(Models.CertificateReference protocolObject) |
| | | 80 | | { |
| | 4796 | 81 | | this.propertyContainer = new PropertyContainer(protocolObject); |
| | 4796 | 82 | | } |
| | | 83 | | |
| | | 84 | | #endregion Constructors |
| | | 85 | | |
| | | 86 | | #region CertificateReference |
| | | 87 | | |
| | | 88 | | /// <summary> |
| | | 89 | | /// Gets or sets the <see cref="Common.CertStoreLocation"/> for the certificate. |
| | | 90 | | /// </summary> |
| | | 91 | | public Common.CertStoreLocation? StoreLocation |
| | | 92 | | { |
| | 6425 | 93 | | get { return this.propertyContainer.StoreLocationProperty.Value; } |
| | 774 | 94 | | set { this.propertyContainer.StoreLocationProperty.Value = value; } |
| | | 95 | | } |
| | | 96 | | |
| | | 97 | | /// <summary> |
| | | 98 | | /// Gets or sets the name of the name of the certificate store. Besides <see cref="System.Security.Cryptography. |
| | | 99 | | /// the value can have a custom store name. |
| | | 100 | | /// </summary> |
| | | 101 | | public string StoreName |
| | | 102 | | { |
| | 6425 | 103 | | get { return this.propertyContainer.StoreNameProperty.Value; } |
| | 772 | 104 | | set { this.propertyContainer.StoreNameProperty.Value = value; } |
| | | 105 | | } |
| | | 106 | | |
| | | 107 | | /// <summary> |
| | | 108 | | /// Gets or sets the certificate thumbprint property of the certificate. |
| | | 109 | | /// </summary> |
| | | 110 | | public string Thumbprint |
| | | 111 | | { |
| | 6425 | 112 | | get { return this.propertyContainer.ThumbprintProperty.Value; } |
| | 806 | 113 | | set { this.propertyContainer.ThumbprintProperty.Value = value; } |
| | | 114 | | } |
| | | 115 | | |
| | | 116 | | /// <summary> |
| | | 117 | | /// Gets or sets the certificate thumbprint algorithm. Currently sha1 is the only supported algorithm. |
| | | 118 | | /// </summary> |
| | | 119 | | public string ThumbprintAlgorithm |
| | | 120 | | { |
| | 6425 | 121 | | get { return this.propertyContainer.ThumbprintAlgorithmProperty.Value; } |
| | 790 | 122 | | set { this.propertyContainer.ThumbprintAlgorithmProperty.Value = value; } |
| | | 123 | | } |
| | | 124 | | |
| | | 125 | | /// <summary> |
| | | 126 | | /// Gets or sets the set of users that can get to the private data of the installed certificate. |
| | | 127 | | /// </summary> |
| | | 128 | | public Common.CertificateVisibility? Visibility |
| | | 129 | | { |
| | 6425 | 130 | | get { return this.propertyContainer.VisibilityProperty.Value; } |
| | 770 | 131 | | set { this.propertyContainer.VisibilityProperty.Value = value; } |
| | | 132 | | } |
| | | 133 | | |
| | | 134 | | #endregion // CertificateReference |
| | | 135 | | |
| | | 136 | | #region IPropertyMetadata |
| | | 137 | | |
| | | 138 | | bool IModifiable.HasBeenModified |
| | | 139 | | { |
| | 0 | 140 | | get { return this.propertyContainer.HasBeenModified; } |
| | | 141 | | } |
| | | 142 | | |
| | | 143 | | bool IReadOnly.IsReadOnly |
| | | 144 | | { |
| | 0 | 145 | | get { return this.propertyContainer.IsReadOnly; } |
| | 11022 | 146 | | set { this.propertyContainer.IsReadOnly = value; } |
| | | 147 | | } |
| | | 148 | | |
| | | 149 | | #endregion //IPropertyMetadata |
| | | 150 | | |
| | | 151 | | #region Internal/private methods |
| | | 152 | | /// <summary> |
| | | 153 | | /// Return a protocol object of the requested type. |
| | | 154 | | /// </summary> |
| | | 155 | | /// <returns>The protocol object of the requested type.</returns> |
| | | 156 | | Models.CertificateReference ITransportObjectProvider<Models.CertificateReference>.GetTransportObject() |
| | | 157 | | { |
| | 814 | 158 | | Models.CertificateReference result = new Models.CertificateReference() |
| | 814 | 159 | | { |
| | 814 | 160 | | StoreLocation = UtilitiesInternal.MapNullableEnum<Common.CertStoreLocation, Models.CertificateStoreLocat |
| | 814 | 161 | | StoreName = this.StoreName, |
| | 814 | 162 | | Thumbprint = this.Thumbprint, |
| | 814 | 163 | | ThumbprintAlgorithm = this.ThumbprintAlgorithm, |
| | 814 | 164 | | Visibility = UtilitiesInternal.CertificateVisibilityToList(this.Visibility), |
| | 814 | 165 | | }; |
| | | 166 | | |
| | 814 | 167 | | return result; |
| | | 168 | | } |
| | | 169 | | |
| | | 170 | | /// <summary> |
| | | 171 | | /// Converts a collection of protocol layer objects to object layer collection objects. |
| | | 172 | | /// </summary> |
| | | 173 | | internal static IList<CertificateReference> ConvertFromProtocolCollection(IEnumerable<Models.CertificateReferenc |
| | | 174 | | { |
| | 1224 | 175 | | ConcurrentChangeTrackedModifiableList<CertificateReference> converted = UtilitiesInternal.CollectionToThread |
| | 1224 | 176 | | items: protoCollection, |
| | 3889 | 177 | | objectCreationFunc: o => new CertificateReference(o)); |
| | | 178 | | |
| | 1224 | 179 | | return converted; |
| | | 180 | | } |
| | | 181 | | |
| | | 182 | | /// <summary> |
| | | 183 | | /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state. |
| | | 184 | | /// </summary> |
| | | 185 | | internal static IList<CertificateReference> ConvertFromProtocolCollectionAndFreeze(IEnumerable<Models.Certificat |
| | | 186 | | { |
| | 0 | 187 | | ConcurrentChangeTrackedModifiableList<CertificateReference> converted = UtilitiesInternal.CollectionToThread |
| | 0 | 188 | | items: protoCollection, |
| | 0 | 189 | | objectCreationFunc: o => new CertificateReference(o).Freeze()); |
| | | 190 | | |
| | 0 | 191 | | converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze()); |
| | | 192 | | |
| | 0 | 193 | | return converted; |
| | | 194 | | } |
| | | 195 | | |
| | | 196 | | /// <summary> |
| | | 197 | | /// Converts a collection of protocol layer objects to object layer collection objects, with each object marked |
| | | 198 | | /// and returned as a readonly collection. |
| | | 199 | | /// </summary> |
| | | 200 | | internal static IReadOnlyList<CertificateReference> ConvertFromProtocolCollectionReadOnly(IEnumerable<Models.Cer |
| | | 201 | | { |
| | 1003 | 202 | | IReadOnlyList<CertificateReference> converted = |
| | 1003 | 203 | | UtilitiesInternal.CreateObjectWithNullCheck( |
| | 1003 | 204 | | UtilitiesInternal.CollectionToNonThreadSafeCollection( |
| | 1003 | 205 | | items: protoCollection, |
| | 3627 | 206 | | objectCreationFunc: o => new CertificateReference(o).Freeze()), o => o.AsReadOnly()); |
| | | 207 | | |
| | 1003 | 208 | | return converted; |
| | | 209 | | } |
| | | 210 | | |
| | | 211 | | #endregion // Internal/private methods |
| | | 212 | | } |
| | | 213 | | } |