示例#1
0
 internal SapProviderInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadMonitorProvisioningState?provisioningState, ResponseError errors, ProviderSpecificProperties providerSettings) : base(id, name, resourceType, systemData)
 {
     ProvisioningState = provisioningState;
     Errors            = errors;
     ProviderSettings  = providerSettings;
 }
示例#2
0
        internal static SapProviderInstanceData DeserializeSapProviderInstanceData(JsonElement element)
        {
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;
            Optional <WorkloadMonitorProvisioningState> provisioningState = default;
            Optional <ResponseError> errors = default;
            Optional <ProviderSpecificProperties> providerSettings = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new WorkloadMonitorProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("errors"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            errors = JsonSerializer.Deserialize <ResponseError>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("providerSettings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            providerSettings = ProviderSpecificProperties.DeserializeProviderSpecificProperties(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new SapProviderInstanceData(id, name, type, systemData, Optional.ToNullable(provisioningState), errors.Value, providerSettings.Value));
        }