| | 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.Analytics.Synapse.Artifacts.Models |
| | 12 | | { |
| | 13 | | public partial class WebActivityAuthentication : IUtf8JsonSerializable |
| | 14 | | { |
| | 15 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 16 | | { |
| 0 | 17 | | writer.WriteStartObject(); |
| 0 | 18 | | writer.WritePropertyName("type"); |
| 0 | 19 | | writer.WriteStringValue(Type); |
| 0 | 20 | | if (Optional.IsDefined(Pfx)) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("pfx"); |
| 0 | 23 | | writer.WriteObjectValue(Pfx); |
| | 24 | | } |
| 0 | 25 | | if (Optional.IsDefined(Username)) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("username"); |
| 0 | 28 | | writer.WriteStringValue(Username); |
| | 29 | | } |
| 0 | 30 | | if (Optional.IsDefined(Password)) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("password"); |
| 0 | 33 | | writer.WriteObjectValue(Password); |
| | 34 | | } |
| 0 | 35 | | if (Optional.IsDefined(Resource)) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("resource"); |
| 0 | 38 | | writer.WriteStringValue(Resource); |
| | 39 | | } |
| 0 | 40 | | writer.WriteEndObject(); |
| 0 | 41 | | } |
| | 42 | |
|
| | 43 | | internal static WebActivityAuthentication DeserializeWebActivityAuthentication(JsonElement element) |
| | 44 | | { |
| 0 | 45 | | string type = default; |
| 0 | 46 | | Optional<SecretBase> pfx = default; |
| 0 | 47 | | Optional<string> username = default; |
| 0 | 48 | | Optional<SecretBase> password = default; |
| 0 | 49 | | Optional<string> resource = default; |
| 0 | 50 | | foreach (var property in element.EnumerateObject()) |
| | 51 | | { |
| 0 | 52 | | if (property.NameEquals("type")) |
| | 53 | | { |
| 0 | 54 | | type = property.Value.GetString(); |
| 0 | 55 | | continue; |
| | 56 | | } |
| 0 | 57 | | if (property.NameEquals("pfx")) |
| | 58 | | { |
| 0 | 59 | | pfx = SecretBase.DeserializeSecretBase(property.Value); |
| 0 | 60 | | continue; |
| | 61 | | } |
| 0 | 62 | | if (property.NameEquals("username")) |
| | 63 | | { |
| 0 | 64 | | username = property.Value.GetString(); |
| 0 | 65 | | continue; |
| | 66 | | } |
| 0 | 67 | | if (property.NameEquals("password")) |
| | 68 | | { |
| 0 | 69 | | password = SecretBase.DeserializeSecretBase(property.Value); |
| 0 | 70 | | continue; |
| | 71 | | } |
| 0 | 72 | | if (property.NameEquals("resource")) |
| | 73 | | { |
| 0 | 74 | | resource = property.Value.GetString(); |
| | 75 | | continue; |
| | 76 | | } |
| | 77 | | } |
| 0 | 78 | | return new WebActivityAuthentication(type, pfx.Value, username.Value, password.Value, resource.Value); |
| | 79 | | } |
| | 80 | | } |
| | 81 | | } |