Ejemplo n.º 1
0
        protected override void ProcessRecord()
        {
            var vlb = new CreateVirtualLoadBalancerRule
            {
                BackendAddressPool       = BackendAddressPool,
                FrontendIPConfigurations = FrontendIPConfigurations,
                Protocol             = Protocol.ToString(),
                FrontendPort         = FrontEndPort,
                BackendPort          = BackEndPort,
                IdleTimeoutInMinutes = IdleTimeoutInMinutes,
                EnableFloatingIp     = FloatingIpEnabled.ToBool(),
                LoadDistribution     = LoadDistribution.ToString(),
                ProbeId = ProbeId
            };

            var job = Create(Connection, vlb, VirtualLoadBalancerId);


            if (Wait)
            {
                WriteObject(WaitJobFinished(job.Id, Connection, VirtualLoadBalancerId));
            }
            else
            {
                WriteObject(job);
            }
        }
Ejemplo n.º 2
0
        internal static LoadBalancingRuleData DeserializeLoadBalancingRuleData(JsonElement element)
        {
            Optional <ETag> etag = default;
            Optional <ResourceIdentifier>           id   = default;
            Optional <string>                       name = default;
            Optional <ResourceType>                 type = default;
            Optional <WritableSubResource>          frontendIPConfiguration = default;
            Optional <WritableSubResource>          backendAddressPool      = default;
            Optional <IList <WritableSubResource> > backendAddressPools     = default;
            Optional <WritableSubResource>          probe            = default;
            Optional <TransportProtocol>            protocol         = default;
            Optional <LoadDistribution>             loadDistribution = default;
            Optional <int>  frontendPort         = default;
            Optional <int>  backendPort          = default;
            Optional <int>  idleTimeoutInMinutes = default;
            Optional <bool> enableFloatingIP     = default;
            Optional <bool> enableTcpReset       = default;
            Optional <bool> disableOutboundSnat  = default;
            Optional <NetworkProvisioningState> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("etag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    etag = new ETag(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("frontendIPConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            frontendIPConfiguration = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("backendAddressPool"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            backendAddressPool = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("backendAddressPools"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <WritableSubResource> array = new List <WritableSubResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString()));
                            }
                            backendAddressPools = array;
                            continue;
                        }
                        if (property0.NameEquals("probe"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            probe = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("protocol"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            protocol = new TransportProtocol(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("loadDistribution"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            loadDistribution = new LoadDistribution(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("frontendPort"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            frontendPort = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("backendPort"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            backendPort = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("idleTimeoutInMinutes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            idleTimeoutInMinutes = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("enableFloatingIP"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableFloatingIP = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enableTcpReset"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableTcpReset = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("disableOutboundSnat"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            disableOutboundSnat = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new NetworkProvisioningState(property0.Value.GetString());
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new LoadBalancingRuleData(id.Value, name.Value, Optional.ToNullable(type), Optional.ToNullable(etag), frontendIPConfiguration, backendAddressPool, Optional.ToList(backendAddressPools), probe, Optional.ToNullable(protocol), Optional.ToNullable(loadDistribution), Optional.ToNullable(frontendPort), Optional.ToNullable(backendPort), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableFloatingIP), Optional.ToNullable(enableTcpReset), Optional.ToNullable(disableOutboundSnat), Optional.ToNullable(provisioningState)));
        }
 ///GENMHASH:129F1484DB6983FA49EB300EBE8BB614:4E4D7CE935C5CC210DA1EEB68CB3F817
 internal LoadBalancingRuleImpl WithLoadDistribution(LoadDistribution loadDistribution)
 {
     Inner.LoadDistribution = loadDistribution;
     return(this);
 }
 /// <summary>
 /// Specifies the load distribution mode.
 /// </summary>
 /// <param name="loadDistribution">A supported load distribution mode.</param>
 /// <return>The next stage of the definition.</return>
 LoadBalancingRule.UpdateDefinition.IWithAttach <LoadBalancer.Update.IUpdate> LoadBalancingRule.UpdateDefinition.IWithLoadDistribution <LoadBalancer.Update.IUpdate> .WithLoadDistribution(LoadDistribution loadDistribution)
 {
     return(this.WithLoadDistribution(loadDistribution));
 }
 /// <summary>
 /// Specifies the load distribution mode.
 /// </summary>
 /// <param name="loadDistribution">A supported load distribution mode.</param>
 /// <return>The next stage of the definition.</return>
 LoadBalancingRule.Definition.IWithAttach <LoadBalancer.Definition.IWithLBRuleOrNatOrCreate> LoadBalancingRule.Definition.IWithLoadDistribution <LoadBalancer.Definition.IWithLBRuleOrNatOrCreate> .WithLoadDistribution(LoadDistribution loadDistribution)
 {
     return(this.WithLoadDistribution(loadDistribution));
 }
 /// <summary>
 /// Specifies the load distribution mode.
 /// </summary>
 /// <param name="loadDistribution">A supported load distribution mode.</param>
 /// <return>The next stage of the definition.</return>
 LoadBalancingRule.Update.IUpdate LoadBalancingRule.Update.IWithLoadDistribution.WithLoadDistribution(LoadDistribution loadDistribution)
 {
     return(this.WithLoadDistribution(loadDistribution));
 }