| | 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 FileShareItem : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 0 | 19 | | writer.WriteStartObject(); |
| 0 | 20 | | if (Etag != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("etag"); |
| 0 | 23 | | writer.WriteStringValue(Etag); |
| | 24 | | } |
| 0 | 25 | | if (Id != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("id"); |
| 0 | 28 | | writer.WriteStringValue(Id); |
| | 29 | | } |
| 0 | 30 | | if (Name != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("name"); |
| 0 | 33 | | writer.WriteStringValue(Name); |
| | 34 | | } |
| 0 | 35 | | if (Type != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("type"); |
| 0 | 38 | | writer.WriteStringValue(Type); |
| | 39 | | } |
| 0 | 40 | | writer.WritePropertyName("properties"); |
| 0 | 41 | | writer.WriteStartObject(); |
| 0 | 42 | | if (LastModifiedTime != null) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("lastModifiedTime"); |
| 0 | 45 | | writer.WriteStringValue(LastModifiedTime.Value, "O"); |
| | 46 | | } |
| 0 | 47 | | if (Metadata != null) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("metadata"); |
| 0 | 50 | | writer.WriteStartObject(); |
| 0 | 51 | | foreach (var item in Metadata) |
| | 52 | | { |
| 0 | 53 | | writer.WritePropertyName(item.Key); |
| 0 | 54 | | writer.WriteStringValue(item.Value); |
| | 55 | | } |
| 0 | 56 | | writer.WriteEndObject(); |
| | 57 | | } |
| 0 | 58 | | if (ShareQuota != null) |
| | 59 | | { |
| 0 | 60 | | writer.WritePropertyName("shareQuota"); |
| 0 | 61 | | writer.WriteNumberValue(ShareQuota.Value); |
| | 62 | | } |
| 0 | 63 | | if (EnabledProtocols != null) |
| | 64 | | { |
| 0 | 65 | | writer.WritePropertyName("enabledProtocols"); |
| 0 | 66 | | writer.WriteStringValue(EnabledProtocols.Value.ToString()); |
| | 67 | | } |
| 0 | 68 | | if (RootSquash != null) |
| | 69 | | { |
| 0 | 70 | | writer.WritePropertyName("rootSquash"); |
| 0 | 71 | | writer.WriteStringValue(RootSquash.Value.ToString()); |
| | 72 | | } |
| 0 | 73 | | if (Version != null) |
| | 74 | | { |
| 0 | 75 | | writer.WritePropertyName("version"); |
| 0 | 76 | | writer.WriteStringValue(Version); |
| | 77 | | } |
| 0 | 78 | | if (Deleted != null) |
| | 79 | | { |
| 0 | 80 | | writer.WritePropertyName("deleted"); |
| 0 | 81 | | writer.WriteBooleanValue(Deleted.Value); |
| | 82 | | } |
| 0 | 83 | | if (DeletedTime != null) |
| | 84 | | { |
| 0 | 85 | | writer.WritePropertyName("deletedTime"); |
| 0 | 86 | | writer.WriteStringValue(DeletedTime.Value, "O"); |
| | 87 | | } |
| 0 | 88 | | if (RemainingRetentionDays != null) |
| | 89 | | { |
| 0 | 90 | | writer.WritePropertyName("remainingRetentionDays"); |
| 0 | 91 | | writer.WriteNumberValue(RemainingRetentionDays.Value); |
| | 92 | | } |
| 0 | 93 | | if (AccessTier != null) |
| | 94 | | { |
| 0 | 95 | | writer.WritePropertyName("accessTier"); |
| 0 | 96 | | writer.WriteStringValue(AccessTier.Value.ToString()); |
| | 97 | | } |
| 0 | 98 | | if (AccessTierChangeTime != null) |
| | 99 | | { |
| 0 | 100 | | writer.WritePropertyName("accessTierChangeTime"); |
| 0 | 101 | | writer.WriteStringValue(AccessTierChangeTime.Value, "O"); |
| | 102 | | } |
| 0 | 103 | | if (AccessTierStatus != null) |
| | 104 | | { |
| 0 | 105 | | writer.WritePropertyName("accessTierStatus"); |
| 0 | 106 | | writer.WriteStringValue(AccessTierStatus); |
| | 107 | | } |
| 0 | 108 | | if (ShareUsageBytes != null) |
| | 109 | | { |
| 0 | 110 | | writer.WritePropertyName("shareUsageBytes"); |
| 0 | 111 | | writer.WriteNumberValue(ShareUsageBytes.Value); |
| | 112 | | } |
| 0 | 113 | | writer.WriteEndObject(); |
| 0 | 114 | | writer.WriteEndObject(); |
| 0 | 115 | | } |
| | 116 | |
|
| | 117 | | internal static FileShareItem DeserializeFileShareItem(JsonElement element) |
| | 118 | | { |
| 4 | 119 | | string etag = default; |
| 4 | 120 | | string id = default; |
| 4 | 121 | | string name = default; |
| 4 | 122 | | string type = default; |
| 4 | 123 | | DateTimeOffset? lastModifiedTime = default; |
| 4 | 124 | | IDictionary<string, string> metadata = default; |
| 4 | 125 | | int? shareQuota = default; |
| 4 | 126 | | EnabledProtocols? enabledProtocols = default; |
| 4 | 127 | | RootSquashType? rootSquash = default; |
| 4 | 128 | | string version = default; |
| 4 | 129 | | bool? deleted = default; |
| 4 | 130 | | DateTimeOffset? deletedTime = default; |
| 4 | 131 | | int? remainingRetentionDays = default; |
| 4 | 132 | | ShareAccessTier? accessTier = default; |
| 4 | 133 | | DateTimeOffset? accessTierChangeTime = default; |
| 4 | 134 | | string accessTierStatus = default; |
| 4 | 135 | | long? shareUsageBytes = default; |
| 48 | 136 | | foreach (var property in element.EnumerateObject()) |
| | 137 | | { |
| 20 | 138 | | if (property.NameEquals("etag")) |
| | 139 | | { |
| 4 | 140 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 141 | | { |
| | 142 | | continue; |
| | 143 | | } |
| 4 | 144 | | etag = property.Value.GetString(); |
| 4 | 145 | | continue; |
| | 146 | | } |
| 16 | 147 | | if (property.NameEquals("id")) |
| | 148 | | { |
| 4 | 149 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 150 | | { |
| | 151 | | continue; |
| | 152 | | } |
| 4 | 153 | | id = property.Value.GetString(); |
| 4 | 154 | | continue; |
| | 155 | | } |
| 12 | 156 | | if (property.NameEquals("name")) |
| | 157 | | { |
| 4 | 158 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| | 160 | | continue; |
| | 161 | | } |
| 4 | 162 | | name = property.Value.GetString(); |
| 4 | 163 | | continue; |
| | 164 | | } |
| 8 | 165 | | if (property.NameEquals("type")) |
| | 166 | | { |
| 4 | 167 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 4 | 171 | | type = property.Value.GetString(); |
| 4 | 172 | | continue; |
| | 173 | | } |
| 4 | 174 | | if (property.NameEquals("properties")) |
| | 175 | | { |
| 40 | 176 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 177 | | { |
| 16 | 178 | | if (property0.NameEquals("lastModifiedTime")) |
| | 179 | | { |
| 4 | 180 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 181 | | { |
| | 182 | | continue; |
| | 183 | | } |
| 4 | 184 | | lastModifiedTime = property0.Value.GetDateTimeOffset("O"); |
| 4 | 185 | | continue; |
| | 186 | | } |
| 12 | 187 | | if (property0.NameEquals("metadata")) |
| | 188 | | { |
| 0 | 189 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| | 191 | | continue; |
| | 192 | | } |
| 0 | 193 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 194 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 195 | | { |
| 0 | 196 | | if (property1.Value.ValueKind == JsonValueKind.Null) |
| | 197 | | { |
| 0 | 198 | | dictionary.Add(property1.Name, null); |
| | 199 | | } |
| | 200 | | else |
| | 201 | | { |
| 0 | 202 | | dictionary.Add(property1.Name, property1.Value.GetString()); |
| | 203 | | } |
| | 204 | | } |
| 0 | 205 | | metadata = dictionary; |
| 0 | 206 | | continue; |
| | 207 | | } |
| 12 | 208 | | if (property0.NameEquals("shareQuota")) |
| | 209 | | { |
| 4 | 210 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 211 | | { |
| | 212 | | continue; |
| | 213 | | } |
| 4 | 214 | | shareQuota = property0.Value.GetInt32(); |
| 4 | 215 | | continue; |
| | 216 | | } |
| 8 | 217 | | if (property0.NameEquals("enabledProtocols")) |
| | 218 | | { |
| 4 | 219 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 220 | | { |
| | 221 | | continue; |
| | 222 | | } |
| 4 | 223 | | enabledProtocols = new EnabledProtocols(property0.Value.GetString()); |
| 4 | 224 | | continue; |
| | 225 | | } |
| 4 | 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 | | } |
| 4 | 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 | | } |
| 4 | 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 | | } |
| 4 | 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 | | } |
| 4 | 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 | | } |
| 4 | 271 | | if (property0.NameEquals("accessTier")) |
| | 272 | | { |
| 4 | 273 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 274 | | { |
| | 275 | | continue; |
| | 276 | | } |
| 4 | 277 | | accessTier = new ShareAccessTier(property0.Value.GetString()); |
| 4 | 278 | | continue; |
| | 279 | | } |
| 0 | 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 | | } |
| 0 | 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 | | } |
| 0 | 298 | | if (property0.NameEquals("shareUsageBytes")) |
| | 299 | | { |
| 0 | 300 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 301 | | { |
| | 302 | | continue; |
| | 303 | | } |
| 0 | 304 | | shareUsageBytes = property0.Value.GetInt64(); |
| | 305 | | continue; |
| | 306 | | } |
| | 307 | | } |
| | 308 | | continue; |
| | 309 | | } |
| | 310 | | } |
| 4 | 311 | | return new FileShareItem(id, name, type, etag, lastModifiedTime, metadata, shareQuota, enabledProtocols, roo |
| | 312 | | } |
| | 313 | | } |
| | 314 | | } |