Пример #1
0
 internal ReservationsProperties(ReservedResourceType?reservedResourceType, InstanceFlexibility?instanceFlexibility, string displayName, IReadOnlyList <string> appliedScopes, AppliedScopeType?appliedScopeType, bool?archived, string capabilities, int?quantity, ProvisioningState?provisioningState, DateTimeOffset?effectiveOn, DateTimeOffset?benefitStartOn, DateTimeOffset?lastUpdatedOn, DateTimeOffset?expiryOn, string skuDescription, ExtendedStatusInfo extendedStatusInfo, ReservationBillingPlan?billingPlan, string displayProvisioningState, string provisioningSubState, DateTimeOffset?purchaseOn, ReservationSplitProperties splitProperties, ReservationMergeProperties mergeProperties, string billingScopeId, bool?renew, string renewSource, string renewDestination, RenewPropertiesResponse renewProperties, ReservationTerm?term, string userFriendlyAppliedScopeType, string userFriendlyRenewState, ReservationsPropertiesUtilization utilization)
 {
     ReservedResourceType     = reservedResourceType;
     InstanceFlexibility      = instanceFlexibility;
     DisplayName              = displayName;
     AppliedScopes            = appliedScopes;
     AppliedScopeType         = appliedScopeType;
     Archived                 = archived;
     Capabilities             = capabilities;
     Quantity                 = quantity;
     ProvisioningState        = provisioningState;
     EffectiveOn              = effectiveOn;
     BenefitStartOn           = benefitStartOn;
     LastUpdatedOn            = lastUpdatedOn;
     ExpiryOn                 = expiryOn;
     SkuDescription           = skuDescription;
     ExtendedStatusInfo       = extendedStatusInfo;
     BillingPlan              = billingPlan;
     DisplayProvisioningState = displayProvisioningState;
     ProvisioningSubState     = provisioningSubState;
     PurchaseOn               = purchaseOn;
     SplitProperties          = splitProperties;
     MergeProperties          = mergeProperties;
     BillingScopeId           = billingScopeId;
     Renew                        = renew;
     RenewSource                  = renewSource;
     RenewDestination             = renewDestination;
     RenewProperties              = renewProperties;
     Term                         = term;
     UserFriendlyAppliedScopeType = userFriendlyAppliedScopeType;
     UserFriendlyRenewState       = userFriendlyRenewState;
     Utilization                  = utilization;
 }
Пример #2
0
 internal PaymentDetail(DateTimeOffset?dueOn, DateTimeOffset?paymentOn, PurchasePrice pricingCurrencyTotal, PurchasePrice billingCurrencyTotal, string billingAccount, PaymentStatus?status, ExtendedStatusInfo extendedStatusInfo)
 {
     DueOn                = dueOn;
     PaymentOn            = paymentOn;
     PricingCurrencyTotal = pricingCurrencyTotal;
     BillingCurrencyTotal = billingCurrencyTotal;
     BillingAccount       = billingAccount;
     Status               = status;
     ExtendedStatusInfo   = extendedStatusInfo;
 }
Пример #3
0
        internal static ReservationsProperties DeserializeReservationsProperties(JsonElement element)
        {
            Optional <ReservedResourceType> reservedResourceType = default;
            Optional <InstanceFlexibility>  instanceFlexibility  = default;
            Optional <string> displayName = default;
            Optional <IReadOnlyList <string> > appliedScopes                          = default;
            Optional <AppliedScopeType>        appliedScopeType                       = default;
            Optional <bool>                              archived                     = default;
            Optional <string>                            capabilities                 = default;
            Optional <int>                               quantity                     = default;
            Optional <ProvisioningState>                 provisioningState            = default;
            Optional <DateTimeOffset>                    effectiveDateTime            = default;
            Optional <DateTimeOffset>                    benefitStartTime             = default;
            Optional <DateTimeOffset>                    lastUpdatedDateTime          = default;
            Optional <DateTimeOffset>                    expiryDate                   = default;
            Optional <string>                            skuDescription               = default;
            Optional <ExtendedStatusInfo>                extendedStatusInfo           = default;
            Optional <ReservationBillingPlan>            billingPlan                  = default;
            Optional <string>                            displayProvisioningState     = default;
            Optional <string>                            provisioningSubState         = default;
            Optional <DateTimeOffset>                    purchaseDate                 = default;
            Optional <ReservationSplitProperties>        splitProperties              = default;
            Optional <ReservationMergeProperties>        mergeProperties              = default;
            Optional <string>                            billingScopeId               = default;
            Optional <bool>                              renew                        = default;
            Optional <string>                            renewSource                  = default;
            Optional <string>                            renewDestination             = default;
            Optional <RenewPropertiesResponse>           renewProperties              = default;
            Optional <ReservationTerm>                   term                         = default;
            Optional <string>                            userFriendlyAppliedScopeType = default;
            Optional <string>                            userFriendlyRenewState       = default;
            Optional <ReservationsPropertiesUtilization> utilization                  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("reservedResourceType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    reservedResourceType = new ReservedResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("instanceFlexibility"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    instanceFlexibility = new InstanceFlexibility(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("displayName"))
                {
                    displayName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("appliedScopes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    appliedScopes = array;
                    continue;
                }
                if (property.NameEquals("appliedScopeType"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    appliedScopeType = new AppliedScopeType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("archived"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    archived = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("capabilities"))
                {
                    capabilities = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("quantity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    quantity = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("provisioningState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    provisioningState = new ProvisioningState(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("effectiveDateTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    effectiveDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("benefitStartTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    benefitStartTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("lastUpdatedDateTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    lastUpdatedDateTime = property.Value.GetDateTimeOffset("O");
                    continue;
                }
                if (property.NameEquals("expiryDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    expiryDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("skuDescription"))
                {
                    skuDescription = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("extendedStatusInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedStatusInfo = ExtendedStatusInfo.DeserializeExtendedStatusInfo(property.Value);
                    continue;
                }
                if (property.NameEquals("billingPlan"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingPlan = new ReservationBillingPlan(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("displayProvisioningState"))
                {
                    displayProvisioningState = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("provisioningSubState"))
                {
                    provisioningSubState = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("purchaseDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    purchaseDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("splitProperties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    splitProperties = ReservationSplitProperties.DeserializeReservationSplitProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("mergeProperties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    mergeProperties = ReservationMergeProperties.DeserializeReservationMergeProperties(property.Value);
                    continue;
                }
                if (property.NameEquals("billingScopeId"))
                {
                    billingScopeId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("renew"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    renew = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("renewSource"))
                {
                    renewSource = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("renewDestination"))
                {
                    renewDestination = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("renewProperties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    renewProperties = RenewPropertiesResponse.DeserializeRenewPropertiesResponse(property.Value);
                    continue;
                }
                if (property.NameEquals("term"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    term = new ReservationTerm(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("userFriendlyAppliedScopeType"))
                {
                    userFriendlyAppliedScopeType = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("userFriendlyRenewState"))
                {
                    userFriendlyRenewState = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("utilization"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    utilization = ReservationsPropertiesUtilization.DeserializeReservationsPropertiesUtilization(property.Value);
                    continue;
                }
            }
            return(new ReservationsProperties(Optional.ToNullable(reservedResourceType), Optional.ToNullable(instanceFlexibility), displayName.Value, Optional.ToList(appliedScopes), Optional.ToNullable(appliedScopeType), Optional.ToNullable(archived), capabilities.Value, Optional.ToNullable(quantity), Optional.ToNullable(provisioningState), Optional.ToNullable(effectiveDateTime), Optional.ToNullable(benefitStartTime), Optional.ToNullable(lastUpdatedDateTime), Optional.ToNullable(expiryDate), skuDescription.Value, extendedStatusInfo.Value, Optional.ToNullable(billingPlan), displayProvisioningState.Value, provisioningSubState.Value, Optional.ToNullable(purchaseDate), splitProperties.Value, mergeProperties.Value, billingScopeId.Value, Optional.ToNullable(renew), renewSource.Value, renewDestination.Value, renewProperties.Value, Optional.ToNullable(term), userFriendlyAppliedScopeType.Value, userFriendlyRenewState.Value, utilization.Value));
        }
Пример #4
0
        internal static PaymentDetail DeserializePaymentDetail(JsonElement element)
        {
            Optional <DateTimeOffset>     dueDate              = default;
            Optional <DateTimeOffset>     paymentDate          = default;
            Optional <PurchasePrice>      pricingCurrencyTotal = default;
            Optional <PurchasePrice>      billingCurrencyTotal = default;
            Optional <string>             billingAccount       = default;
            Optional <PaymentStatus>      status             = default;
            Optional <ExtendedStatusInfo> extendedStatusInfo = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("dueDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    dueDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("paymentDate"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    paymentDate = property.Value.GetDateTimeOffset("D");
                    continue;
                }
                if (property.NameEquals("pricingCurrencyTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    pricingCurrencyTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("billingCurrencyTotal"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    billingCurrencyTotal = PurchasePrice.DeserializePurchasePrice(property.Value);
                    continue;
                }
                if (property.NameEquals("billingAccount"))
                {
                    billingAccount = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("status"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    status = new PaymentStatus(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("extendedStatusInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedStatusInfo = ExtendedStatusInfo.DeserializeExtendedStatusInfo(property.Value);
                    continue;
                }
            }
            return(new PaymentDetail(Optional.ToNullable(dueDate), Optional.ToNullable(paymentDate), pricingCurrencyTotal.Value, billingCurrencyTotal.Value, billingAccount.Value, Optional.ToNullable(status), extendedStatusInfo.Value));
        }