| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.Storage.Models |
| | 14 | | { |
| | 15 | | public partial class FileShare : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 16 | 19 | | writer.WriteStartObject(); |
| 16 | 20 | | if (Etag != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("etag"); |
| 0 | 23 | | writer.WriteStringValue(Etag); |
| | 24 | | } |
| 16 | 25 | | if (Id != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("id"); |
| 0 | 28 | | writer.WriteStringValue(Id); |
| | 29 | | } |
| 16 | 30 | | if (Name != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("name"); |
| 0 | 33 | | writer.WriteStringValue(Name); |
| | 34 | | } |
| 16 | 35 | | if (Type != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("type"); |
| 0 | 38 | | writer.WriteStringValue(Type); |
| | 39 | | } |
| 16 | 40 | | writer.WritePropertyName("properties"); |
| 16 | 41 | | writer.WriteStartObject(); |
| 16 | 42 | | if (LastModifiedTime != null) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("lastModifiedTime"); |
| 0 | 45 | | writer.WriteStringValue(LastModifiedTime.Value, "O"); |
| | 46 | | } |
| 16 | 47 | | if (Metadata != null) |
| | 48 | | { |
| 8 | 49 | | writer.WritePropertyName("metadata"); |
| 8 | 50 | | writer.WriteStartObject(); |
| 48 | 51 | | foreach (var item in Metadata) |
| | 52 | | { |
| 16 | 53 | | writer.WritePropertyName(item.Key); |
| 16 | 54 | | writer.WriteStringValue(item.Value); |
| | 55 | | } |
| 8 | 56 | | writer.WriteEndObject(); |
| | 57 | | } |
| 16 | 58 | | if (ShareQuota != null) |
| | 59 | | { |
| 8 | 60 | | writer.WritePropertyName("shareQuota"); |
| 8 | 61 | | writer.WriteNumberValue(ShareQuota.Value); |
| | 62 | | } |
| 16 | 63 | | if (EnabledProtocols != null) |
| | 64 | | { |
| 0 | 65 | | writer.WritePropertyName("enabledProtocols"); |
| 0 | 66 | | writer.WriteStringValue(EnabledProtocols.Value.ToString()); |
| | 67 | | } |
| 16 | 68 | | if (RootSquash != null) |
| | 69 | | { |
| 0 | 70 | | writer.WritePropertyName("rootSquash"); |
| 0 | 71 | | writer.WriteStringValue(RootSquash.Value.ToString()); |
| | 72 | | } |
| 16 | 73 | | if (Version != null) |
| | 74 | | { |
| 0 | 75 | | writer.WritePropertyName("version"); |
| 0 | 76 | | writer.WriteStringValue(Version); |
| | 77 | | } |
| 16 | 78 | | if (Deleted != null) |
| | 79 | | { |
| 0 | 80 | | writer.WritePropertyName("deleted"); |
| 0 | 81 | | writer.WriteBooleanValue(Deleted.Value); |
| | 82 | | } |
| 16 | 83 | | if (DeletedTime != null) |
| | 84 | | { |
| 0 | 85 | | writer.WritePropertyName("deletedTime"); |
| 0 | 86 | | writer.WriteStringValue(DeletedTime.Value, "O"); |
| | 87 | | } |
| 16 | 88 | | if (RemainingRetentionDays != null) |
| | 89 | | { |
| 0 | 90 | | writer.WritePropertyName("remainingRetentionDays"); |
| 0 | 91 | | writer.WriteNumberValue(RemainingRetentionDays.Value); |
| | 92 | | } |
| 16 | 93 | | if (AccessTier != null) |
| | 94 | | { |
| 0 | 95 | | writer.WritePropertyName("accessTier"); |
| 0 | 96 | | writer.WriteStringValue(AccessTier.Value.ToString()); |
| | 97 | | } |
| 16 | 98 | | if (AccessTierChangeTime != null) |
| | 99 | | { |
| 0 | 100 | | writer.WritePropertyName("accessTierChangeTime"); |
| 0 | 101 | | writer.WriteStringValue(AccessTierChangeTime.Value, "O"); |
| | 102 | | } |
| 16 | 103 | | if (AccessTierStatus != null) |
| | 104 | | { |
| 0 | 105 | | writer.WritePropertyName("accessTierStatus"); |
| 0 | 106 | | writer.WriteStringValue(AccessTierStatus); |
| | 107 | | } |
| 16 | 108 | | if (ShareUsageBytes != null) |
| | 109 | | { |
| 0 | 110 | | writer.WritePropertyName("shareUsageBytes"); |
| 0 | 111 | | writer.WriteNumberValue(ShareUsageBytes.Value); |
| | 112 | | } |
| 16 | 113 | | writer.WriteEndObject(); |
| 16 | 114 | | writer.WriteEndObject(); |
| 16 | 115 | | } |
| | 116 | |
|
| | 117 | | internal static FileShare DeserializeFileShare(JsonElement element) |
| | 118 | | { |
| 28 | 119 | | string etag = default; |
| 28 | 120 | | string id = default; |
| 28 | 121 | | string name = default; |
| 28 | 122 | | string type = default; |
| 28 | 123 | | DateTimeOffset? lastModifiedTime = default; |
| 28 | 124 | | IDictionary<string, string> metadata = default; |
| 28 | 125 | | int? shareQuota = default; |
| 28 | 126 | | EnabledProtocols? enabledProtocols = default; |
| 28 | 127 | | RootSquashType? rootSquash = default; |
| 28 | 128 | | string version = default; |
| 28 | 129 | | bool? deleted = default; |
| 28 | 130 | | DateTimeOffset? deletedTime = default; |
| 28 | 131 | | int? remainingRetentionDays = default; |
| 28 | 132 | | ShareAccessTier? accessTier = default; |
| 28 | 133 | | DateTimeOffset? accessTierChangeTime = default; |
| 28 | 134 | | string accessTierStatus = default; |
| 28 | 135 | | long? shareUsageBytes = default; |
| 304 | 136 | | foreach (var property in element.EnumerateObject()) |
| | 137 | | { |
| 124 | 138 | | if (property.NameEquals("etag")) |
| | 139 | | { |
| 12 | 140 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 141 | | { |
| | 142 | | continue; |
| | 143 | | } |
| 12 | 144 | | etag = property.Value.GetString(); |
| 12 | 145 | | continue; |
| | 146 | | } |
| 112 | 147 | | if (property.NameEquals("id")) |
| | 148 | | { |
| 28 | 149 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| | 151 | | continue; |
| | 152 | | } |
| 28 | 153 | | id = property.Value.GetString(); |
| 28 | 154 | | continue; |
| | 155 | | } |
| 84 | 156 | | if (property.NameEquals("name")) |
| | 157 | | { |
| 28 | 158 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| | 160 | | continue; |
| | 161 | | } |
| 28 | 162 | | name = property.Value.GetString(); |
| 28 | 163 | | continue; |
| | 164 | | } |
| 56 | 165 | | if (property.NameEquals("type")) |
| | 166 | | { |
| 28 | 167 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 28 | 171 | | type = property.Value.GetString(); |
| 28 | 172 | | continue; |
| | 173 | | } |
| 28 | 174 | | if (property.NameEquals("properties")) |
| | 175 | | { |
| 176 | 176 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 177 | | { |
| 60 | 178 | | if (property0.NameEquals("lastModifiedTime")) |
| | 179 | | { |
| 12 | 180 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 181 | | { |
| | 182 | | continue; |
| | 183 | | } |
| 12 | 184 | | lastModifiedTime = property0.Value.GetDateTimeOffset("O"); |
| 12 | 185 | | continue; |
| | 186 | | } |
| 48 | 187 | | if (property0.NameEquals("metadata")) |
| | 188 | | { |
| 16 | 189 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| | 191 | | continue; |
| | 192 | | } |
| 16 | 193 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 96 | 194 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 195 | | { |
| 32 | 196 | | if (property1.Value.ValueKind == JsonValueKind.Null) |
| | 197 | | { |
| 0 | 198 | | dictionary.Add(property1.Name, null); |
| | 199 | | } |
| | 200 | | else |
| | 201 | | { |
| 32 | 202 | | dictionary.Add(property1.Name, property1.Value.GetString()); |
| | 203 | | } |
| | 204 | | } |
| 16 | 205 | | metadata = dictionary; |
| 16 | 206 | | continue; |
| | 207 | | } |
| 32 | 208 | | if (property0.NameEquals("shareQuota")) |
| | 209 | | { |
| 20 | 210 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 211 | | { |
| | 212 | | continue; |
| | 213 | | } |
| 20 | 214 | | shareQuota = property0.Value.GetInt32(); |
| 20 | 215 | | continue; |
| | 216 | | } |
| 12 | 217 | | if (property0.NameEquals("enabledProtocols")) |
| | 218 | | { |
| 0 | 219 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 220 | | { |
| | 221 | | continue; |
| | 222 | | } |
| 0 | 223 | | enabledProtocols = new EnabledProtocols(property0.Value.GetString()); |
| 0 | 224 | | continue; |
| | 225 | | } |
| 12 | 226 | | if (property0.NameEquals("rootSquash")) |
| | 227 | | { |
| 0 | 228 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 229 | | { |
| | 230 | | continue; |
| | 231 | | } |
| 0 | 232 | | rootSquash = new RootSquashType(property0.Value.GetString()); |
| 0 | 233 | | continue; |
| | 234 | | } |
| 12 | 235 | | if (property0.NameEquals("version")) |
| | 236 | | { |
| 0 | 237 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 238 | | { |
| | 239 | | continue; |
| | 240 | | } |
| 0 | 241 | | version = property0.Value.GetString(); |
| 0 | 242 | | continue; |
| | 243 | | } |
| 12 | 244 | | if (property0.NameEquals("deleted")) |
| | 245 | | { |
| 0 | 246 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 247 | | { |
| | 248 | | continue; |
| | 249 | | } |
| 0 | 250 | | deleted = property0.Value.GetBoolean(); |
| 0 | 251 | | continue; |
| | 252 | | } |
| 12 | 253 | | if (property0.NameEquals("deletedTime")) |
| | 254 | | { |
| 0 | 255 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 256 | | { |
| | 257 | | continue; |
| | 258 | | } |
| 0 | 259 | | deletedTime = property0.Value.GetDateTimeOffset("O"); |
| 0 | 260 | | continue; |
| | 261 | | } |
| 12 | 262 | | if (property0.NameEquals("remainingRetentionDays")) |
| | 263 | | { |
| 0 | 264 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 265 | | { |
| | 266 | | continue; |
| | 267 | | } |
| 0 | 268 | | remainingRetentionDays = property0.Value.GetInt32(); |
| 0 | 269 | | continue; |
| | 270 | | } |
| 12 | 271 | | if (property0.NameEquals("accessTier")) |
| | 272 | | { |
| 0 | 273 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 274 | | { |
| | 275 | | continue; |
| | 276 | | } |
| 0 | 277 | | accessTier = new ShareAccessTier(property0.Value.GetString()); |
| 0 | 278 | | continue; |
| | 279 | | } |
| 12 | 280 | | if (property0.NameEquals("accessTierChangeTime")) |
| | 281 | | { |
| 0 | 282 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 283 | | { |
| | 284 | | continue; |
| | 285 | | } |
| 0 | 286 | | accessTierChangeTime = property0.Value.GetDateTimeOffset("O"); |
| 0 | 287 | | continue; |
| | 288 | | } |
| 12 | 289 | | if (property0.NameEquals("accessTierStatus")) |
| | 290 | | { |
| 0 | 291 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 292 | | { |
| | 293 | | continue; |
| | 294 | | } |
| 0 | 295 | | accessTierStatus = property0.Value.GetString(); |
| 0 | 296 | | continue; |
| | 297 | | } |
| 12 | 298 | | if (property0.NameEquals("shareUsageBytes")) |
| | 299 | | { |
| 12 | 300 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 301 | | { |
| | 302 | | continue; |
| | 303 | | } |
| 12 | 304 | | shareUsageBytes = property0.Value.GetInt64(); |
| | 305 | | continue; |
| | 306 | | } |
| | 307 | | } |
| | 308 | | continue; |
| | 309 | | } |
| | 310 | | } |
| 28 | 311 | | return new FileShare(id, name, type, etag, lastModifiedTime, metadata, shareQuota, enabledProtocols, rootSqu |
| | 312 | | } |
| | 313 | | } |
| | 314 | | } |