{-# 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.ModifyListener
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Replaces the specified properties of the specified listener. Any
-- properties that you do not specify remain unchanged.
--
-- Changing the protocol from HTTPS to HTTP, or from TLS to TCP, removes
-- the security policy and default certificate properties. If you change
-- the protocol from HTTP to HTTPS, or from TCP to TLS, you must add the
-- security policy and default certificate properties.
--
-- To add an item to a list, remove an item from a list, or update an item
-- in a list, you must provide the entire list. For example, to add an
-- action, specify a list with the current actions plus the new action.
module Amazonka.ELBV2.ModifyListener
  ( -- * Creating a Request
    ModifyListener (..),
    newModifyListener,

    -- * Request Lenses
    modifyListener_sslPolicy,
    modifyListener_protocol,
    modifyListener_defaultActions,
    modifyListener_certificates,
    modifyListener_alpnPolicy,
    modifyListener_port,
    modifyListener_listenerArn,

    -- * Destructuring the Response
    ModifyListenerResponse (..),
    newModifyListenerResponse,

    -- * Response Lenses
    modifyListenerResponse_listeners,
    modifyListenerResponse_httpStatus,
  )
where

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

-- | /See:/ 'newModifyListener' smart constructor.
data ModifyListener = ModifyListener'
  { -- | [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/ or
    -- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies Security policies>
    -- in the /Network Load Balancers Guide/.
    ModifyListener -> Maybe Text
sslPolicy :: Prelude.Maybe Prelude.Text,
    -- | The protocol for connections from clients to the load balancer.
    -- Application Load Balancers support the HTTP and HTTPS protocols. Network
    -- Load Balancers support the TCP, TLS, UDP, and TCP_UDP protocols. You
    -- can’t change the protocol to UDP or TCP_UDP if dual-stack mode is
    -- enabled. You cannot specify a protocol for a Gateway Load Balancer.
    ModifyListener -> Maybe ProtocolEnum
protocol :: Prelude.Maybe ProtocolEnum,
    -- | The actions for the default rule.
    ModifyListener -> Maybe [Action]
defaultActions :: Prelude.Maybe [Action],
    -- | [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@.
    ModifyListener -> Maybe [Certificate]
certificates :: Prelude.Maybe [Certificate],
    -- | [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/.
    ModifyListener -> Maybe [Text]
alpnPolicy :: Prelude.Maybe [Prelude.Text],
    -- | The port for connections from clients to the load balancer. You cannot
    -- specify a port for a Gateway Load Balancer.
    ModifyListener -> Maybe Natural
port :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the listener.
    ModifyListener -> Text
listenerArn :: Prelude.Text
  }
  deriving (ModifyListener -> ModifyListener -> Bool
(ModifyListener -> ModifyListener -> Bool)
-> (ModifyListener -> ModifyListener -> Bool) -> Eq ModifyListener
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyListener -> ModifyListener -> Bool
$c/= :: ModifyListener -> ModifyListener -> Bool
== :: ModifyListener -> ModifyListener -> Bool
$c== :: ModifyListener -> ModifyListener -> Bool
Prelude.Eq, ReadPrec [ModifyListener]
ReadPrec ModifyListener
Int -> ReadS ModifyListener
ReadS [ModifyListener]
(Int -> ReadS ModifyListener)
-> ReadS [ModifyListener]
-> ReadPrec ModifyListener
-> ReadPrec [ModifyListener]
-> Read ModifyListener
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyListener]
$creadListPrec :: ReadPrec [ModifyListener]
readPrec :: ReadPrec ModifyListener
$creadPrec :: ReadPrec ModifyListener
readList :: ReadS [ModifyListener]
$creadList :: ReadS [ModifyListener]
readsPrec :: Int -> ReadS ModifyListener
$creadsPrec :: Int -> ReadS ModifyListener
Prelude.Read, Int -> ModifyListener -> ShowS
[ModifyListener] -> ShowS
ModifyListener -> String
(Int -> ModifyListener -> ShowS)
-> (ModifyListener -> String)
-> ([ModifyListener] -> ShowS)
-> Show ModifyListener
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyListener] -> ShowS
$cshowList :: [ModifyListener] -> ShowS
show :: ModifyListener -> String
$cshow :: ModifyListener -> String
showsPrec :: Int -> ModifyListener -> ShowS
$cshowsPrec :: Int -> ModifyListener -> ShowS
Prelude.Show, (forall x. ModifyListener -> Rep ModifyListener x)
-> (forall x. Rep ModifyListener x -> ModifyListener)
-> Generic ModifyListener
forall x. Rep ModifyListener x -> ModifyListener
forall x. ModifyListener -> Rep ModifyListener x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyListener x -> ModifyListener
$cfrom :: forall x. ModifyListener -> Rep ModifyListener x
Prelude.Generic)

-- |
-- Create a value of 'ModifyListener' 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:
--
-- 'sslPolicy', 'modifyListener_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/ or
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies Security policies>
-- in the /Network Load Balancers Guide/.
--
-- 'protocol', 'modifyListener_protocol' - The protocol for connections from clients to the load balancer.
-- Application Load Balancers support the HTTP and HTTPS protocols. Network
-- Load Balancers support the TCP, TLS, UDP, and TCP_UDP protocols. You
-- can’t change the protocol to UDP or TCP_UDP if dual-stack mode is
-- enabled. You cannot specify a protocol for a Gateway Load Balancer.
--
-- 'defaultActions', 'modifyListener_defaultActions' - The actions for the default rule.
--
-- 'certificates', 'modifyListener_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@.
--
-- 'alpnPolicy', 'modifyListener_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/.
--
-- 'port', 'modifyListener_port' - The port for connections from clients to the load balancer. You cannot
-- specify a port for a Gateway Load Balancer.
--
-- 'listenerArn', 'modifyListener_listenerArn' - The Amazon Resource Name (ARN) of the listener.
newModifyListener ::
  -- | 'listenerArn'
  Prelude.Text ->
  ModifyListener
newModifyListener :: Text -> ModifyListener
newModifyListener Text
pListenerArn_ =
  ModifyListener' :: Maybe Text
-> Maybe ProtocolEnum
-> Maybe [Action]
-> Maybe [Certificate]
-> Maybe [Text]
-> Maybe Natural
-> Text
-> ModifyListener
ModifyListener'
    { $sel:sslPolicy:ModifyListener' :: Maybe Text
sslPolicy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:protocol:ModifyListener' :: Maybe ProtocolEnum
protocol = Maybe ProtocolEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultActions:ModifyListener' :: Maybe [Action]
defaultActions = Maybe [Action]
forall a. Maybe a
Prelude.Nothing,
      $sel:certificates:ModifyListener' :: Maybe [Certificate]
certificates = Maybe [Certificate]
forall a. Maybe a
Prelude.Nothing,
      $sel:alpnPolicy:ModifyListener' :: Maybe [Text]
alpnPolicy = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:port:ModifyListener' :: Maybe Natural
port = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:listenerArn:ModifyListener' :: Text
listenerArn = Text
pListenerArn_
    }

-- | [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/ or
-- <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-tls-listener.html#describe-ssl-policies Security policies>
-- in the /Network Load Balancers Guide/.
modifyListener_sslPolicy :: Lens.Lens' ModifyListener (Prelude.Maybe Prelude.Text)
modifyListener_sslPolicy :: (Maybe Text -> f (Maybe Text))
-> ModifyListener -> f ModifyListener
modifyListener_sslPolicy = (ModifyListener -> Maybe Text)
-> (ModifyListener -> Maybe Text -> ModifyListener)
-> Lens ModifyListener ModifyListener (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyListener' {Maybe Text
sslPolicy :: Maybe Text
$sel:sslPolicy:ModifyListener' :: ModifyListener -> Maybe Text
sslPolicy} -> Maybe Text
sslPolicy) (\s :: ModifyListener
s@ModifyListener' {} Maybe Text
a -> ModifyListener
s {$sel:sslPolicy:ModifyListener' :: Maybe Text
sslPolicy = Maybe Text
a} :: ModifyListener)

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

-- | The actions for the default rule.
modifyListener_defaultActions :: Lens.Lens' ModifyListener (Prelude.Maybe [Action])
modifyListener_defaultActions :: (Maybe [Action] -> f (Maybe [Action]))
-> ModifyListener -> f ModifyListener
modifyListener_defaultActions = (ModifyListener -> Maybe [Action])
-> (ModifyListener -> Maybe [Action] -> ModifyListener)
-> Lens
     ModifyListener ModifyListener (Maybe [Action]) (Maybe [Action])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyListener' {Maybe [Action]
defaultActions :: Maybe [Action]
$sel:defaultActions:ModifyListener' :: ModifyListener -> Maybe [Action]
defaultActions} -> Maybe [Action]
defaultActions) (\s :: ModifyListener
s@ModifyListener' {} Maybe [Action]
a -> ModifyListener
s {$sel:defaultActions:ModifyListener' :: Maybe [Action]
defaultActions = Maybe [Action]
a} :: ModifyListener) ((Maybe [Action] -> f (Maybe [Action]))
 -> ModifyListener -> f ModifyListener)
-> ((Maybe [Action] -> f (Maybe [Action]))
    -> Maybe [Action] -> f (Maybe [Action]))
-> (Maybe [Action] -> f (Maybe [Action]))
-> ModifyListener
-> f ModifyListener
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Action] [Action] [Action] [Action]
-> Iso
     (Maybe [Action]) (Maybe [Action]) (Maybe [Action]) (Maybe [Action])
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 AnIso [Action] [Action] [Action] [Action]
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@.
modifyListener_certificates :: Lens.Lens' ModifyListener (Prelude.Maybe [Certificate])
modifyListener_certificates :: (Maybe [Certificate] -> f (Maybe [Certificate]))
-> ModifyListener -> f ModifyListener
modifyListener_certificates = (ModifyListener -> Maybe [Certificate])
-> (ModifyListener -> Maybe [Certificate] -> ModifyListener)
-> Lens
     ModifyListener
     ModifyListener
     (Maybe [Certificate])
     (Maybe [Certificate])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyListener' {Maybe [Certificate]
certificates :: Maybe [Certificate]
$sel:certificates:ModifyListener' :: ModifyListener -> Maybe [Certificate]
certificates} -> Maybe [Certificate]
certificates) (\s :: ModifyListener
s@ModifyListener' {} Maybe [Certificate]
a -> ModifyListener
s {$sel:certificates:ModifyListener' :: Maybe [Certificate]
certificates = Maybe [Certificate]
a} :: ModifyListener) ((Maybe [Certificate] -> f (Maybe [Certificate]))
 -> ModifyListener -> f ModifyListener)
-> ((Maybe [Certificate] -> f (Maybe [Certificate]))
    -> Maybe [Certificate] -> f (Maybe [Certificate]))
-> (Maybe [Certificate] -> f (Maybe [Certificate]))
-> ModifyListener
-> f ModifyListener
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Certificate] [Certificate] [Certificate] [Certificate]
-> Iso
     (Maybe [Certificate])
     (Maybe [Certificate])
     (Maybe [Certificate])
     (Maybe [Certificate])
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 AnIso [Certificate] [Certificate] [Certificate] [Certificate]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | [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/.
modifyListener_alpnPolicy :: Lens.Lens' ModifyListener (Prelude.Maybe [Prelude.Text])
modifyListener_alpnPolicy :: (Maybe [Text] -> f (Maybe [Text]))
-> ModifyListener -> f ModifyListener
modifyListener_alpnPolicy = (ModifyListener -> Maybe [Text])
-> (ModifyListener -> Maybe [Text] -> ModifyListener)
-> Lens ModifyListener ModifyListener (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyListener' {Maybe [Text]
alpnPolicy :: Maybe [Text]
$sel:alpnPolicy:ModifyListener' :: ModifyListener -> Maybe [Text]
alpnPolicy} -> Maybe [Text]
alpnPolicy) (\s :: ModifyListener
s@ModifyListener' {} Maybe [Text]
a -> ModifyListener
s {$sel:alpnPolicy:ModifyListener' :: Maybe [Text]
alpnPolicy = Maybe [Text]
a} :: ModifyListener) ((Maybe [Text] -> f (Maybe [Text]))
 -> ModifyListener -> f ModifyListener)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ModifyListener
-> f ModifyListener
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The port for connections from clients to the load balancer. You cannot
-- specify a port for a Gateway Load Balancer.
modifyListener_port :: Lens.Lens' ModifyListener (Prelude.Maybe Prelude.Natural)
modifyListener_port :: (Maybe Natural -> f (Maybe Natural))
-> ModifyListener -> f ModifyListener
modifyListener_port = (ModifyListener -> Maybe Natural)
-> (ModifyListener -> Maybe Natural -> ModifyListener)
-> Lens
     ModifyListener ModifyListener (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyListener' {Maybe Natural
port :: Maybe Natural
$sel:port:ModifyListener' :: ModifyListener -> Maybe Natural
port} -> Maybe Natural
port) (\s :: ModifyListener
s@ModifyListener' {} Maybe Natural
a -> ModifyListener
s {$sel:port:ModifyListener' :: Maybe Natural
port = Maybe Natural
a} :: ModifyListener)

-- | The Amazon Resource Name (ARN) of the listener.
modifyListener_listenerArn :: Lens.Lens' ModifyListener Prelude.Text
modifyListener_listenerArn :: (Text -> f Text) -> ModifyListener -> f ModifyListener
modifyListener_listenerArn = (ModifyListener -> Text)
-> (ModifyListener -> Text -> ModifyListener)
-> Lens ModifyListener ModifyListener Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyListener' {Text
listenerArn :: Text
$sel:listenerArn:ModifyListener' :: ModifyListener -> Text
listenerArn} -> Text
listenerArn) (\s :: ModifyListener
s@ModifyListener' {} Text
a -> ModifyListener
s {$sel:listenerArn:ModifyListener' :: Text
listenerArn = Text
a} :: ModifyListener)

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

instance Prelude.Hashable ModifyListener

instance Prelude.NFData ModifyListener

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

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

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

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

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

-- | Information about the modified listener.
modifyListenerResponse_listeners :: Lens.Lens' ModifyListenerResponse (Prelude.Maybe [Listener])
modifyListenerResponse_listeners :: (Maybe [Listener] -> f (Maybe [Listener]))
-> ModifyListenerResponse -> f ModifyListenerResponse
modifyListenerResponse_listeners = (ModifyListenerResponse -> Maybe [Listener])
-> (ModifyListenerResponse
    -> Maybe [Listener] -> ModifyListenerResponse)
-> Lens
     ModifyListenerResponse
     ModifyListenerResponse
     (Maybe [Listener])
     (Maybe [Listener])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyListenerResponse' {Maybe [Listener]
listeners :: Maybe [Listener]
$sel:listeners:ModifyListenerResponse' :: ModifyListenerResponse -> Maybe [Listener]
listeners} -> Maybe [Listener]
listeners) (\s :: ModifyListenerResponse
s@ModifyListenerResponse' {} Maybe [Listener]
a -> ModifyListenerResponse
s {$sel:listeners:ModifyListenerResponse' :: Maybe [Listener]
listeners = Maybe [Listener]
a} :: ModifyListenerResponse) ((Maybe [Listener] -> f (Maybe [Listener]))
 -> ModifyListenerResponse -> f ModifyListenerResponse)
-> ((Maybe [Listener] -> f (Maybe [Listener]))
    -> Maybe [Listener] -> f (Maybe [Listener]))
-> (Maybe [Listener] -> f (Maybe [Listener]))
-> ModifyListenerResponse
-> f ModifyListenerResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Listener] [Listener] [Listener] [Listener]
-> Iso
     (Maybe [Listener])
     (Maybe [Listener])
     (Maybe [Listener])
     (Maybe [Listener])
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 AnIso [Listener] [Listener] [Listener] [Listener]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
modifyListenerResponse_httpStatus :: Lens.Lens' ModifyListenerResponse Prelude.Int
modifyListenerResponse_httpStatus :: (Int -> f Int)
-> ModifyListenerResponse -> f ModifyListenerResponse
modifyListenerResponse_httpStatus = (ModifyListenerResponse -> Int)
-> (ModifyListenerResponse -> Int -> ModifyListenerResponse)
-> Lens ModifyListenerResponse ModifyListenerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyListenerResponse' {Int
httpStatus :: Int
$sel:httpStatus:ModifyListenerResponse' :: ModifyListenerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ModifyListenerResponse
s@ModifyListenerResponse' {} Int
a -> ModifyListenerResponse
s {$sel:httpStatus:ModifyListenerResponse' :: Int
httpStatus = Int
a} :: ModifyListenerResponse)

instance Prelude.NFData ModifyListenerResponse