| | 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 AzureCliScriptProperties : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 0 | 19 | | writer.WriteStartObject(); |
| 0 | 20 | | writer.WritePropertyName("azCliVersion"); |
| 0 | 21 | | writer.WriteStringValue(AzCliVersion); |
| 0 | 22 | | if (PrimaryScriptUri != null) |
| | 23 | | { |
| 0 | 24 | | writer.WritePropertyName("primaryScriptUri"); |
| 0 | 25 | | writer.WriteStringValue(PrimaryScriptUri); |
| | 26 | | } |
| 0 | 27 | | if (SupportingScriptUris != null) |
| | 28 | | { |
| 0 | 29 | | writer.WritePropertyName("supportingScriptUris"); |
| 0 | 30 | | writer.WriteStartArray(); |
| 0 | 31 | | foreach (var item in SupportingScriptUris) |
| | 32 | | { |
| 0 | 33 | | writer.WriteStringValue(item); |
| | 34 | | } |
| 0 | 35 | | writer.WriteEndArray(); |
| | 36 | | } |
| 0 | 37 | | if (ScriptContent != null) |
| | 38 | | { |
| 0 | 39 | | writer.WritePropertyName("scriptContent"); |
| 0 | 40 | | writer.WriteStringValue(ScriptContent); |
| | 41 | | } |
| 0 | 42 | | if (Arguments != null) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("arguments"); |
| 0 | 45 | | writer.WriteStringValue(Arguments); |
| | 46 | | } |
| 0 | 47 | | if (EnvironmentVariables != null) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("environmentVariables"); |
| 0 | 50 | | writer.WriteStartArray(); |
| 0 | 51 | | foreach (var item in EnvironmentVariables) |
| | 52 | | { |
| 0 | 53 | | writer.WriteObjectValue(item); |
| | 54 | | } |
| 0 | 55 | | writer.WriteEndArray(); |
| | 56 | | } |
| 0 | 57 | | if (ForceUpdateTag != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("forceUpdateTag"); |
| 0 | 60 | | writer.WriteStringValue(ForceUpdateTag); |
| | 61 | | } |
| 0 | 62 | | writer.WritePropertyName("retentionInterval"); |
| 0 | 63 | | writer.WriteStringValue(RetentionInterval, "P"); |
| 0 | 64 | | if (Timeout != null) |
| | 65 | | { |
| 0 | 66 | | writer.WritePropertyName("timeout"); |
| 0 | 67 | | writer.WriteStringValue(Timeout.Value, "P"); |
| | 68 | | } |
| 0 | 69 | | if (ContainerSettings != null) |
| | 70 | | { |
| 0 | 71 | | writer.WritePropertyName("containerSettings"); |
| 0 | 72 | | writer.WriteObjectValue(ContainerSettings); |
| | 73 | | } |
| 0 | 74 | | if (StorageAccountSettings != null) |
| | 75 | | { |
| 0 | 76 | | writer.WritePropertyName("storageAccountSettings"); |
| 0 | 77 | | writer.WriteObjectValue(StorageAccountSettings); |
| | 78 | | } |
| 0 | 79 | | if (CleanupPreference != null) |
| | 80 | | { |
| 0 | 81 | | writer.WritePropertyName("cleanupPreference"); |
| 0 | 82 | | writer.WriteStringValue(CleanupPreference.Value.ToString()); |
| | 83 | | } |
| 0 | 84 | | if (ProvisioningState != null) |
| | 85 | | { |
| 0 | 86 | | writer.WritePropertyName("provisioningState"); |
| 0 | 87 | | writer.WriteStringValue(ProvisioningState.Value.ToString()); |
| | 88 | | } |
| 0 | 89 | | if (Status != null) |
| | 90 | | { |
| 0 | 91 | | writer.WritePropertyName("status"); |
| 0 | 92 | | writer.WriteObjectValue(Status); |
| | 93 | | } |
| 0 | 94 | | if (Outputs != null) |
| | 95 | | { |
| 0 | 96 | | writer.WritePropertyName("outputs"); |
| 0 | 97 | | writer.WriteStartObject(); |
| 0 | 98 | | foreach (var item in Outputs) |
| | 99 | | { |
| 0 | 100 | | writer.WritePropertyName(item.Key); |
| 0 | 101 | | writer.WriteObjectValue(item.Value); |
| | 102 | | } |
| 0 | 103 | | writer.WriteEndObject(); |
| | 104 | | } |
| 0 | 105 | | writer.WriteEndObject(); |
| 0 | 106 | | } |
| | 107 | |
|
| | 108 | | internal static AzureCliScriptProperties DeserializeAzureCliScriptProperties(JsonElement element) |
| | 109 | | { |
| 0 | 110 | | string azCliVersion = default; |
| 0 | 111 | | string primaryScriptUri = default; |
| 0 | 112 | | IList<string> supportingScriptUris = default; |
| 0 | 113 | | string scriptContent = default; |
| 0 | 114 | | string arguments = default; |
| 0 | 115 | | IList<EnvironmentVariable> environmentVariables = default; |
| 0 | 116 | | string forceUpdateTag = default; |
| 0 | 117 | | TimeSpan retentionInterval = default; |
| 0 | 118 | | TimeSpan? timeout = default; |
| 0 | 119 | | ContainerConfiguration containerSettings = default; |
| 0 | 120 | | StorageAccountConfiguration storageAccountSettings = default; |
| 0 | 121 | | CleanupOptions? cleanupPreference = default; |
| 0 | 122 | | ScriptProvisioningState? provisioningState = default; |
| 0 | 123 | | ScriptStatus status = default; |
| 0 | 124 | | IDictionary<string, object> outputs = default; |
| 0 | 125 | | foreach (var property in element.EnumerateObject()) |
| | 126 | | { |
| 0 | 127 | | if (property.NameEquals("azCliVersion")) |
| | 128 | | { |
| 0 | 129 | | azCliVersion = property.Value.GetString(); |
| 0 | 130 | | continue; |
| | 131 | | } |
| 0 | 132 | | if (property.NameEquals("primaryScriptUri")) |
| | 133 | | { |
| 0 | 134 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 135 | | { |
| | 136 | | continue; |
| | 137 | | } |
| 0 | 138 | | primaryScriptUri = property.Value.GetString(); |
| 0 | 139 | | continue; |
| | 140 | | } |
| 0 | 141 | | if (property.NameEquals("supportingScriptUris")) |
| | 142 | | { |
| 0 | 143 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 144 | | { |
| | 145 | | continue; |
| | 146 | | } |
| 0 | 147 | | List<string> array = new List<string>(); |
| 0 | 148 | | foreach (var item in property.Value.EnumerateArray()) |
| | 149 | | { |
| 0 | 150 | | if (item.ValueKind == JsonValueKind.Null) |
| | 151 | | { |
| 0 | 152 | | array.Add(null); |
| | 153 | | } |
| | 154 | | else |
| | 155 | | { |
| 0 | 156 | | array.Add(item.GetString()); |
| | 157 | | } |
| | 158 | | } |
| 0 | 159 | | supportingScriptUris = array; |
| 0 | 160 | | continue; |
| | 161 | | } |
| 0 | 162 | | if (property.NameEquals("scriptContent")) |
| | 163 | | { |
| 0 | 164 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 165 | | { |
| | 166 | | continue; |
| | 167 | | } |
| 0 | 168 | | scriptContent = property.Value.GetString(); |
| 0 | 169 | | continue; |
| | 170 | | } |
| 0 | 171 | | if (property.NameEquals("arguments")) |
| | 172 | | { |
| 0 | 173 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 174 | | { |
| | 175 | | continue; |
| | 176 | | } |
| 0 | 177 | | arguments = property.Value.GetString(); |
| 0 | 178 | | continue; |
| | 179 | | } |
| 0 | 180 | | if (property.NameEquals("environmentVariables")) |
| | 181 | | { |
| 0 | 182 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 183 | | { |
| | 184 | | continue; |
| | 185 | | } |
| 0 | 186 | | List<EnvironmentVariable> array = new List<EnvironmentVariable>(); |
| 0 | 187 | | foreach (var item in property.Value.EnumerateArray()) |
| | 188 | | { |
| 0 | 189 | | if (item.ValueKind == JsonValueKind.Null) |
| | 190 | | { |
| 0 | 191 | | array.Add(null); |
| | 192 | | } |
| | 193 | | else |
| | 194 | | { |
| 0 | 195 | | array.Add(EnvironmentVariable.DeserializeEnvironmentVariable(item)); |
| | 196 | | } |
| | 197 | | } |
| 0 | 198 | | environmentVariables = array; |
| 0 | 199 | | continue; |
| | 200 | | } |
| 0 | 201 | | if (property.NameEquals("forceUpdateTag")) |
| | 202 | | { |
| 0 | 203 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 204 | | { |
| | 205 | | continue; |
| | 206 | | } |
| 0 | 207 | | forceUpdateTag = property.Value.GetString(); |
| 0 | 208 | | continue; |
| | 209 | | } |
| 0 | 210 | | if (property.NameEquals("retentionInterval")) |
| | 211 | | { |
| 0 | 212 | | retentionInterval = property.Value.GetTimeSpan("P"); |
| 0 | 213 | | continue; |
| | 214 | | } |
| 0 | 215 | | if (property.NameEquals("timeout")) |
| | 216 | | { |
| 0 | 217 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 218 | | { |
| | 219 | | continue; |
| | 220 | | } |
| 0 | 221 | | timeout = property.Value.GetTimeSpan("P"); |
| 0 | 222 | | continue; |
| | 223 | | } |
| 0 | 224 | | if (property.NameEquals("containerSettings")) |
| | 225 | | { |
| 0 | 226 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 227 | | { |
| | 228 | | continue; |
| | 229 | | } |
| 0 | 230 | | containerSettings = ContainerConfiguration.DeserializeContainerConfiguration(property.Value); |
| 0 | 231 | | continue; |
| | 232 | | } |
| 0 | 233 | | if (property.NameEquals("storageAccountSettings")) |
| | 234 | | { |
| 0 | 235 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 236 | | { |
| | 237 | | continue; |
| | 238 | | } |
| 0 | 239 | | storageAccountSettings = StorageAccountConfiguration.DeserializeStorageAccountConfiguration(property |
| 0 | 240 | | continue; |
| | 241 | | } |
| 0 | 242 | | if (property.NameEquals("cleanupPreference")) |
| | 243 | | { |
| 0 | 244 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 245 | | { |
| | 246 | | continue; |
| | 247 | | } |
| 0 | 248 | | cleanupPreference = new CleanupOptions(property.Value.GetString()); |
| 0 | 249 | | continue; |
| | 250 | | } |
| 0 | 251 | | if (property.NameEquals("provisioningState")) |
| | 252 | | { |
| 0 | 253 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 254 | | { |
| | 255 | | continue; |
| | 256 | | } |
| 0 | 257 | | provisioningState = new ScriptProvisioningState(property.Value.GetString()); |
| 0 | 258 | | continue; |
| | 259 | | } |
| 0 | 260 | | if (property.NameEquals("status")) |
| | 261 | | { |
| 0 | 262 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 263 | | { |
| | 264 | | continue; |
| | 265 | | } |
| 0 | 266 | | status = ScriptStatus.DeserializeScriptStatus(property.Value); |
| 0 | 267 | | continue; |
| | 268 | | } |
| 0 | 269 | | if (property.NameEquals("outputs")) |
| | 270 | | { |
| 0 | 271 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 272 | | { |
| | 273 | | continue; |
| | 274 | | } |
| 0 | 275 | | Dictionary<string, object> dictionary = new Dictionary<string, object>(); |
| 0 | 276 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 277 | | { |
| 0 | 278 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 279 | | { |
| 0 | 280 | | dictionary.Add(property0.Name, null); |
| | 281 | | } |
| | 282 | | else |
| | 283 | | { |
| 0 | 284 | | dictionary.Add(property0.Name, property0.Value.GetObject()); |
| | 285 | | } |
| | 286 | | } |
| 0 | 287 | | outputs = dictionary; |
| | 288 | | continue; |
| | 289 | | } |
| | 290 | | } |
| 0 | 291 | | return new AzureCliScriptProperties(containerSettings, storageAccountSettings, cleanupPreference, provisioni |
| | 292 | | } |
| | 293 | | } |
| | 294 | | } |