| | 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.Collections.Generic; |
| | 9 | | using System.Text.Json; |
| | 10 | | using Azure.Core; |
| | 11 | |
|
| | 12 | | namespace Azure.Analytics.Synapse.Artifacts.Models |
| | 13 | | { |
| | 14 | | public partial class CommonDataServiceForAppsLinkedService : IUtf8JsonSerializable |
| | 15 | | { |
| | 16 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 17 | | { |
| 0 | 18 | | writer.WriteStartObject(); |
| 0 | 19 | | writer.WritePropertyName("type"); |
| 0 | 20 | | writer.WriteStringValue(Type); |
| 0 | 21 | | if (Optional.IsDefined(ConnectVia)) |
| | 22 | | { |
| 0 | 23 | | writer.WritePropertyName("connectVia"); |
| 0 | 24 | | writer.WriteObjectValue(ConnectVia); |
| | 25 | | } |
| 0 | 26 | | if (Optional.IsDefined(Description)) |
| | 27 | | { |
| 0 | 28 | | writer.WritePropertyName("description"); |
| 0 | 29 | | writer.WriteStringValue(Description); |
| | 30 | | } |
| 0 | 31 | | if (Optional.IsCollectionDefined(Parameters)) |
| | 32 | | { |
| 0 | 33 | | writer.WritePropertyName("parameters"); |
| 0 | 34 | | writer.WriteStartObject(); |
| 0 | 35 | | foreach (var item in Parameters) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName(item.Key); |
| 0 | 38 | | writer.WriteObjectValue(item.Value); |
| | 39 | | } |
| 0 | 40 | | writer.WriteEndObject(); |
| | 41 | | } |
| 0 | 42 | | if (Optional.IsCollectionDefined(Annotations)) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("annotations"); |
| 0 | 45 | | writer.WriteStartArray(); |
| 0 | 46 | | foreach (var item in Annotations) |
| | 47 | | { |
| 0 | 48 | | writer.WriteObjectValue(item); |
| | 49 | | } |
| 0 | 50 | | writer.WriteEndArray(); |
| | 51 | | } |
| 0 | 52 | | writer.WritePropertyName("typeProperties"); |
| 0 | 53 | | writer.WriteStartObject(); |
| 0 | 54 | | writer.WritePropertyName("deploymentType"); |
| 0 | 55 | | writer.WriteStringValue(DeploymentType.ToString()); |
| 0 | 56 | | if (Optional.IsDefined(HostName)) |
| | 57 | | { |
| 0 | 58 | | writer.WritePropertyName("hostName"); |
| 0 | 59 | | writer.WriteObjectValue(HostName); |
| | 60 | | } |
| 0 | 61 | | if (Optional.IsDefined(Port)) |
| | 62 | | { |
| 0 | 63 | | writer.WritePropertyName("port"); |
| 0 | 64 | | writer.WriteObjectValue(Port); |
| | 65 | | } |
| 0 | 66 | | if (Optional.IsDefined(ServiceUri)) |
| | 67 | | { |
| 0 | 68 | | writer.WritePropertyName("serviceUri"); |
| 0 | 69 | | writer.WriteObjectValue(ServiceUri); |
| | 70 | | } |
| 0 | 71 | | if (Optional.IsDefined(OrganizationName)) |
| | 72 | | { |
| 0 | 73 | | writer.WritePropertyName("organizationName"); |
| 0 | 74 | | writer.WriteObjectValue(OrganizationName); |
| | 75 | | } |
| 0 | 76 | | writer.WritePropertyName("authenticationType"); |
| 0 | 77 | | writer.WriteStringValue(AuthenticationType.ToString()); |
| 0 | 78 | | if (Optional.IsDefined(Username)) |
| | 79 | | { |
| 0 | 80 | | writer.WritePropertyName("username"); |
| 0 | 81 | | writer.WriteObjectValue(Username); |
| | 82 | | } |
| 0 | 83 | | if (Optional.IsDefined(Password)) |
| | 84 | | { |
| 0 | 85 | | writer.WritePropertyName("password"); |
| 0 | 86 | | writer.WriteObjectValue(Password); |
| | 87 | | } |
| 0 | 88 | | if (Optional.IsDefined(ServicePrincipalId)) |
| | 89 | | { |
| 0 | 90 | | writer.WritePropertyName("servicePrincipalId"); |
| 0 | 91 | | writer.WriteObjectValue(ServicePrincipalId); |
| | 92 | | } |
| 0 | 93 | | if (Optional.IsDefined(ServicePrincipalCredentialType)) |
| | 94 | | { |
| 0 | 95 | | writer.WritePropertyName("servicePrincipalCredentialType"); |
| 0 | 96 | | writer.WriteStringValue(ServicePrincipalCredentialType.Value.ToString()); |
| | 97 | | } |
| 0 | 98 | | if (Optional.IsDefined(ServicePrincipalCredential)) |
| | 99 | | { |
| 0 | 100 | | writer.WritePropertyName("servicePrincipalCredential"); |
| 0 | 101 | | writer.WriteObjectValue(ServicePrincipalCredential); |
| | 102 | | } |
| 0 | 103 | | if (Optional.IsDefined(EncryptedCredential)) |
| | 104 | | { |
| 0 | 105 | | writer.WritePropertyName("encryptedCredential"); |
| 0 | 106 | | writer.WriteObjectValue(EncryptedCredential); |
| | 107 | | } |
| 0 | 108 | | writer.WriteEndObject(); |
| 0 | 109 | | foreach (var item in AdditionalProperties) |
| | 110 | | { |
| 0 | 111 | | writer.WritePropertyName(item.Key); |
| 0 | 112 | | writer.WriteObjectValue(item.Value); |
| | 113 | | } |
| 0 | 114 | | writer.WriteEndObject(); |
| 0 | 115 | | } |
| | 116 | |
|
| | 117 | | internal static CommonDataServiceForAppsLinkedService DeserializeCommonDataServiceForAppsLinkedService(JsonEleme |
| | 118 | | { |
| 0 | 119 | | string type = default; |
| 0 | 120 | | Optional<IntegrationRuntimeReference> connectVia = default; |
| 0 | 121 | | Optional<string> description = default; |
| 0 | 122 | | Optional<IDictionary<string, ParameterSpecification>> parameters = default; |
| 0 | 123 | | Optional<IList<object>> annotations = default; |
| 0 | 124 | | DynamicsDeploymentType deploymentType = default; |
| 0 | 125 | | Optional<object> hostName = default; |
| 0 | 126 | | Optional<object> port = default; |
| 0 | 127 | | Optional<object> serviceUri = default; |
| 0 | 128 | | Optional<object> organizationName = default; |
| 0 | 129 | | DynamicsAuthenticationType authenticationType = default; |
| 0 | 130 | | Optional<object> username = default; |
| 0 | 131 | | Optional<SecretBase> password = default; |
| 0 | 132 | | Optional<object> servicePrincipalId = default; |
| 0 | 133 | | Optional<DynamicsServicePrincipalCredentialType> servicePrincipalCredentialType = default; |
| 0 | 134 | | Optional<SecretBase> servicePrincipalCredential = default; |
| 0 | 135 | | Optional<object> encryptedCredential = default; |
| 0 | 136 | | IDictionary<string, object> additionalProperties = default; |
| 0 | 137 | | Dictionary<string, object> additionalPropertiesDictionary = default; |
| 0 | 138 | | foreach (var property in element.EnumerateObject()) |
| | 139 | | { |
| 0 | 140 | | if (property.NameEquals("type")) |
| | 141 | | { |
| 0 | 142 | | type = property.Value.GetString(); |
| 0 | 143 | | continue; |
| | 144 | | } |
| 0 | 145 | | if (property.NameEquals("connectVia")) |
| | 146 | | { |
| 0 | 147 | | connectVia = IntegrationRuntimeReference.DeserializeIntegrationRuntimeReference(property.Value); |
| 0 | 148 | | continue; |
| | 149 | | } |
| 0 | 150 | | if (property.NameEquals("description")) |
| | 151 | | { |
| 0 | 152 | | description = property.Value.GetString(); |
| 0 | 153 | | continue; |
| | 154 | | } |
| 0 | 155 | | if (property.NameEquals("parameters")) |
| | 156 | | { |
| 0 | 157 | | Dictionary<string, ParameterSpecification> dictionary = new Dictionary<string, ParameterSpecificatio |
| 0 | 158 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 159 | | { |
| 0 | 160 | | dictionary.Add(property0.Name, ParameterSpecification.DeserializeParameterSpecification(property |
| | 161 | | } |
| 0 | 162 | | parameters = dictionary; |
| 0 | 163 | | continue; |
| | 164 | | } |
| 0 | 165 | | if (property.NameEquals("annotations")) |
| | 166 | | { |
| 0 | 167 | | List<object> array = new List<object>(); |
| 0 | 168 | | foreach (var item in property.Value.EnumerateArray()) |
| | 169 | | { |
| 0 | 170 | | array.Add(item.GetObject()); |
| | 171 | | } |
| 0 | 172 | | annotations = array; |
| 0 | 173 | | continue; |
| | 174 | | } |
| 0 | 175 | | if (property.NameEquals("typeProperties")) |
| | 176 | | { |
| 0 | 177 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 178 | | { |
| 0 | 179 | | if (property0.NameEquals("deploymentType")) |
| | 180 | | { |
| 0 | 181 | | deploymentType = new DynamicsDeploymentType(property0.Value.GetString()); |
| 0 | 182 | | continue; |
| | 183 | | } |
| 0 | 184 | | if (property0.NameEquals("hostName")) |
| | 185 | | { |
| 0 | 186 | | hostName = property0.Value.GetObject(); |
| 0 | 187 | | continue; |
| | 188 | | } |
| 0 | 189 | | if (property0.NameEquals("port")) |
| | 190 | | { |
| 0 | 191 | | port = property0.Value.GetObject(); |
| 0 | 192 | | continue; |
| | 193 | | } |
| 0 | 194 | | if (property0.NameEquals("serviceUri")) |
| | 195 | | { |
| 0 | 196 | | serviceUri = property0.Value.GetObject(); |
| 0 | 197 | | continue; |
| | 198 | | } |
| 0 | 199 | | if (property0.NameEquals("organizationName")) |
| | 200 | | { |
| 0 | 201 | | organizationName = property0.Value.GetObject(); |
| 0 | 202 | | continue; |
| | 203 | | } |
| 0 | 204 | | if (property0.NameEquals("authenticationType")) |
| | 205 | | { |
| 0 | 206 | | authenticationType = new DynamicsAuthenticationType(property0.Value.GetString()); |
| 0 | 207 | | continue; |
| | 208 | | } |
| 0 | 209 | | if (property0.NameEquals("username")) |
| | 210 | | { |
| 0 | 211 | | username = property0.Value.GetObject(); |
| 0 | 212 | | continue; |
| | 213 | | } |
| 0 | 214 | | if (property0.NameEquals("password")) |
| | 215 | | { |
| 0 | 216 | | password = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 217 | | continue; |
| | 218 | | } |
| 0 | 219 | | if (property0.NameEquals("servicePrincipalId")) |
| | 220 | | { |
| 0 | 221 | | servicePrincipalId = property0.Value.GetObject(); |
| 0 | 222 | | continue; |
| | 223 | | } |
| 0 | 224 | | if (property0.NameEquals("servicePrincipalCredentialType")) |
| | 225 | | { |
| 0 | 226 | | servicePrincipalCredentialType = new DynamicsServicePrincipalCredentialType(property0.Value. |
| 0 | 227 | | continue; |
| | 228 | | } |
| 0 | 229 | | if (property0.NameEquals("servicePrincipalCredential")) |
| | 230 | | { |
| 0 | 231 | | servicePrincipalCredential = SecretBase.DeserializeSecretBase(property0.Value); |
| 0 | 232 | | continue; |
| | 233 | | } |
| 0 | 234 | | if (property0.NameEquals("encryptedCredential")) |
| | 235 | | { |
| 0 | 236 | | encryptedCredential = property0.Value.GetObject(); |
| | 237 | | continue; |
| | 238 | | } |
| | 239 | | } |
| | 240 | | continue; |
| | 241 | | } |
| 0 | 242 | | additionalPropertiesDictionary ??= new Dictionary<string, object>(); |
| 0 | 243 | | additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); |
| | 244 | | } |
| 0 | 245 | | additionalProperties = additionalPropertiesDictionary; |
| 0 | 246 | | return new CommonDataServiceForAppsLinkedService(type, connectVia.Value, description.Value, Optional.ToDicti |
| | 247 | | } |
| | 248 | | } |
| | 249 | | } |