Exemple #1
0
 internal SapCentralServerInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string instanceNo, ResourceIdentifier subnetId, MessageServerProperties messageServerProperties, EnqueueServerProperties enqueueServerProperties, GatewayServerProperties gatewayServerProperties, EnqueueReplicationServerProperties enqueueReplicationServerProperties, string kernelVersion, string kernelPatch, IReadOnlyList <CentralServerVmDetails> vmDetails, SapVirtualInstanceStatus?status, SapHealthState?health, SapVirtualInstanceProvisioningState?provisioningState, SapVirtualInstanceError errors) : base(id, name, resourceType, systemData, tags, location)
 {
     InstanceNo = instanceNo;
     SubnetId   = subnetId;
     MessageServerProperties            = messageServerProperties;
     EnqueueServerProperties            = enqueueServerProperties;
     GatewayServerProperties            = gatewayServerProperties;
     EnqueueReplicationServerProperties = enqueueReplicationServerProperties;
     KernelVersion     = kernelVersion;
     KernelPatch       = kernelPatch;
     VmDetails         = vmDetails;
     Status            = status;
     Health            = health;
     ProvisioningState = provisioningState;
     Errors            = errors;
 }
Exemple #2
0
        internal static SapCentralServerInstanceData DeserializeSapCentralServerInstanceData(JsonElement element)
        {
            IDictionary <string, string> tags = default;
            AzureLocation                                      location   = default;
            ResourceIdentifier                                 id         = default;
            string                                             name       = default;
            ResourceType                                       type       = default;
            SystemData                                         systemData = default;
            Optional <string>                                  instanceNo = default;
            Optional <ResourceIdentifier>                      subnet     = default;
            Optional <MessageServerProperties>                 messageServerProperties            = default;
            Optional <EnqueueServerProperties>                 enqueueServerProperties            = default;
            Optional <GatewayServerProperties>                 gatewayServerProperties            = default;
            Optional <EnqueueReplicationServerProperties>      enqueueReplicationServerProperties = default;
            Optional <string>                                  kernelVersion     = default;
            Optional <string>                                  kernelPatch       = default;
            Optional <IReadOnlyList <CentralServerVmDetails> > vmDetails         = default;
            Optional <SapVirtualInstanceStatus>                status            = default;
            Optional <SapHealthState>                          health            = default;
            Optional <SapVirtualInstanceProvisioningState>     provisioningState = default;
            Optional <SapVirtualInstanceError>                 errors            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                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("instanceNo"))
                        {
                            instanceNo = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("subnet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            subnet = new ResourceIdentifier(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("messageServerProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            messageServerProperties = MessageServerProperties.DeserializeMessageServerProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("enqueueServerProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enqueueServerProperties = EnqueueServerProperties.DeserializeEnqueueServerProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("gatewayServerProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            gatewayServerProperties = GatewayServerProperties.DeserializeGatewayServerProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("enqueueReplicationServerProperties"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enqueueReplicationServerProperties = EnqueueReplicationServerProperties.DeserializeEnqueueReplicationServerProperties(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("kernelVersion"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                kernelVersion = null;
                                continue;
                            }
                            kernelVersion = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("kernelPatch"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                kernelPatch = null;
                                continue;
                            }
                            kernelPatch = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vmDetails"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <CentralServerVmDetails> array = new List <CentralServerVmDetails>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(CentralServerVmDetails.DeserializeCentralServerVmDetails(item));
                            }
                            vmDetails = array;
                            continue;
                        }
                        if (property0.NameEquals("status"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            status = new SapVirtualInstanceStatus(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("health"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            health = new SapHealthState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new SapVirtualInstanceProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("errors"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            errors = SapVirtualInstanceError.DeserializeSapVirtualInstanceError(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new SapCentralServerInstanceData(id, name, type, systemData, tags, location, instanceNo.Value, subnet.Value, messageServerProperties.Value, enqueueServerProperties.Value, gatewayServerProperties.Value, enqueueReplicationServerProperties.Value, kernelVersion.Value, kernelPatch.Value, Optional.ToList(vmDetails), Optional.ToNullable(status), Optional.ToNullable(health), Optional.ToNullable(provisioningState), errors.Value));
        }