|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | + |
| 4 | +#nullable disable |
| 5 | + |
| 6 | +using System; |
| 7 | +using System.ClientModel.Primitives; |
| 8 | +using System.Collections.Generic; |
| 9 | +using System.Text.Json; |
| 10 | +using Azure.Core; |
| 11 | + |
| 12 | +namespace Azure.ResourceManager.Billing.Models |
| 13 | +{ |
| 14 | + public partial class BillingRoleAssignmentProperties : IUtf8JsonSerializable, IJsonModel<BillingRoleAssignmentProperties> |
| 15 | + { |
| 16 | + internal static BillingRoleAssignmentProperties DeserializeBillingRoleAssignmentProperties(JsonElement element, ModelReaderWriterOptions options = null) |
| 17 | + { |
| 18 | + options ??= ModelSerializationExtensions.WireOptions; |
| 19 | + |
| 20 | + if (element.ValueKind == JsonValueKind.Null) |
| 21 | + { |
| 22 | + return null; |
| 23 | + } |
| 24 | + BillingProvisioningState? provisioningState = default; |
| 25 | + DateTimeOffset? createdOn = default; |
| 26 | + Guid? createdByPrincipalTenantId = default; |
| 27 | + string createdByPrincipalId = default; |
| 28 | + string createdByPrincipalPuid = default; |
| 29 | + string createdByUserEmailAddress = default; |
| 30 | + DateTimeOffset? modifiedOn = default; |
| 31 | + string modifiedByPrincipalPuid = default; |
| 32 | + string modifiedByUserEmailAddress = default; |
| 33 | + string modifiedByPrincipalId = default; |
| 34 | + Guid? modifiedByPrincipalTenantId = default; |
| 35 | + string principalPuid = default; |
| 36 | + string principalId = default; |
| 37 | + Guid? principalTenantId = default; |
| 38 | + ResourceIdentifier roleDefinitionId = default; |
| 39 | + string scope = default; |
| 40 | + string userAuthenticationType = default; |
| 41 | + string userEmailAddress = default; |
| 42 | + string principalTenantName = default; |
| 43 | + string principalDisplayName = default; |
| 44 | + BillingPrincipalType? principalType = default; |
| 45 | + ResourceIdentifier billingRequestId = default; |
| 46 | + ResourceIdentifier billingAccountId = default; |
| 47 | + string billingAccountDisplayName = default; |
| 48 | + ResourceIdentifier billingProfileId = default; |
| 49 | + string billingProfileDisplayName = default; |
| 50 | + ResourceIdentifier invoiceSectionId = default; |
| 51 | + string invoiceSectionDisplayName = default; |
| 52 | + ResourceIdentifier customerId = default; |
| 53 | + string customerDisplayName = default; |
| 54 | + IDictionary<string, BinaryData> serializedAdditionalRawData = default; |
| 55 | + Dictionary<string, BinaryData> rawDataDictionary = new Dictionary<string, BinaryData>(); |
| 56 | + foreach (var property in element.EnumerateObject()) |
| 57 | + { |
| 58 | + if (property.NameEquals("provisioningState"u8)) |
| 59 | + { |
| 60 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 61 | + { |
| 62 | + continue; |
| 63 | + } |
| 64 | + provisioningState = new BillingProvisioningState(property.Value.GetString()); |
| 65 | + continue; |
| 66 | + } |
| 67 | + if (property.NameEquals("createdOn"u8)) |
| 68 | + { |
| 69 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 70 | + { |
| 71 | + continue; |
| 72 | + } |
| 73 | + createdOn = property.Value.GetDateTimeOffset("O"); |
| 74 | + continue; |
| 75 | + } |
| 76 | + if (property.NameEquals("createdByPrincipalTenantId"u8)) |
| 77 | + { |
| 78 | + if (property.Value.ValueKind == JsonValueKind.Null || string.IsNullOrEmpty(property.Value.GetString())) |
| 79 | + { |
| 80 | + continue; |
| 81 | + } |
| 82 | + createdByPrincipalTenantId = property.Value.GetGuid(); |
| 83 | + continue; |
| 84 | + } |
| 85 | + if (property.NameEquals("createdByPrincipalId"u8)) |
| 86 | + { |
| 87 | + createdByPrincipalId = property.Value.GetString(); |
| 88 | + continue; |
| 89 | + } |
| 90 | + if (property.NameEquals("createdByPrincipalPuid"u8)) |
| 91 | + { |
| 92 | + createdByPrincipalPuid = property.Value.GetString(); |
| 93 | + continue; |
| 94 | + } |
| 95 | + if (property.NameEquals("createdByUserEmailAddress"u8)) |
| 96 | + { |
| 97 | + createdByUserEmailAddress = property.Value.GetString(); |
| 98 | + continue; |
| 99 | + } |
| 100 | + if (property.NameEquals("modifiedOn"u8)) |
| 101 | + { |
| 102 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 103 | + { |
| 104 | + continue; |
| 105 | + } |
| 106 | + modifiedOn = property.Value.GetDateTimeOffset("O"); |
| 107 | + continue; |
| 108 | + } |
| 109 | + if (property.NameEquals("modifiedByPrincipalPuid"u8)) |
| 110 | + { |
| 111 | + modifiedByPrincipalPuid = property.Value.GetString(); |
| 112 | + continue; |
| 113 | + } |
| 114 | + if (property.NameEquals("modifiedByUserEmailAddress"u8)) |
| 115 | + { |
| 116 | + modifiedByUserEmailAddress = property.Value.GetString(); |
| 117 | + continue; |
| 118 | + } |
| 119 | + if (property.NameEquals("modifiedByPrincipalId"u8)) |
| 120 | + { |
| 121 | + modifiedByPrincipalId = property.Value.GetString(); |
| 122 | + continue; |
| 123 | + } |
| 124 | + if (property.NameEquals("modifiedByPrincipalTenantId"u8)) |
| 125 | + { |
| 126 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 127 | + { |
| 128 | + continue; |
| 129 | + } |
| 130 | + modifiedByPrincipalTenantId = property.Value.GetGuid(); |
| 131 | + continue; |
| 132 | + } |
| 133 | + if (property.NameEquals("principalPuid"u8)) |
| 134 | + { |
| 135 | + principalPuid = property.Value.GetString(); |
| 136 | + continue; |
| 137 | + } |
| 138 | + if (property.NameEquals("principalId"u8)) |
| 139 | + { |
| 140 | + principalId = property.Value.GetString(); |
| 141 | + continue; |
| 142 | + } |
| 143 | + if (property.NameEquals("principalTenantId"u8)) |
| 144 | + { |
| 145 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 146 | + { |
| 147 | + continue; |
| 148 | + } |
| 149 | + principalTenantId = property.Value.GetGuid(); |
| 150 | + continue; |
| 151 | + } |
| 152 | + if (property.NameEquals("roleDefinitionId"u8)) |
| 153 | + { |
| 154 | + roleDefinitionId = new ResourceIdentifier(property.Value.GetString()); |
| 155 | + continue; |
| 156 | + } |
| 157 | + if (property.NameEquals("scope"u8)) |
| 158 | + { |
| 159 | + scope = property.Value.GetString(); |
| 160 | + continue; |
| 161 | + } |
| 162 | + if (property.NameEquals("userAuthenticationType"u8)) |
| 163 | + { |
| 164 | + userAuthenticationType = property.Value.GetString(); |
| 165 | + continue; |
| 166 | + } |
| 167 | + if (property.NameEquals("userEmailAddress"u8)) |
| 168 | + { |
| 169 | + userEmailAddress = property.Value.GetString(); |
| 170 | + continue; |
| 171 | + } |
| 172 | + if (property.NameEquals("principalTenantName"u8)) |
| 173 | + { |
| 174 | + principalTenantName = property.Value.GetString(); |
| 175 | + continue; |
| 176 | + } |
| 177 | + if (property.NameEquals("principalDisplayName"u8)) |
| 178 | + { |
| 179 | + principalDisplayName = property.Value.GetString(); |
| 180 | + continue; |
| 181 | + } |
| 182 | + if (property.NameEquals("principalType"u8)) |
| 183 | + { |
| 184 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 185 | + { |
| 186 | + continue; |
| 187 | + } |
| 188 | + principalType = new BillingPrincipalType(property.Value.GetString()); |
| 189 | + continue; |
| 190 | + } |
| 191 | + if (property.NameEquals("billingRequestId"u8)) |
| 192 | + { |
| 193 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 194 | + { |
| 195 | + continue; |
| 196 | + } |
| 197 | + billingRequestId = new ResourceIdentifier(property.Value.GetString()); |
| 198 | + continue; |
| 199 | + } |
| 200 | + if (property.NameEquals("billingAccountId"u8)) |
| 201 | + { |
| 202 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 203 | + { |
| 204 | + continue; |
| 205 | + } |
| 206 | + billingAccountId = new ResourceIdentifier(property.Value.GetString()); |
| 207 | + continue; |
| 208 | + } |
| 209 | + if (property.NameEquals("billingAccountDisplayName"u8)) |
| 210 | + { |
| 211 | + billingAccountDisplayName = property.Value.GetString(); |
| 212 | + continue; |
| 213 | + } |
| 214 | + if (property.NameEquals("billingProfileId"u8)) |
| 215 | + { |
| 216 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 217 | + { |
| 218 | + continue; |
| 219 | + } |
| 220 | + billingProfileId = new ResourceIdentifier(property.Value.GetString()); |
| 221 | + continue; |
| 222 | + } |
| 223 | + if (property.NameEquals("billingProfileDisplayName"u8)) |
| 224 | + { |
| 225 | + billingProfileDisplayName = property.Value.GetString(); |
| 226 | + continue; |
| 227 | + } |
| 228 | + if (property.NameEquals("invoiceSectionId"u8)) |
| 229 | + { |
| 230 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 231 | + { |
| 232 | + continue; |
| 233 | + } |
| 234 | + invoiceSectionId = new ResourceIdentifier(property.Value.GetString()); |
| 235 | + continue; |
| 236 | + } |
| 237 | + if (property.NameEquals("invoiceSectionDisplayName"u8)) |
| 238 | + { |
| 239 | + invoiceSectionDisplayName = property.Value.GetString(); |
| 240 | + continue; |
| 241 | + } |
| 242 | + if (property.NameEquals("customerId"u8)) |
| 243 | + { |
| 244 | + if (property.Value.ValueKind == JsonValueKind.Null) |
| 245 | + { |
| 246 | + continue; |
| 247 | + } |
| 248 | + customerId = new ResourceIdentifier(property.Value.GetString()); |
| 249 | + continue; |
| 250 | + } |
| 251 | + if (property.NameEquals("customerDisplayName"u8)) |
| 252 | + { |
| 253 | + customerDisplayName = property.Value.GetString(); |
| 254 | + continue; |
| 255 | + } |
| 256 | + if (options.Format != "W") |
| 257 | + { |
| 258 | + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); |
| 259 | + } |
| 260 | + } |
| 261 | + serializedAdditionalRawData = rawDataDictionary; |
| 262 | + return new BillingRoleAssignmentProperties( |
| 263 | + provisioningState, |
| 264 | + createdOn, |
| 265 | + createdByPrincipalTenantId, |
| 266 | + createdByPrincipalId, |
| 267 | + createdByPrincipalPuid, |
| 268 | + createdByUserEmailAddress, |
| 269 | + modifiedOn, |
| 270 | + modifiedByPrincipalPuid, |
| 271 | + modifiedByUserEmailAddress, |
| 272 | + modifiedByPrincipalId, |
| 273 | + modifiedByPrincipalTenantId, |
| 274 | + principalPuid, |
| 275 | + principalId, |
| 276 | + principalTenantId, |
| 277 | + roleDefinitionId, |
| 278 | + scope, |
| 279 | + userAuthenticationType, |
| 280 | + userEmailAddress, |
| 281 | + principalTenantName, |
| 282 | + principalDisplayName, |
| 283 | + principalType, |
| 284 | + billingRequestId, |
| 285 | + billingAccountId, |
| 286 | + billingAccountDisplayName, |
| 287 | + billingProfileId, |
| 288 | + billingProfileDisplayName, |
| 289 | + invoiceSectionId, |
| 290 | + invoiceSectionDisplayName, |
| 291 | + customerId, |
| 292 | + customerDisplayName, |
| 293 | + serializedAdditionalRawData); |
| 294 | + } |
| 295 | + } |
| 296 | +} |
0 commit comments