| | 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.Resources.Models |
| | 14 | | { |
| | 15 | | public partial class AzurePowerShellScript : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 24 | 19 | | writer.WriteStartObject(); |
| 24 | 20 | | writer.WritePropertyName("identity"); |
| 24 | 21 | | writer.WriteObjectValue(Identity); |
| 24 | 22 | | writer.WritePropertyName("location"); |
| 24 | 23 | | writer.WriteStringValue(Location); |
| 24 | 24 | | if (Tags != null) |
| | 25 | | { |
| 0 | 26 | | writer.WritePropertyName("tags"); |
| 0 | 27 | | writer.WriteStartObject(); |
| 0 | 28 | | foreach (var item in Tags) |
| | 29 | | { |
| 0 | 30 | | writer.WritePropertyName(item.Key); |
| 0 | 31 | | writer.WriteStringValue(item.Value); |
| | 32 | | } |
| 0 | 33 | | writer.WriteEndObject(); |
| | 34 | | } |
| 24 | 35 | | writer.WritePropertyName("kind"); |
| 24 | 36 | | writer.WriteStringValue(Kind.ToString()); |
| 24 | 37 | | if (SystemData != null) |
| | 38 | | { |
| 0 | 39 | | writer.WritePropertyName("systemData"); |
| 0 | 40 | | writer.WriteObjectValue(SystemData); |
| | 41 | | } |
| 24 | 42 | | if (Id != null) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("id"); |
| 0 | 45 | | writer.WriteStringValue(Id); |
| | 46 | | } |
| 24 | 47 | | if (Name != null) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("name"); |
| 0 | 50 | | writer.WriteStringValue(Name); |
| | 51 | | } |
| 24 | 52 | | if (Type != null) |
| | 53 | | { |
| 0 | 54 | | writer.WritePropertyName("type"); |
| 0 | 55 | | writer.WriteStringValue(Type); |
| | 56 | | } |
| 24 | 57 | | writer.WritePropertyName("properties"); |
| 24 | 58 | | writer.WriteStartObject(); |
| 24 | 59 | | if (ContainerSettings != null) |
| | 60 | | { |
| 0 | 61 | | writer.WritePropertyName("containerSettings"); |
| 0 | 62 | | writer.WriteObjectValue(ContainerSettings); |
| | 63 | | } |
| 24 | 64 | | if (StorageAccountSettings != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("storageAccountSettings"); |
| 0 | 67 | | writer.WriteObjectValue(StorageAccountSettings); |
| | 68 | | } |
| 24 | 69 | | if (CleanupPreference != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("cleanupPreference"); |
| 0 | 72 | | writer.WriteStringValue(CleanupPreference.Value.ToString()); |
| | 73 | | } |
| 24 | 74 | | if (ProvisioningState != null) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("provisioningState"); |
| 0 | 77 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 78 | | } |
| 24 | 79 | | if (Status != null) |
| | 80 | | { |
| 0 | 81 | | writer.WritePropertyName("status"); |
| 0 | 82 | | writer.WriteObjectValue(Status); |
| | 83 | | } |
| 24 | 84 | | if (Outputs != null) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("outputs"); |
| 0 | 87 | | writer.WriteStartObject(); |
| 0 | 88 | | foreach (var item in Outputs) |
| | 89 | | { |
| 0 | 90 | | writer.WritePropertyName(item.Key); |
| 0 | 91 | | writer.WriteObjectValue(item.Value); |
| | 92 | | } |
| 0 | 93 | | writer.WriteEndObject(); |
| | 94 | | } |
| 24 | 95 | | if (PrimaryScriptUri != null) |
| | 96 | | { |
| 0 | 97 | | writer.WritePropertyName("primaryScriptUri"); |
| 0 | 98 | | writer.WriteStringValue(PrimaryScriptUri); |
| | 99 | | } |
| 24 | 100 | | if (SupportingScriptUris != null) |
| | 101 | | { |
| 0 | 102 | | writer.WritePropertyName("supportingScriptUris"); |
| 0 | 103 | | writer.WriteStartArray(); |
| 0 | 104 | | foreach (var item in SupportingScriptUris) |
| | 105 | | { |
| 0 | 106 | | writer.WriteStringValue(item); |
| | 107 | | } |
| 0 | 108 | | writer.WriteEndArray(); |
| | 109 | | } |
| 24 | 110 | | if (ScriptContent != null) |
| | 111 | | { |
| 24 | 112 | | writer.WritePropertyName("scriptContent"); |
| 24 | 113 | | writer.WriteStringValue(ScriptContent); |
| | 114 | | } |
| 24 | 115 | | if (Arguments != null) |
| | 116 | | { |
| 16 | 117 | | writer.WritePropertyName("arguments"); |
| 16 | 118 | | writer.WriteStringValue(Arguments); |
| | 119 | | } |
| 24 | 120 | | if (EnvironmentVariables != null) |
| | 121 | | { |
| 0 | 122 | | writer.WritePropertyName("environmentVariables"); |
| 0 | 123 | | writer.WriteStartArray(); |
| 0 | 124 | | foreach (var item in EnvironmentVariables) |
| | 125 | | { |
| 0 | 126 | | writer.WriteObjectValue(item); |
| | 127 | | } |
| 0 | 128 | | writer.WriteEndArray(); |
| | 129 | | } |
| 24 | 130 | | if (ForceUpdateTag != null) |
| | 131 | | { |
| 0 | 132 | | writer.WritePropertyName("forceUpdateTag"); |
| 0 | 133 | | writer.WriteStringValue(ForceUpdateTag); |
| | 134 | | } |
| 24 | 135 | | writer.WritePropertyName("retentionInterval"); |
| 24 | 136 | | writer.WriteStringValue(RetentionInterval, "P"); |
| 24 | 137 | | if (Timeout != null) |
| | 138 | | { |
| 0 | 139 | | writer.WritePropertyName("timeout"); |
| 0 | 140 | | writer.WriteStringValue(Timeout.Value, "P"); |
| | 141 | | } |
| 24 | 142 | | writer.WritePropertyName("azPowerShellVersion"); |
| 24 | 143 | | writer.WriteStringValue(AzPowerShellVersion); |
| 24 | 144 | | writer.WriteEndObject(); |
| 24 | 145 | | writer.WriteEndObject(); |
| 24 | 146 | | } |
| | 147 | |
|
| | 148 | | internal static AzurePowerShellScript DeserializeAzurePowerShellScript(JsonElement element) |
| | 149 | | { |
| 74 | 150 | | ManagedServiceIdentity identity = default; |
| 74 | 151 | | string location = default; |
| 74 | 152 | | IDictionary<string, string> tags = default; |
| 74 | 153 | | ScriptType kind = default; |
| 74 | 154 | | SystemData systemData = default; |
| 74 | 155 | | string id = default; |
| 74 | 156 | | string name = default; |
| 74 | 157 | | string type = default; |
| 74 | 158 | | ContainerConfiguration containerSettings = default; |
| 74 | 159 | | StorageAccountConfiguration storageAccountSettings = default; |
| 74 | 160 | | CleanupOptions? cleanupPreference = default; |
| 74 | 161 | | ScriptProvisioningState? provisioningState = default; |
| 74 | 162 | | ScriptStatus status = default; |
| 74 | 163 | | IDictionary<string, object> outputs = default; |
| 74 | 164 | | string primaryScriptUri = default; |
| 74 | 165 | | IList<string> supportingScriptUris = default; |
| 74 | 166 | | string scriptContent = default; |
| 74 | 167 | | string arguments = default; |
| 74 | 168 | | IList<EnvironmentVariable> environmentVariables = default; |
| 74 | 169 | | string forceUpdateTag = default; |
| 74 | 170 | | TimeSpan retentionInterval = default; |
| 74 | 171 | | TimeSpan? timeout = default; |
| 74 | 172 | | string azPowerShellVersion = default; |
| 1444 | 173 | | foreach (var property in element.EnumerateObject()) |
| | 174 | | { |
| 648 | 175 | | if (property.NameEquals("identity")) |
| | 176 | | { |
| 74 | 177 | | identity = ManagedServiceIdentity.DeserializeManagedServiceIdentity(property.Value); |
| 74 | 178 | | continue; |
| | 179 | | } |
| 574 | 180 | | if (property.NameEquals("location")) |
| | 181 | | { |
| 74 | 182 | | location = property.Value.GetString(); |
| 74 | 183 | | continue; |
| | 184 | | } |
| 500 | 185 | | if (property.NameEquals("tags")) |
| | 186 | | { |
| 56 | 187 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 188 | | { |
| | 189 | | continue; |
| | 190 | | } |
| 56 | 191 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 224 | 192 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 193 | | { |
| 56 | 194 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 195 | | { |
| 0 | 196 | | dictionary.Add(property0.Name, null); |
| | 197 | | } |
| | 198 | | else |
| | 199 | | { |
| 56 | 200 | | dictionary.Add(property0.Name, property0.Value.GetString()); |
| | 201 | | } |
| | 202 | | } |
| 56 | 203 | | tags = dictionary; |
| 56 | 204 | | continue; |
| | 205 | | } |
| 444 | 206 | | if (property.NameEquals("kind")) |
| | 207 | | { |
| 74 | 208 | | kind = new ScriptType(property.Value.GetString()); |
| 74 | 209 | | continue; |
| | 210 | | } |
| 370 | 211 | | if (property.NameEquals("systemData")) |
| | 212 | | { |
| 74 | 213 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 214 | | { |
| | 215 | | continue; |
| | 216 | | } |
| 74 | 217 | | systemData = SystemData.DeserializeSystemData(property.Value); |
| 74 | 218 | | continue; |
| | 219 | | } |
| 296 | 220 | | if (property.NameEquals("id")) |
| | 221 | | { |
| 74 | 222 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 223 | | { |
| | 224 | | continue; |
| | 225 | | } |
| 74 | 226 | | id = property.Value.GetString(); |
| 74 | 227 | | continue; |
| | 228 | | } |
| 222 | 229 | | if (property.NameEquals("name")) |
| | 230 | | { |
| 74 | 231 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 232 | | { |
| | 233 | | continue; |
| | 234 | | } |
| 74 | 235 | | name = property.Value.GetString(); |
| 74 | 236 | | continue; |
| | 237 | | } |
| 148 | 238 | | if (property.NameEquals("type")) |
| | 239 | | { |
| 74 | 240 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 241 | | { |
| | 242 | | continue; |
| | 243 | | } |
| 74 | 244 | | type = property.Value.GetString(); |
| 74 | 245 | | continue; |
| | 246 | | } |
| 74 | 247 | | if (property.NameEquals("properties")) |
| | 248 | | { |
| 1428 | 249 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 250 | | { |
| 640 | 251 | | if (property0.NameEquals("containerSettings")) |
| | 252 | | { |
| 74 | 253 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 254 | | { |
| | 255 | | continue; |
| | 256 | | } |
| 74 | 257 | | containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property0.Value |
| 74 | 258 | | continue; |
| | 259 | | } |
| 566 | 260 | | if (property0.NameEquals("storageAccountSettings")) |
| | 261 | | { |
| 0 | 262 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 263 | | { |
| | 264 | | continue; |
| | 265 | | } |
| 0 | 266 | | storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration( |
| 0 | 267 | | continue; |
| | 268 | | } |
| 566 | 269 | | if (property0.NameEquals("cleanupPreference")) |
| | 270 | | { |
| 74 | 271 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 272 | | { |
| | 273 | | continue; |
| | 274 | | } |
| 74 | 275 | | cleanupPreference = new CleanupOptions(property0.Value.GetString()); |
| 74 | 276 | | continue; |
| | 277 | | } |
| 492 | 278 | | if (property0.NameEquals("provisioningState")) |
| | 279 | | { |
| 74 | 280 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 281 | | { |
| | 282 | | continue; |
| | 283 | | } |
| 74 | 284 | | provisioningState = new ScriptProvisioningState(property0.Value.GetString()); |
| 74 | 285 | | continue; |
| | 286 | | } |
| 418 | 287 | | if (property0.NameEquals("status")) |
| | 288 | | { |
| 74 | 289 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 290 | | { |
| | 291 | | continue; |
| | 292 | | } |
| 74 | 293 | | status = ScriptStatus.DeserializeScriptStatus(property0.Value); |
| 74 | 294 | | continue; |
| | 295 | | } |
| 344 | 296 | | if (property0.NameEquals("outputs")) |
| | 297 | | { |
| 24 | 298 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 299 | | { |
| | 300 | | continue; |
| | 301 | | } |
| 24 | 302 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 96 | 303 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 304 | | { |
| 24 | 305 | | if (property1.Value.ValueKind == JsonValueKind.Null) |
| | 306 | | { |
| 0 | 307 | | dictionary.Add(property1.Name, null); |
| | 308 | | } |
| | 309 | | else |
| | 310 | | { |
| 24 | 311 | | dictionary.Add(property1.Name, property1.Value.GetObject()); |
| | 312 | | } |
| | 313 | | } |
| 24 | 314 | | outputs = dictionary; |
| 24 | 315 | | continue; |
| | 316 | | } |
| 320 | 317 | | if (property0.NameEquals("primaryScriptUri")) |
| | 318 | | { |
| 0 | 319 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 320 | | { |
| | 321 | | continue; |
| | 322 | | } |
| 0 | 323 | | primaryScriptUri = property0.Value.GetString(); |
| 0 | 324 | | continue; |
| | 325 | | } |
| 320 | 326 | | if (property0.NameEquals("supportingScriptUris")) |
| | 327 | | { |
| 0 | 328 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 329 | | { |
| | 330 | | continue; |
| | 331 | | } |
| 0 | 332 | | List<string> array = new List<string>(); |
| 0 | 333 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 334 | | { |
| 0 | 335 | | if (item.ValueKind == JsonValueKind.Null) |
| | 336 | | { |
| 0 | 337 | | array.Add(null); |
| | 338 | | } |
| | 339 | | else |
| | 340 | | { |
| 0 | 341 | | array.Add(item.GetString()); |
| | 342 | | } |
| | 343 | | } |
| 0 | 344 | | supportingScriptUris = array; |
| 0 | 345 | | continue; |
| | 346 | | } |
| 320 | 347 | | if (property0.NameEquals("scriptContent")) |
| | 348 | | { |
| 74 | 349 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 350 | | { |
| | 351 | | continue; |
| | 352 | | } |
| 74 | 353 | | scriptContent = property0.Value.GetString(); |
| 74 | 354 | | continue; |
| | 355 | | } |
| 246 | 356 | | if (property0.NameEquals("arguments")) |
| | 357 | | { |
| 24 | 358 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 359 | | { |
| | 360 | | continue; |
| | 361 | | } |
| 24 | 362 | | arguments = property0.Value.GetString(); |
| 24 | 363 | | continue; |
| | 364 | | } |
| 222 | 365 | | if (property0.NameEquals("environmentVariables")) |
| | 366 | | { |
| 0 | 367 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 368 | | { |
| | 369 | | continue; |
| | 370 | | } |
| 0 | 371 | | List<EnvironmentVariable> array = new List<EnvironmentVariable>(); |
| 0 | 372 | | foreach (var item in property0.Value.EnumerateArray()) |
| | 373 | | { |
| 0 | 374 | | if (item.ValueKind == JsonValueKind.Null) |
| | 375 | | { |
| 0 | 376 | | array.Add(null); |
| | 377 | | } |
| | 378 | | else |
| | 379 | | { |
| 0 | 380 | | array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item)); |
| | 381 | | } |
| | 382 | | } |
| 0 | 383 | | environmentVariables = array; |
| 0 | 384 | | continue; |
| | 385 | | } |
| 222 | 386 | | if (property0.NameEquals("forceUpdateTag")) |
| | 387 | | { |
| 0 | 388 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 389 | | { |
| | 390 | | continue; |
| | 391 | | } |
| 0 | 392 | | forceUpdateTag = property0.Value.GetString(); |
| 0 | 393 | | continue; |
| | 394 | | } |
| 222 | 395 | | if (property0.NameEquals("retentionInterval")) |
| | 396 | | { |
| 74 | 397 | | retentionInterval = property0.Value.GetTimeSpan("P"); |
| 74 | 398 | | continue; |
| | 399 | | } |
| 148 | 400 | | if (property0.NameEquals("timeout")) |
| | 401 | | { |
| 74 | 402 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 403 | | { |
| | 404 | | continue; |
| | 405 | | } |
| 74 | 406 | | timeout = property0.Value.GetTimeSpan("P"); |
| 74 | 407 | | continue; |
| | 408 | | } |
| 74 | 409 | | if (property0.NameEquals("azPowerShellVersion")) |
| | 410 | | { |
| 74 | 411 | | azPowerShellVersion = property0.Value.GetString(); |
| | 412 | | continue; |
| | 413 | | } |
| | 414 | | } |
| | 415 | | continue; |
| | 416 | | } |
| | 417 | | } |
| 74 | 418 | | return new AzurePowerShellScript(id, name, type, identity, location, tags, kind, systemData, containerSettin |
| | 419 | | } |
| | 420 | | } |
| | 421 | | } |