| | 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.Text.Json; |
| | 9 | | using Azure.Core; |
| | 10 | |
|
| | 11 | | namespace Azure.ResourceManager.Storage.Models |
| | 12 | | { |
| | 13 | | public partial class BlobServiceProperties : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 16 | 17 | | writer.WriteStartObject(); |
| 16 | 18 | | if (Sku != null) |
| | 19 | | { |
| 12 | 20 | | writer.WritePropertyName("sku"); |
| 12 | 21 | | writer.WriteObjectValue(Sku); |
| | 22 | | } |
| 16 | 23 | | if (Id != null) |
| | 24 | | { |
| 12 | 25 | | writer.WritePropertyName("id"); |
| 12 | 26 | | writer.WriteStringValue(Id); |
| | 27 | | } |
| 16 | 28 | | if (Name != null) |
| | 29 | | { |
| 12 | 30 | | writer.WritePropertyName("name"); |
| 12 | 31 | | writer.WriteStringValue(Name); |
| | 32 | | } |
| 16 | 33 | | if (Type != null) |
| | 34 | | { |
| 12 | 35 | | writer.WritePropertyName("type"); |
| 12 | 36 | | writer.WriteStringValue(Type); |
| | 37 | | } |
| 16 | 38 | | writer.WritePropertyName("properties"); |
| 16 | 39 | | writer.WriteStartObject(); |
| 16 | 40 | | if (Cors != null) |
| | 41 | | { |
| 16 | 42 | | writer.WritePropertyName("cors"); |
| 16 | 43 | | writer.WriteObjectValue(Cors); |
| | 44 | | } |
| 16 | 45 | | if (DefaultServiceVersion != null) |
| | 46 | | { |
| 8 | 47 | | writer.WritePropertyName("defaultServiceVersion"); |
| 8 | 48 | | writer.WriteStringValue(DefaultServiceVersion); |
| | 49 | | } |
| 16 | 50 | | if (DeleteRetentionPolicy != null) |
| | 51 | | { |
| 16 | 52 | | writer.WritePropertyName("deleteRetentionPolicy"); |
| 16 | 53 | | writer.WriteObjectValue(DeleteRetentionPolicy); |
| | 54 | | } |
| 16 | 55 | | if (IsVersioningEnabled != null) |
| | 56 | | { |
| 8 | 57 | | writer.WritePropertyName("isVersioningEnabled"); |
| 8 | 58 | | writer.WriteBooleanValue(IsVersioningEnabled.Value); |
| | 59 | | } |
| 16 | 60 | | if (AutomaticSnapshotPolicyEnabled != null) |
| | 61 | | { |
| 0 | 62 | | writer.WritePropertyName("automaticSnapshotPolicyEnabled"); |
| 0 | 63 | | writer.WriteBooleanValue(AutomaticSnapshotPolicyEnabled.Value); |
| | 64 | | } |
| 16 | 65 | | if (ChangeFeed != null) |
| | 66 | | { |
| 8 | 67 | | writer.WritePropertyName("changeFeed"); |
| 8 | 68 | | writer.WriteObjectValue(ChangeFeed); |
| | 69 | | } |
| 16 | 70 | | if (RestorePolicy != null) |
| | 71 | | { |
| 0 | 72 | | writer.WritePropertyName("restorePolicy"); |
| 0 | 73 | | writer.WriteObjectValue(RestorePolicy); |
| | 74 | | } |
| 16 | 75 | | if (ContainerDeleteRetentionPolicy != null) |
| | 76 | | { |
| 0 | 77 | | writer.WritePropertyName("containerDeleteRetentionPolicy"); |
| 0 | 78 | | writer.WriteObjectValue(ContainerDeleteRetentionPolicy); |
| | 79 | | } |
| 16 | 80 | | writer.WriteEndObject(); |
| 16 | 81 | | writer.WriteEndObject(); |
| 16 | 82 | | } |
| | 83 | |
|
| | 84 | | internal static BlobServiceProperties DeserializeBlobServiceProperties(JsonElement element) |
| | 85 | | { |
| 52 | 86 | | Sku sku = default; |
| 52 | 87 | | string id = default; |
| 52 | 88 | | string name = default; |
| 52 | 89 | | string type = default; |
| 52 | 90 | | CorsRules cors = default; |
| 52 | 91 | | string defaultServiceVersion = default; |
| 52 | 92 | | DeleteRetentionPolicy deleteRetentionPolicy = default; |
| 52 | 93 | | bool? isVersioningEnabled = default; |
| 52 | 94 | | bool? automaticSnapshotPolicyEnabled = default; |
| 52 | 95 | | ChangeFeed changeFeed = default; |
| 52 | 96 | | RestorePolicyProperties restorePolicy = default; |
| 52 | 97 | | DeleteRetentionPolicy containerDeleteRetentionPolicy = default; |
| 592 | 98 | | foreach (var property in element.EnumerateObject()) |
| | 99 | | { |
| 244 | 100 | | if (property.NameEquals("sku")) |
| | 101 | | { |
| 36 | 102 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 103 | | { |
| | 104 | | continue; |
| | 105 | | } |
| 36 | 106 | | sku = Sku.DeserializeSku(property.Value); |
| 36 | 107 | | continue; |
| | 108 | | } |
| 208 | 109 | | if (property.NameEquals("id")) |
| | 110 | | { |
| 52 | 111 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| | 113 | | continue; |
| | 114 | | } |
| 52 | 115 | | id = property.Value.GetString(); |
| 52 | 116 | | continue; |
| | 117 | | } |
| 156 | 118 | | if (property.NameEquals("name")) |
| | 119 | | { |
| 52 | 120 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 121 | | { |
| | 122 | | continue; |
| | 123 | | } |
| 52 | 124 | | name = property.Value.GetString(); |
| 52 | 125 | | continue; |
| | 126 | | } |
| 104 | 127 | | if (property.NameEquals("type")) |
| | 128 | | { |
| 52 | 129 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 130 | | { |
| | 131 | | continue; |
| | 132 | | } |
| 52 | 133 | | type = property.Value.GetString(); |
| 52 | 134 | | continue; |
| | 135 | | } |
| 52 | 136 | | if (property.NameEquals("properties")) |
| | 137 | | { |
| 408 | 138 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 139 | | { |
| 152 | 140 | | if (property0.NameEquals("cors")) |
| | 141 | | { |
| 52 | 142 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 143 | | { |
| | 144 | | continue; |
| | 145 | | } |
| 52 | 146 | | cors = CorsRules.DeserializeCorsRules(property0.Value); |
| 52 | 147 | | continue; |
| | 148 | | } |
| 100 | 149 | | if (property0.NameEquals("defaultServiceVersion")) |
| | 150 | | { |
| 16 | 151 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 152 | | { |
| | 153 | | continue; |
| | 154 | | } |
| 16 | 155 | | defaultServiceVersion = property0.Value.GetString(); |
| 16 | 156 | | continue; |
| | 157 | | } |
| 84 | 158 | | if (property0.NameEquals("deleteRetentionPolicy")) |
| | 159 | | { |
| 52 | 160 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 161 | | { |
| | 162 | | continue; |
| | 163 | | } |
| 52 | 164 | | deleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(property0.Val |
| 52 | 165 | | continue; |
| | 166 | | } |
| 32 | 167 | | if (property0.NameEquals("isVersioningEnabled")) |
| | 168 | | { |
| 16 | 169 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 170 | | { |
| | 171 | | continue; |
| | 172 | | } |
| 16 | 173 | | isVersioningEnabled = property0.Value.GetBoolean(); |
| 16 | 174 | | continue; |
| | 175 | | } |
| 16 | 176 | | if (property0.NameEquals("automaticSnapshotPolicyEnabled")) |
| | 177 | | { |
| 0 | 178 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 179 | | { |
| | 180 | | continue; |
| | 181 | | } |
| 0 | 182 | | automaticSnapshotPolicyEnabled = property0.Value.GetBoolean(); |
| 0 | 183 | | continue; |
| | 184 | | } |
| 16 | 185 | | if (property0.NameEquals("changeFeed")) |
| | 186 | | { |
| 16 | 187 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 188 | | { |
| | 189 | | continue; |
| | 190 | | } |
| 16 | 191 | | changeFeed = ChangeFeed.DeserializeChangeFeed(property0.Value); |
| 16 | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | if (property0.NameEquals("restorePolicy")) |
| | 195 | | { |
| 0 | 196 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 197 | | { |
| | 198 | | continue; |
| | 199 | | } |
| 0 | 200 | | restorePolicy = RestorePolicyProperties.DeserializeRestorePolicyProperties(property0.Value); |
| 0 | 201 | | continue; |
| | 202 | | } |
| 0 | 203 | | if (property0.NameEquals("containerDeleteRetentionPolicy")) |
| | 204 | | { |
| 0 | 205 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 206 | | { |
| | 207 | | continue; |
| | 208 | | } |
| 0 | 209 | | containerDeleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(prop |
| | 210 | | continue; |
| | 211 | | } |
| | 212 | | } |
| | 213 | | continue; |
| | 214 | | } |
| | 215 | | } |
| 52 | 216 | | return new BlobServiceProperties(id, name, type, sku, cors, defaultServiceVersion, deleteRetentionPolicy, is |
| | 217 | | } |
| | 218 | | } |
| | 219 | | } |