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

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

-- |
-- Module      : Amazonka.ELBV2.CreateListener
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a listener for the specified Application Load Balancer, Network
-- Load Balancer, or Gateway Load Balancer.
--
-- For more information, see the following:
--
-- -   <https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html Listeners for your Application Load Balancers>
--
-- -   <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-listeners.html Listeners for your Network Load Balancers>
--
-- -   <https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/gateway-listeners.html Listeners for your Gateway Load Balancers>
--
-- This operation is idempotent, which means that it completes at most one
-- time. If you attempt to create multiple listeners with the same
-- settings, each call succeeds.
module Amazonka.ELBV2.CreateListener
  ( -- * Creating a Request
    CreateListener (..),
    newCreateListener,

    -- * Request Lenses
    createListener_alpnPolicy,
    createListener_certificates,
    createListener_port,
    createListener_protocol,
    createListener_sslPolicy,
    createListener_tags,
    createListener_loadBalancerArn,
    createListener_defaultActions,

    -- * Destructuring the Response
    CreateListenerResponse (..),
    newCreateListenerResponse,

    -- * Response Lenses
    createListenerResponse_listeners,
    createListenerResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ELBV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateListener' smart constructor.
data CreateListener = CreateListener'
  { -- | [TLS listeners] The name of the Application-Layer Protocol Negotiation
    -- (ALPN) policy. You can specify one policy name. The following are the
    -- possible values:
    --
    -- -   @HTTP1Only@
    --
    -- -   @HTTP2Only@
    --
    -- -   @HTTP2Optional@
    --
    -- -   @HTTP2Preferred@
    --
    -- -   @None@
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#alpn-policies ALPN policies>
    -- in the /Network Load Balancers Guide/.
    CreateListener -> Maybe [Text]
alpnPolicy :: Prelude.Maybe [Prelude.Text],
    -- | [HTTPS and TLS listeners] The default certificate for the listener. You
    -- must provide exactly one certificate. Set @CertificateArn@ to the
    -- certificate ARN but do not set @IsDefault@.
    CreateListener -> Maybe [Certificate]
certificates :: Prelude.Maybe [Certificate],
    -- | The port on which the load balancer is listening. You cannot specify a
    -- port for a Gateway Load Balancer.
    CreateListener -> Maybe Natural
port :: Prelude.Maybe Prelude.Natural,
    -- | The protocol for connections from clients to the load balancer. For
    -- Application Load Balancers, the supported protocols are HTTP and HTTPS.
    -- For Network Load Balancers, the supported protocols are TCP, TLS, UDP,
    -- and TCP_UDP. You can’t specify the UDP or TCP_UDP protocol if dual-stack
    -- mode is enabled. You cannot specify a protocol for a Gateway Load
    -- Balancer.
    CreateListener -> Maybe ProtocolEnum
protocol :: Prelude.Maybe ProtocolEnum,
    -- | [HTTPS and TLS listeners] The security policy that defines which
    -- protocols and ciphers are supported.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies Security policies>
    -- in the /Application Load Balancers Guide/ and
    -- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies Security policies>
    -- in the /Network Load Balancers Guide/.
    CreateListener -> Maybe Text
sslPolicy :: Prelude.Maybe Prelude.Text,
    -- | The tags to assign to the listener.
    CreateListener -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The Amazon Resource Name (ARN) of the load balancer.
    CreateListener -> Text
loadBalancerArn :: Prelude.Text,
    -- | The actions for the default rule.
    CreateListener -> [Action]
defaultActions :: [Action]
  }
  deriving (CreateListener -> CreateListener -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateListener -> CreateListener -> Bool
$c/= :: CreateListener -> CreateListener -> Bool
== :: CreateListener -> CreateListener -> Bool
$c== :: CreateListener -> CreateListener -> Bool
Prelude.Eq, ReadPrec [CreateListener]
ReadPrec CreateListener
Int -> ReadS CreateListener
ReadS [CreateListener]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateListener]
$creadListPrec :: ReadPrec [CreateListener]
readPrec :: ReadPrec CreateListener
$creadPrec :: ReadPrec CreateListener
readList :: ReadS [CreateListener]
$creadList :: ReadS [CreateListener]
readsPrec :: Int -> ReadS CreateListener
$creadsPrec :: Int -> ReadS CreateListener
Prelude.Read, Int -> CreateListener -> ShowS
[CreateListener] -> ShowS
CreateListener -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateListener] -> ShowS
$cshowList :: [CreateListener] -> ShowS
show :: CreateListener -> String
$cshow :: CreateListener -> String
showsPrec :: Int -> CreateListener -> ShowS
$cshowsPrec :: Int -> CreateListener -> ShowS
Prelude.Show, forall x. Rep CreateListener x -> CreateListener
forall x. CreateListener -> Rep CreateListener x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateListener x -> CreateListener
$cfrom :: forall x. CreateListener -> Rep CreateListener x
Prelude.Generic)

-- |
-- Create a value of 'CreateListener' 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:
--
-- 'alpnPolicy', 'createListener_alpnPolicy' - [TLS listeners] The name of the Application-Layer Protocol Negotiation
-- (ALPN) policy. You can specify one policy name. The following are the
-- possible values:
--
-- -   @HTTP1Only@
--
-- -   @HTTP2Only@
--
-- -   @HTTP2Optional@
--
-- -   @HTTP2Preferred@
--
-- -   @None@
--
-- For more information, see
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#alpn-policies ALPN policies>
-- in the /Network Load Balancers Guide/.
--
-- 'certificates', 'createListener_certificates' - [HTTPS and TLS listeners] The default certificate for the listener. You
-- must provide exactly one certificate. Set @CertificateArn@ to the
-- certificate ARN but do not set @IsDefault@.
--
-- 'port', 'createListener_port' - The port on which the load balancer is listening. You cannot specify a
-- port for a Gateway Load Balancer.
--
-- 'protocol', 'createListener_protocol' - The protocol for connections from clients to the load balancer. For
-- Application Load Balancers, the supported protocols are HTTP and HTTPS.
-- For Network Load Balancers, the supported protocols are TCP, TLS, UDP,
-- and TCP_UDP. You can’t specify the UDP or TCP_UDP protocol if dual-stack
-- mode is enabled. You cannot specify a protocol for a Gateway Load
-- Balancer.
--
-- 'sslPolicy', 'createListener_sslPolicy' - [HTTPS and TLS listeners] The security policy that defines which
-- protocols and ciphers are supported.
--
-- For more information, see
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies Security policies>
-- in the /Application Load Balancers Guide/ and
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies Security policies>
-- in the /Network Load Balancers Guide/.
--
-- 'tags', 'createListener_tags' - The tags to assign to the listener.
--
-- 'loadBalancerArn', 'createListener_loadBalancerArn' - The Amazon Resource Name (ARN) of the load balancer.
--
-- 'defaultActions', 'createListener_defaultActions' - The actions for the default rule.
newCreateListener ::
  -- | 'loadBalancerArn'
  Prelude.Text ->
  CreateListener
newCreateListener :: Text -> CreateListener
newCreateListener Text
pLoadBalancerArn_ =
  CreateListener'
    { $sel:alpnPolicy:CreateListener' :: Maybe [Text]
alpnPolicy = forall a. Maybe a
Prelude.Nothing,
      $sel:certificates:CreateListener' :: Maybe [Certificate]
certificates = forall a. Maybe a
Prelude.Nothing,
      $sel:port:CreateListener' :: Maybe Natural
port = forall a. Maybe a
Prelude.Nothing,
      $sel:protocol:CreateListener' :: Maybe ProtocolEnum
protocol = forall a. Maybe a
Prelude.Nothing,
      $sel:sslPolicy:CreateListener' :: Maybe Text
sslPolicy = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateListener' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:loadBalancerArn:CreateListener' :: Text
loadBalancerArn = Text
pLoadBalancerArn_,
      $sel:defaultActions:CreateListener' :: [Action]
defaultActions = forall a. Monoid a => a
Prelude.mempty
    }

-- | [TLS listeners] The name of the Application-Layer Protocol Negotiation
-- (ALPN) policy. You can specify one policy name. The following are the
-- possible values:
--
-- -   @HTTP1Only@
--
-- -   @HTTP2Only@
--
-- -   @HTTP2Optional@
--
-- -   @HTTP2Preferred@
--
-- -   @None@
--
-- For more information, see
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#alpn-policies ALPN policies>
-- in the /Network Load Balancers Guide/.
createListener_alpnPolicy :: Lens.Lens' CreateListener (Prelude.Maybe [Prelude.Text])
createListener_alpnPolicy :: Lens' CreateListener (Maybe [Text])
createListener_alpnPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Maybe [Text]
alpnPolicy :: Maybe [Text]
$sel:alpnPolicy:CreateListener' :: CreateListener -> Maybe [Text]
alpnPolicy} -> Maybe [Text]
alpnPolicy) (\s :: CreateListener
s@CreateListener' {} Maybe [Text]
a -> CreateListener
s {$sel:alpnPolicy:CreateListener' :: Maybe [Text]
alpnPolicy = Maybe [Text]
a} :: CreateListener) 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

-- | [HTTPS and TLS listeners] The default certificate for the listener. You
-- must provide exactly one certificate. Set @CertificateArn@ to the
-- certificate ARN but do not set @IsDefault@.
createListener_certificates :: Lens.Lens' CreateListener (Prelude.Maybe [Certificate])
createListener_certificates :: Lens' CreateListener (Maybe [Certificate])
createListener_certificates = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Maybe [Certificate]
certificates :: Maybe [Certificate]
$sel:certificates:CreateListener' :: CreateListener -> Maybe [Certificate]
certificates} -> Maybe [Certificate]
certificates) (\s :: CreateListener
s@CreateListener' {} Maybe [Certificate]
a -> CreateListener
s {$sel:certificates:CreateListener' :: Maybe [Certificate]
certificates = Maybe [Certificate]
a} :: CreateListener) 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 port on which the load balancer is listening. You cannot specify a
-- port for a Gateway Load Balancer.
createListener_port :: Lens.Lens' CreateListener (Prelude.Maybe Prelude.Natural)
createListener_port :: Lens' CreateListener (Maybe Natural)
createListener_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Maybe Natural
port :: Maybe Natural
$sel:port:CreateListener' :: CreateListener -> Maybe Natural
port} -> Maybe Natural
port) (\s :: CreateListener
s@CreateListener' {} Maybe Natural
a -> CreateListener
s {$sel:port:CreateListener' :: Maybe Natural
port = Maybe Natural
a} :: CreateListener)

-- | The protocol for connections from clients to the load balancer. For
-- Application Load Balancers, the supported protocols are HTTP and HTTPS.
-- For Network Load Balancers, the supported protocols are TCP, TLS, UDP,
-- and TCP_UDP. You can’t specify the UDP or TCP_UDP protocol if dual-stack
-- mode is enabled. You cannot specify a protocol for a Gateway Load
-- Balancer.
createListener_protocol :: Lens.Lens' CreateListener (Prelude.Maybe ProtocolEnum)
createListener_protocol :: Lens' CreateListener (Maybe ProtocolEnum)
createListener_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Maybe ProtocolEnum
protocol :: Maybe ProtocolEnum
$sel:protocol:CreateListener' :: CreateListener -> Maybe ProtocolEnum
protocol} -> Maybe ProtocolEnum
protocol) (\s :: CreateListener
s@CreateListener' {} Maybe ProtocolEnum
a -> CreateListener
s {$sel:protocol:CreateListener' :: Maybe ProtocolEnum
protocol = Maybe ProtocolEnum
a} :: CreateListener)

-- | [HTTPS and TLS listeners] The security policy that defines which
-- protocols and ciphers are supported.
--
-- For more information, see
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/application/create-https-listener.html#describe-ssl-policies Security policies>
-- in the /Application Load Balancers Guide/ and
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies Security policies>
-- in the /Network Load Balancers Guide/.
createListener_sslPolicy :: Lens.Lens' CreateListener (Prelude.Maybe Prelude.Text)
createListener_sslPolicy :: Lens' CreateListener (Maybe Text)
createListener_sslPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Maybe Text
sslPolicy :: Maybe Text
$sel:sslPolicy:CreateListener' :: CreateListener -> Maybe Text
sslPolicy} -> Maybe Text
sslPolicy) (\s :: CreateListener
s@CreateListener' {} Maybe Text
a -> CreateListener
s {$sel:sslPolicy:CreateListener' :: Maybe Text
sslPolicy = Maybe Text
a} :: CreateListener)

-- | The tags to assign to the listener.
createListener_tags :: Lens.Lens' CreateListener (Prelude.Maybe (Prelude.NonEmpty Tag))
createListener_tags :: Lens' CreateListener (Maybe (NonEmpty Tag))
createListener_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateListener' :: CreateListener -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateListener
s@CreateListener' {} Maybe (NonEmpty Tag)
a -> CreateListener
s {$sel:tags:CreateListener' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateListener) 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 Amazon Resource Name (ARN) of the load balancer.
createListener_loadBalancerArn :: Lens.Lens' CreateListener Prelude.Text
createListener_loadBalancerArn :: Lens' CreateListener Text
createListener_loadBalancerArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Text
loadBalancerArn :: Text
$sel:loadBalancerArn:CreateListener' :: CreateListener -> Text
loadBalancerArn} -> Text
loadBalancerArn) (\s :: CreateListener
s@CreateListener' {} Text
a -> CreateListener
s {$sel:loadBalancerArn:CreateListener' :: Text
loadBalancerArn = Text
a} :: CreateListener)

-- | The actions for the default rule.
createListener_defaultActions :: Lens.Lens' CreateListener [Action]
createListener_defaultActions :: Lens' CreateListener [Action]
createListener_defaultActions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {[Action]
defaultActions :: [Action]
$sel:defaultActions:CreateListener' :: CreateListener -> [Action]
defaultActions} -> [Action]
defaultActions) (\s :: CreateListener
s@CreateListener' {} [Action]
a -> CreateListener
s {$sel:defaultActions:CreateListener' :: [Action]
defaultActions = [Action]
a} :: CreateListener) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateListener where
  type
    AWSResponse CreateListener =
      CreateListenerResponse
  request :: (Service -> Service) -> CreateListener -> Request CreateListener
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateListener)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateListenerResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [Listener] -> Int -> CreateListenerResponse
CreateListenerResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Listeners"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateListener where
  hashWithSalt :: Int -> CreateListener -> Int
hashWithSalt Int
_salt CreateListener' {[Action]
Maybe Natural
Maybe [Text]
Maybe [Certificate]
Maybe (NonEmpty Tag)
Maybe Text
Maybe ProtocolEnum
Text
defaultActions :: [Action]
loadBalancerArn :: Text
tags :: Maybe (NonEmpty Tag)
sslPolicy :: Maybe Text
protocol :: Maybe ProtocolEnum
port :: Maybe Natural
certificates :: Maybe [Certificate]
alpnPolicy :: Maybe [Text]
$sel:defaultActions:CreateListener' :: CreateListener -> [Action]
$sel:loadBalancerArn:CreateListener' :: CreateListener -> Text
$sel:tags:CreateListener' :: CreateListener -> Maybe (NonEmpty Tag)
$sel:sslPolicy:CreateListener' :: CreateListener -> Maybe Text
$sel:protocol:CreateListener' :: CreateListener -> Maybe ProtocolEnum
$sel:port:CreateListener' :: CreateListener -> Maybe Natural
$sel:certificates:CreateListener' :: CreateListener -> Maybe [Certificate]
$sel:alpnPolicy:CreateListener' :: CreateListener -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
alpnPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Certificate]
certificates
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
port
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProtocolEnum
protocol
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sslPolicy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
loadBalancerArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Action]
defaultActions

instance Prelude.NFData CreateListener where
  rnf :: CreateListener -> ()
rnf CreateListener' {[Action]
Maybe Natural
Maybe [Text]
Maybe [Certificate]
Maybe (NonEmpty Tag)
Maybe Text
Maybe ProtocolEnum
Text
defaultActions :: [Action]
loadBalancerArn :: Text
tags :: Maybe (NonEmpty Tag)
sslPolicy :: Maybe Text
protocol :: Maybe ProtocolEnum
port :: Maybe Natural
certificates :: Maybe [Certificate]
alpnPolicy :: Maybe [Text]
$sel:defaultActions:CreateListener' :: CreateListener -> [Action]
$sel:loadBalancerArn:CreateListener' :: CreateListener -> Text
$sel:tags:CreateListener' :: CreateListener -> Maybe (NonEmpty Tag)
$sel:sslPolicy:CreateListener' :: CreateListener -> Maybe Text
$sel:protocol:CreateListener' :: CreateListener -> Maybe ProtocolEnum
$sel:port:CreateListener' :: CreateListener -> Maybe Natural
$sel:certificates:CreateListener' :: CreateListener -> Maybe [Certificate]
$sel:alpnPolicy:CreateListener' :: CreateListener -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
alpnPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Certificate]
certificates
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
port
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProtocolEnum
protocol
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sslPolicy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
loadBalancerArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Action]
defaultActions

instance Data.ToHeaders CreateListener where
  toHeaders :: CreateListener -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath CreateListener where
  toPath :: CreateListener -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CreateListener where
  toQuery :: CreateListener -> QueryString
toQuery CreateListener' {[Action]
Maybe Natural
Maybe [Text]
Maybe [Certificate]
Maybe (NonEmpty Tag)
Maybe Text
Maybe ProtocolEnum
Text
defaultActions :: [Action]
loadBalancerArn :: Text
tags :: Maybe (NonEmpty Tag)
sslPolicy :: Maybe Text
protocol :: Maybe ProtocolEnum
port :: Maybe Natural
certificates :: Maybe [Certificate]
alpnPolicy :: Maybe [Text]
$sel:defaultActions:CreateListener' :: CreateListener -> [Action]
$sel:loadBalancerArn:CreateListener' :: CreateListener -> Text
$sel:tags:CreateListener' :: CreateListener -> Maybe (NonEmpty Tag)
$sel:sslPolicy:CreateListener' :: CreateListener -> Maybe Text
$sel:protocol:CreateListener' :: CreateListener -> Maybe ProtocolEnum
$sel:port:CreateListener' :: CreateListener -> Maybe Natural
$sel:certificates:CreateListener' :: CreateListener -> Maybe [Certificate]
$sel:alpnPolicy:CreateListener' :: CreateListener -> Maybe [Text]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateListener" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
        ByteString
"AlpnPolicy"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
alpnPolicy),
        ByteString
"Certificates"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Certificate]
certificates),
        ByteString
"Port" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
port,
        ByteString
"Protocol" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ProtocolEnum
protocol,
        ByteString
"SslPolicy" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
sslPolicy,
        ByteString
"Tags"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags),
        ByteString
"LoadBalancerArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
loadBalancerArn,
        ByteString
"DefaultActions"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" [Action]
defaultActions
      ]

-- | /See:/ 'newCreateListenerResponse' smart constructor.
data CreateListenerResponse = CreateListenerResponse'
  { -- | Information about the listener.
    CreateListenerResponse -> Maybe [Listener]
listeners :: Prelude.Maybe [Listener],
    -- | The response's http status code.
    CreateListenerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateListenerResponse -> CreateListenerResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateListenerResponse -> CreateListenerResponse -> Bool
$c/= :: CreateListenerResponse -> CreateListenerResponse -> Bool
== :: CreateListenerResponse -> CreateListenerResponse -> Bool
$c== :: CreateListenerResponse -> CreateListenerResponse -> Bool
Prelude.Eq, ReadPrec [CreateListenerResponse]
ReadPrec CreateListenerResponse
Int -> ReadS CreateListenerResponse
ReadS [CreateListenerResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateListenerResponse]
$creadListPrec :: ReadPrec [CreateListenerResponse]
readPrec :: ReadPrec CreateListenerResponse
$creadPrec :: ReadPrec CreateListenerResponse
readList :: ReadS [CreateListenerResponse]
$creadList :: ReadS [CreateListenerResponse]
readsPrec :: Int -> ReadS CreateListenerResponse
$creadsPrec :: Int -> ReadS CreateListenerResponse
Prelude.Read, Int -> CreateListenerResponse -> ShowS
[CreateListenerResponse] -> ShowS
CreateListenerResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateListenerResponse] -> ShowS
$cshowList :: [CreateListenerResponse] -> ShowS
show :: CreateListenerResponse -> String
$cshow :: CreateListenerResponse -> String
showsPrec :: Int -> CreateListenerResponse -> ShowS
$cshowsPrec :: Int -> CreateListenerResponse -> ShowS
Prelude.Show, forall x. Rep CreateListenerResponse x -> CreateListenerResponse
forall x. CreateListenerResponse -> Rep CreateListenerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateListenerResponse x -> CreateListenerResponse
$cfrom :: forall x. CreateListenerResponse -> Rep CreateListenerResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateListenerResponse' 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:
--
-- 'listeners', 'createListenerResponse_listeners' - Information about the listener.
--
-- 'httpStatus', 'createListenerResponse_httpStatus' - The response's http status code.
newCreateListenerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateListenerResponse
newCreateListenerResponse :: Int -> CreateListenerResponse
newCreateListenerResponse Int
pHttpStatus_ =
  CreateListenerResponse'
    { $sel:listeners:CreateListenerResponse' :: Maybe [Listener]
listeners =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateListenerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the listener.
createListenerResponse_listeners :: Lens.Lens' CreateListenerResponse (Prelude.Maybe [Listener])
createListenerResponse_listeners :: Lens' CreateListenerResponse (Maybe [Listener])
createListenerResponse_listeners = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListenerResponse' {Maybe [Listener]
listeners :: Maybe [Listener]
$sel:listeners:CreateListenerResponse' :: CreateListenerResponse -> Maybe [Listener]
listeners} -> Maybe [Listener]
listeners) (\s :: CreateListenerResponse
s@CreateListenerResponse' {} Maybe [Listener]
a -> CreateListenerResponse
s {$sel:listeners:CreateListenerResponse' :: Maybe [Listener]
listeners = Maybe [Listener]
a} :: CreateListenerResponse) 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 response's http status code.
createListenerResponse_httpStatus :: Lens.Lens' CreateListenerResponse Prelude.Int
createListenerResponse_httpStatus :: Lens' CreateListenerResponse Int
createListenerResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListenerResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateListenerResponse' :: CreateListenerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateListenerResponse
s@CreateListenerResponse' {} Int
a -> CreateListenerResponse
s {$sel:httpStatus:CreateListenerResponse' :: Int
httpStatus = Int
a} :: CreateListenerResponse)

instance Prelude.NFData CreateListenerResponse where
  rnf :: CreateListenerResponse -> ()
rnf CreateListenerResponse' {Int
Maybe [Listener]
httpStatus :: Int
listeners :: Maybe [Listener]
$sel:httpStatus:CreateListenerResponse' :: CreateListenerResponse -> Int
$sel:listeners:CreateListenerResponse' :: CreateListenerResponse -> Maybe [Listener]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Listener]
listeners
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus