Пример #1
0
        public SapVirtualInstanceData(AzureLocation location, SapEnvironmentType environment, SapProductType sapProduct, SapConfiguration configuration) : base(location)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            Environment   = environment;
            SapProduct    = sapProduct;
            Configuration = configuration;
        }
Пример #2
0
 internal SapVirtualInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, UserAssignedServiceIdentity identity, SapEnvironmentType environment, SapProductType sapProduct, SapConfiguration configuration, ManagedRGConfiguration managedResourceGroupConfiguration, SapVirtualInstanceStatus?status, SapHealthState?health, SapVirtualInstanceState?state, SapVirtualInstanceProvisioningState?provisioningState, SapVirtualInstanceError errors) : base(id, name, resourceType, systemData, tags, location)
 {
     Identity      = identity;
     Environment   = environment;
     SapProduct    = sapProduct;
     Configuration = configuration;
     ManagedResourceGroupConfiguration = managedResourceGroupConfiguration;
     Status            = status;
     Health            = health;
     State             = state;
     ProvisioningState = provisioningState;
     Errors            = errors;
 }
Пример #3
0
        internal static SapVirtualInstanceData DeserializeSapVirtualInstanceData(JsonElement element)
        {
            Optional <UserAssignedServiceIdentity> identity = default;
            IDictionary <string, string>           tags     = default;
            AzureLocation      location      = default;
            ResourceIdentifier id            = default;
            string             name          = default;
            ResourceType       type          = default;
            SystemData         systemData    = default;
            SapEnvironmentType environment   = default;
            SapProductType     sapProduct    = default;
            SapConfiguration   configuration = default;
            Optional <ManagedRGConfiguration>              managedResourceGroupConfiguration = default;
            Optional <SapVirtualInstanceStatus>            status            = default;
            Optional <SapHealthState>                      health            = default;
            Optional <SapVirtualInstanceState>             state             = default;
            Optional <SapVirtualInstanceProvisioningState> provisioningState = default;
            Optional <SapVirtualInstanceError>             errors            = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = UserAssignedServiceIdentity.DeserializeUserAssignedServiceIdentity(property.Value);
                    continue;
                }
                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("environment"))
                        {
                            environment = new SapEnvironmentType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("sapProduct"))
                        {
                            sapProduct = new SapProductType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("configuration"))
                        {
                            configuration = SapConfiguration.DeserializeSapConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("managedResourceGroupConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            managedResourceGroupConfiguration = ManagedRGConfiguration.DeserializeManagedRGConfiguration(property0.Value);
                            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("state"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            state = new SapVirtualInstanceState(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 SapVirtualInstanceData(id, name, type, systemData, tags, location, identity.Value, environment, sapProduct, configuration, managedResourceGroupConfiguration.Value, Optional.ToNullable(status), Optional.ToNullable(health), Optional.ToNullable(state), Optional.ToNullable(provisioningState), errors.Value));
        }