{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Lightsail.Types.InstancePortState
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.InstancePortState where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.NetworkProtocol
import Amazonka.Lightsail.Types.PortState
import qualified Amazonka.Prelude as Prelude

-- | Describes open ports on an instance, the IP addresses allowed to connect
-- to the instance through the ports, and the protocol.
--
-- /See:/ 'newInstancePortState' smart constructor.
data InstancePortState = InstancePortState'
  { -- | An alias that defines access for a preconfigured range of IP addresses.
    --
    -- The only alias currently supported is @lightsail-connect@, which allows
    -- IP addresses of the browser-based RDP\/SSH client in the Lightsail
    -- console to connect to your instance.
    InstancePortState -> Maybe [Text]
cidrListAliases :: Prelude.Maybe [Prelude.Text],
    -- | The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are
    -- allowed to connect to an instance through the ports, and the protocol.
    --
    -- The @ipv6Cidrs@ parameter lists the IPv6 addresses that are allowed to
    -- connect to an instance.
    --
    -- For more information about CIDR block notation, see
    -- <https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation Classless Inter-Domain Routing>
    -- on /Wikipedia/.
    InstancePortState -> Maybe [Text]
cidrs :: Prelude.Maybe [Prelude.Text],
    -- | The first port in a range of open ports on an instance.
    --
    -- Allowed ports:
    --
    -- -   TCP and UDP - @0@ to @65535@
    --
    -- -   ICMP - The ICMP type for IPv4 addresses. For example, specify @8@ as
    --     the @fromPort@ (ICMP type), and @-1@ as the @toPort@ (ICMP code), to
    --     enable ICMP Ping. For more information, see
    --     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol#Control_messages Control Messages>
    --     on /Wikipedia/.
    --
    -- -   ICMPv6 - The ICMP type for IPv6 addresses. For example, specify
    --     @128@ as the @fromPort@ (ICMPv6 type), and @0@ as @toPort@ (ICMPv6
    --     code). For more information, see
    --     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6 Internet Control Message Protocol for IPv6>.
    InstancePortState -> Maybe Int
fromPort :: Prelude.Maybe Prelude.Int,
    -- | The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are
    -- allowed to connect to an instance through the ports, and the protocol.
    -- Only devices with an IPv6 address can connect to an instance through
    -- IPv6; otherwise, IPv4 should be used.
    --
    -- The @cidrs@ parameter lists the IPv4 addresses that are allowed to
    -- connect to an instance.
    --
    -- For more information about CIDR block notation, see
    -- <https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation Classless Inter-Domain Routing>
    -- on /Wikipedia/.
    InstancePortState -> Maybe [Text]
ipv6Cidrs :: Prelude.Maybe [Prelude.Text],
    -- | The IP protocol name.
    --
    -- The name can be one of the following:
    --
    -- -   @tcp@ - Transmission Control Protocol (TCP) provides reliable,
    --     ordered, and error-checked delivery of streamed data between
    --     applications running on hosts communicating by an IP network. If you
    --     have an application that doesn\'t require reliable data stream
    --     service, use UDP instead.
    --
    -- -   @all@ - All transport layer protocol types. For more general
    --     information, see
    --     <https://en.wikipedia.org/wiki/Transport_layer Transport layer> on
    --     /Wikipedia/.
    --
    -- -   @udp@ - With User Datagram Protocol (UDP), computer applications can
    --     send messages (or datagrams) to other hosts on an Internet Protocol
    --     (IP) network. Prior communications are not required to set up
    --     transmission channels or data paths. Applications that don\'t
    --     require reliable data stream service can use UDP, which provides a
    --     connectionless datagram service that emphasizes reduced latency over
    --     reliability. If you do require reliable data stream service, use TCP
    --     instead.
    --
    -- -   @icmp@ - Internet Control Message Protocol (ICMP) is used to send
    --     error messages and operational information indicating success or
    --     failure when communicating with an instance. For example, an error
    --     is indicated when an instance could not be reached. When you specify
    --     @icmp@ as the @protocol@, you must specify the ICMP type using the
    --     @fromPort@ parameter, and ICMP code using the @toPort@ parameter.
    InstancePortState -> Maybe NetworkProtocol
protocol :: Prelude.Maybe NetworkProtocol,
    -- | Specifies whether the instance port is @open@ or @closed@.
    --
    -- The port state for Lightsail instances is always @open@.
    InstancePortState -> Maybe PortState
state :: Prelude.Maybe PortState,
    -- | The last port in a range of open ports on an instance.
    --
    -- Allowed ports:
    --
    -- -   TCP and UDP - @0@ to @65535@
    --
    -- -   ICMP - The ICMP code for IPv4 addresses. For example, specify @8@ as
    --     the @fromPort@ (ICMP type), and @-1@ as the @toPort@ (ICMP code), to
    --     enable ICMP Ping. For more information, see
    --     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol#Control_messages Control Messages>
    --     on /Wikipedia/.
    --
    -- -   ICMPv6 - The ICMP code for IPv6 addresses. For example, specify
    --     @128@ as the @fromPort@ (ICMPv6 type), and @0@ as @toPort@ (ICMPv6
    --     code). For more information, see
    --     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6 Internet Control Message Protocol for IPv6>.
    InstancePortState -> Maybe Int
toPort :: Prelude.Maybe Prelude.Int
  }
  deriving (InstancePortState -> InstancePortState -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstancePortState -> InstancePortState -> Bool
$c/= :: InstancePortState -> InstancePortState -> Bool
== :: InstancePortState -> InstancePortState -> Bool
$c== :: InstancePortState -> InstancePortState -> Bool
Prelude.Eq, ReadPrec [InstancePortState]
ReadPrec InstancePortState
Int -> ReadS InstancePortState
ReadS [InstancePortState]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstancePortState]
$creadListPrec :: ReadPrec [InstancePortState]
readPrec :: ReadPrec InstancePortState
$creadPrec :: ReadPrec InstancePortState
readList :: ReadS [InstancePortState]
$creadList :: ReadS [InstancePortState]
readsPrec :: Int -> ReadS InstancePortState
$creadsPrec :: Int -> ReadS InstancePortState
Prelude.Read, Int -> InstancePortState -> ShowS
[InstancePortState] -> ShowS
InstancePortState -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstancePortState] -> ShowS
$cshowList :: [InstancePortState] -> ShowS
show :: InstancePortState -> String
$cshow :: InstancePortState -> String
showsPrec :: Int -> InstancePortState -> ShowS
$cshowsPrec :: Int -> InstancePortState -> ShowS
Prelude.Show, forall x. Rep InstancePortState x -> InstancePortState
forall x. InstancePortState -> Rep InstancePortState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstancePortState x -> InstancePortState
$cfrom :: forall x. InstancePortState -> Rep InstancePortState x
Prelude.Generic)

-- |
-- Create a value of 'InstancePortState' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'cidrListAliases', 'instancePortState_cidrListAliases' - An alias that defines access for a preconfigured range of IP addresses.
--
-- The only alias currently supported is @lightsail-connect@, which allows
-- IP addresses of the browser-based RDP\/SSH client in the Lightsail
-- console to connect to your instance.
--
-- 'cidrs', 'instancePortState_cidrs' - The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are
-- allowed to connect to an instance through the ports, and the protocol.
--
-- The @ipv6Cidrs@ parameter lists the IPv6 addresses that are allowed to
-- connect to an instance.
--
-- For more information about CIDR block notation, see
-- <https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation Classless Inter-Domain Routing>
-- on /Wikipedia/.
--
-- 'fromPort', 'instancePortState_fromPort' - The first port in a range of open ports on an instance.
--
-- Allowed ports:
--
-- -   TCP and UDP - @0@ to @65535@
--
-- -   ICMP - The ICMP type for IPv4 addresses. For example, specify @8@ as
--     the @fromPort@ (ICMP type), and @-1@ as the @toPort@ (ICMP code), to
--     enable ICMP Ping. For more information, see
--     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol#Control_messages Control Messages>
--     on /Wikipedia/.
--
-- -   ICMPv6 - The ICMP type for IPv6 addresses. For example, specify
--     @128@ as the @fromPort@ (ICMPv6 type), and @0@ as @toPort@ (ICMPv6
--     code). For more information, see
--     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6 Internet Control Message Protocol for IPv6>.
--
-- 'ipv6Cidrs', 'instancePortState_ipv6Cidrs' - The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are
-- allowed to connect to an instance through the ports, and the protocol.
-- Only devices with an IPv6 address can connect to an instance through
-- IPv6; otherwise, IPv4 should be used.
--
-- The @cidrs@ parameter lists the IPv4 addresses that are allowed to
-- connect to an instance.
--
-- For more information about CIDR block notation, see
-- <https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation Classless Inter-Domain Routing>
-- on /Wikipedia/.
--
-- 'protocol', 'instancePortState_protocol' - The IP protocol name.
--
-- The name can be one of the following:
--
-- -   @tcp@ - Transmission Control Protocol (TCP) provides reliable,
--     ordered, and error-checked delivery of streamed data between
--     applications running on hosts communicating by an IP network. If you
--     have an application that doesn\'t require reliable data stream
--     service, use UDP instead.
--
-- -   @all@ - All transport layer protocol types. For more general
--     information, see
--     <https://en.wikipedia.org/wiki/Transport_layer Transport layer> on
--     /Wikipedia/.
--
-- -   @udp@ - With User Datagram Protocol (UDP), computer applications can
--     send messages (or datagrams) to other hosts on an Internet Protocol
--     (IP) network. Prior communications are not required to set up
--     transmission channels or data paths. Applications that don\'t
--     require reliable data stream service can use UDP, which provides a
--     connectionless datagram service that emphasizes reduced latency over
--     reliability. If you do require reliable data stream service, use TCP
--     instead.
--
-- -   @icmp@ - Internet Control Message Protocol (ICMP) is used to send
--     error messages and operational information indicating success or
--     failure when communicating with an instance. For example, an error
--     is indicated when an instance could not be reached. When you specify
--     @icmp@ as the @protocol@, you must specify the ICMP type using the
--     @fromPort@ parameter, and ICMP code using the @toPort@ parameter.
--
-- 'state', 'instancePortState_state' - Specifies whether the instance port is @open@ or @closed@.
--
-- The port state for Lightsail instances is always @open@.
--
-- 'toPort', 'instancePortState_toPort' - The last port in a range of open ports on an instance.
--
-- Allowed ports:
--
-- -   TCP and UDP - @0@ to @65535@
--
-- -   ICMP - The ICMP code for IPv4 addresses. For example, specify @8@ as
--     the @fromPort@ (ICMP type), and @-1@ as the @toPort@ (ICMP code), to
--     enable ICMP Ping. For more information, see
--     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol#Control_messages Control Messages>
--     on /Wikipedia/.
--
-- -   ICMPv6 - The ICMP code for IPv6 addresses. For example, specify
--     @128@ as the @fromPort@ (ICMPv6 type), and @0@ as @toPort@ (ICMPv6
--     code). For more information, see
--     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6 Internet Control Message Protocol for IPv6>.
newInstancePortState ::
  InstancePortState
newInstancePortState :: InstancePortState
newInstancePortState =
  InstancePortState'
    { $sel:cidrListAliases:InstancePortState' :: Maybe [Text]
cidrListAliases =
        forall a. Maybe a
Prelude.Nothing,
      $sel:cidrs:InstancePortState' :: Maybe [Text]
cidrs = forall a. Maybe a
Prelude.Nothing,
      $sel:fromPort:InstancePortState' :: Maybe Int
fromPort = forall a. Maybe a
Prelude.Nothing,
      $sel:ipv6Cidrs:InstancePortState' :: Maybe [Text]
ipv6Cidrs = forall a. Maybe a
Prelude.Nothing,
      $sel:protocol:InstancePortState' :: Maybe NetworkProtocol
protocol = forall a. Maybe a
Prelude.Nothing,
      $sel:state:InstancePortState' :: Maybe PortState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:toPort:InstancePortState' :: Maybe Int
toPort = forall a. Maybe a
Prelude.Nothing
    }

-- | An alias that defines access for a preconfigured range of IP addresses.
--
-- The only alias currently supported is @lightsail-connect@, which allows
-- IP addresses of the browser-based RDP\/SSH client in the Lightsail
-- console to connect to your instance.
instancePortState_cidrListAliases :: Lens.Lens' InstancePortState (Prelude.Maybe [Prelude.Text])
instancePortState_cidrListAliases :: Lens' InstancePortState (Maybe [Text])
instancePortState_cidrListAliases = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe [Text]
cidrListAliases :: Maybe [Text]
$sel:cidrListAliases:InstancePortState' :: InstancePortState -> Maybe [Text]
cidrListAliases} -> Maybe [Text]
cidrListAliases) (\s :: InstancePortState
s@InstancePortState' {} Maybe [Text]
a -> InstancePortState
s {$sel:cidrListAliases:InstancePortState' :: Maybe [Text]
cidrListAliases = Maybe [Text]
a} :: InstancePortState) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are
-- allowed to connect to an instance through the ports, and the protocol.
--
-- The @ipv6Cidrs@ parameter lists the IPv6 addresses that are allowed to
-- connect to an instance.
--
-- For more information about CIDR block notation, see
-- <https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation Classless Inter-Domain Routing>
-- on /Wikipedia/.
instancePortState_cidrs :: Lens.Lens' InstancePortState (Prelude.Maybe [Prelude.Text])
instancePortState_cidrs :: Lens' InstancePortState (Maybe [Text])
instancePortState_cidrs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe [Text]
cidrs :: Maybe [Text]
$sel:cidrs:InstancePortState' :: InstancePortState -> Maybe [Text]
cidrs} -> Maybe [Text]
cidrs) (\s :: InstancePortState
s@InstancePortState' {} Maybe [Text]
a -> InstancePortState
s {$sel:cidrs:InstancePortState' :: Maybe [Text]
cidrs = Maybe [Text]
a} :: InstancePortState) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The first port in a range of open ports on an instance.
--
-- Allowed ports:
--
-- -   TCP and UDP - @0@ to @65535@
--
-- -   ICMP - The ICMP type for IPv4 addresses. For example, specify @8@ as
--     the @fromPort@ (ICMP type), and @-1@ as the @toPort@ (ICMP code), to
--     enable ICMP Ping. For more information, see
--     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol#Control_messages Control Messages>
--     on /Wikipedia/.
--
-- -   ICMPv6 - The ICMP type for IPv6 addresses. For example, specify
--     @128@ as the @fromPort@ (ICMPv6 type), and @0@ as @toPort@ (ICMPv6
--     code). For more information, see
--     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6 Internet Control Message Protocol for IPv6>.
instancePortState_fromPort :: Lens.Lens' InstancePortState (Prelude.Maybe Prelude.Int)
instancePortState_fromPort :: Lens' InstancePortState (Maybe Int)
instancePortState_fromPort = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe Int
fromPort :: Maybe Int
$sel:fromPort:InstancePortState' :: InstancePortState -> Maybe Int
fromPort} -> Maybe Int
fromPort) (\s :: InstancePortState
s@InstancePortState' {} Maybe Int
a -> InstancePortState
s {$sel:fromPort:InstancePortState' :: Maybe Int
fromPort = Maybe Int
a} :: InstancePortState)

-- | The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are
-- allowed to connect to an instance through the ports, and the protocol.
-- Only devices with an IPv6 address can connect to an instance through
-- IPv6; otherwise, IPv4 should be used.
--
-- The @cidrs@ parameter lists the IPv4 addresses that are allowed to
-- connect to an instance.
--
-- For more information about CIDR block notation, see
-- <https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation Classless Inter-Domain Routing>
-- on /Wikipedia/.
instancePortState_ipv6Cidrs :: Lens.Lens' InstancePortState (Prelude.Maybe [Prelude.Text])
instancePortState_ipv6Cidrs :: Lens' InstancePortState (Maybe [Text])
instancePortState_ipv6Cidrs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe [Text]
ipv6Cidrs :: Maybe [Text]
$sel:ipv6Cidrs:InstancePortState' :: InstancePortState -> Maybe [Text]
ipv6Cidrs} -> Maybe [Text]
ipv6Cidrs) (\s :: InstancePortState
s@InstancePortState' {} Maybe [Text]
a -> InstancePortState
s {$sel:ipv6Cidrs:InstancePortState' :: Maybe [Text]
ipv6Cidrs = Maybe [Text]
a} :: InstancePortState) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The IP protocol name.
--
-- The name can be one of the following:
--
-- -   @tcp@ - Transmission Control Protocol (TCP) provides reliable,
--     ordered, and error-checked delivery of streamed data between
--     applications running on hosts communicating by an IP network. If you
--     have an application that doesn\'t require reliable data stream
--     service, use UDP instead.
--
-- -   @all@ - All transport layer protocol types. For more general
--     information, see
--     <https://en.wikipedia.org/wiki/Transport_layer Transport layer> on
--     /Wikipedia/.
--
-- -   @udp@ - With User Datagram Protocol (UDP), computer applications can
--     send messages (or datagrams) to other hosts on an Internet Protocol
--     (IP) network. Prior communications are not required to set up
--     transmission channels or data paths. Applications that don\'t
--     require reliable data stream service can use UDP, which provides a
--     connectionless datagram service that emphasizes reduced latency over
--     reliability. If you do require reliable data stream service, use TCP
--     instead.
--
-- -   @icmp@ - Internet Control Message Protocol (ICMP) is used to send
--     error messages and operational information indicating success or
--     failure when communicating with an instance. For example, an error
--     is indicated when an instance could not be reached. When you specify
--     @icmp@ as the @protocol@, you must specify the ICMP type using the
--     @fromPort@ parameter, and ICMP code using the @toPort@ parameter.
instancePortState_protocol :: Lens.Lens' InstancePortState (Prelude.Maybe NetworkProtocol)
instancePortState_protocol :: Lens' InstancePortState (Maybe NetworkProtocol)
instancePortState_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe NetworkProtocol
protocol :: Maybe NetworkProtocol
$sel:protocol:InstancePortState' :: InstancePortState -> Maybe NetworkProtocol
protocol} -> Maybe NetworkProtocol
protocol) (\s :: InstancePortState
s@InstancePortState' {} Maybe NetworkProtocol
a -> InstancePortState
s {$sel:protocol:InstancePortState' :: Maybe NetworkProtocol
protocol = Maybe NetworkProtocol
a} :: InstancePortState)

-- | Specifies whether the instance port is @open@ or @closed@.
--
-- The port state for Lightsail instances is always @open@.
instancePortState_state :: Lens.Lens' InstancePortState (Prelude.Maybe PortState)
instancePortState_state :: Lens' InstancePortState (Maybe PortState)
instancePortState_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe PortState
state :: Maybe PortState
$sel:state:InstancePortState' :: InstancePortState -> Maybe PortState
state} -> Maybe PortState
state) (\s :: InstancePortState
s@InstancePortState' {} Maybe PortState
a -> InstancePortState
s {$sel:state:InstancePortState' :: Maybe PortState
state = Maybe PortState
a} :: InstancePortState)

-- | The last port in a range of open ports on an instance.
--
-- Allowed ports:
--
-- -   TCP and UDP - @0@ to @65535@
--
-- -   ICMP - The ICMP code for IPv4 addresses. For example, specify @8@ as
--     the @fromPort@ (ICMP type), and @-1@ as the @toPort@ (ICMP code), to
--     enable ICMP Ping. For more information, see
--     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol#Control_messages Control Messages>
--     on /Wikipedia/.
--
-- -   ICMPv6 - The ICMP code for IPv6 addresses. For example, specify
--     @128@ as the @fromPort@ (ICMPv6 type), and @0@ as @toPort@ (ICMPv6
--     code). For more information, see
--     <https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol_for_IPv6 Internet Control Message Protocol for IPv6>.
instancePortState_toPort :: Lens.Lens' InstancePortState (Prelude.Maybe Prelude.Int)
instancePortState_toPort :: Lens' InstancePortState (Maybe Int)
instancePortState_toPort = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstancePortState' {Maybe Int
toPort :: Maybe Int
$sel:toPort:InstancePortState' :: InstancePortState -> Maybe Int
toPort} -> Maybe Int
toPort) (\s :: InstancePortState
s@InstancePortState' {} Maybe Int
a -> InstancePortState
s {$sel:toPort:InstancePortState' :: Maybe Int
toPort = Maybe Int
a} :: InstancePortState)

instance Data.FromJSON InstancePortState where
  parseJSON :: Value -> Parser InstancePortState
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"InstancePortState"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text]
-> Maybe Int
-> Maybe [Text]
-> Maybe NetworkProtocol
-> Maybe PortState
-> Maybe Int
-> InstancePortState
InstancePortState'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"cidrListAliases"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"cidrs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"fromPort")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ipv6Cidrs" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"protocol")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"state")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"toPort")
      )

instance Prelude.Hashable InstancePortState where
  hashWithSalt :: Int -> InstancePortState -> Int
hashWithSalt Int
_salt InstancePortState' {Maybe Int
Maybe [Text]
Maybe NetworkProtocol
Maybe PortState
toPort :: Maybe Int
state :: Maybe PortState
protocol :: Maybe NetworkProtocol
ipv6Cidrs :: Maybe [Text]
fromPort :: Maybe Int
cidrs :: Maybe [Text]
cidrListAliases :: Maybe [Text]
$sel:toPort:InstancePortState' :: InstancePortState -> Maybe Int
$sel:state:InstancePortState' :: InstancePortState -> Maybe PortState
$sel:protocol:InstancePortState' :: InstancePortState -> Maybe NetworkProtocol
$sel:ipv6Cidrs:InstancePortState' :: InstancePortState -> Maybe [Text]
$sel:fromPort:InstancePortState' :: InstancePortState -> Maybe Int
$sel:cidrs:InstancePortState' :: InstancePortState -> Maybe [Text]
$sel:cidrListAliases:InstancePortState' :: InstancePortState -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
cidrListAliases
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
cidrs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
fromPort
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
ipv6Cidrs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NetworkProtocol
protocol
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PortState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
toPort

instance Prelude.NFData InstancePortState where
  rnf :: InstancePortState -> ()
rnf InstancePortState' {Maybe Int
Maybe [Text]
Maybe NetworkProtocol
Maybe PortState
toPort :: Maybe Int
state :: Maybe PortState
protocol :: Maybe NetworkProtocol
ipv6Cidrs :: Maybe [Text]
fromPort :: Maybe Int
cidrs :: Maybe [Text]
cidrListAliases :: Maybe [Text]
$sel:toPort:InstancePortState' :: InstancePortState -> Maybe Int
$sel:state:InstancePortState' :: InstancePortState -> Maybe PortState
$sel:protocol:InstancePortState' :: InstancePortState -> Maybe NetworkProtocol
$sel:ipv6Cidrs:InstancePortState' :: InstancePortState -> Maybe [Text]
$sel:fromPort:InstancePortState' :: InstancePortState -> Maybe Int
$sel:cidrs:InstancePortState' :: InstancePortState -> Maybe [Text]
$sel:cidrListAliases:InstancePortState' :: InstancePortState -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
cidrListAliases
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
cidrs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
fromPort
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
ipv6Cidrs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NetworkProtocol
protocol
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PortState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
toPort