{-# 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.GlobalAccelerator.CreateListener
-- 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)
--
-- Create a listener to process inbound connections from clients to an
-- accelerator. Connections arrive to assigned static IP addresses on a
-- port, port range, or list of port ranges that you specify.
module Amazonka.GlobalAccelerator.CreateListener
  ( -- * Creating a Request
    CreateListener (..),
    newCreateListener,

    -- * Request Lenses
    createListener_clientAffinity,
    createListener_acceleratorArn,
    createListener_portRanges,
    createListener_protocol,
    createListener_idempotencyToken,

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

    -- * Response Lenses
    createListenerResponse_listener,
    createListenerResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.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:/ 'newCreateListener' smart constructor.
data CreateListener = CreateListener'
  { -- | Client affinity lets you direct all requests from a user to the same
    -- endpoint, if you have stateful applications, regardless of the port and
    -- protocol of the client request. Client affinity gives you control over
    -- whether to always route each client to the same specific endpoint.
    --
    -- AWS Global Accelerator uses a consistent-flow hashing algorithm to
    -- choose the optimal endpoint for a connection. If client affinity is
    -- @NONE@, Global Accelerator uses the \"five-tuple\" (5-tuple)
    -- properties—source IP address, source port, destination IP address,
    -- destination port, and protocol—to select the hash value, and then
    -- chooses the best endpoint. However, with this setting, if someone uses
    -- different ports to connect to Global Accelerator, their connections
    -- might not be always routed to the same endpoint because the hash value
    -- changes.
    --
    -- If you want a given client to always be routed to the same endpoint, set
    -- client affinity to @SOURCE_IP@ instead. When you use the @SOURCE_IP@
    -- setting, Global Accelerator uses the \"two-tuple\" (2-tuple) properties—
    -- source (client) IP address and destination IP address—to select the hash
    -- value.
    --
    -- The default value is @NONE@.
    CreateListener -> Maybe ClientAffinity
clientAffinity :: Prelude.Maybe ClientAffinity,
    -- | The Amazon Resource Name (ARN) of your accelerator.
    CreateListener -> Text
acceleratorArn :: Prelude.Text,
    -- | The list of port ranges to support for connections from clients to your
    -- accelerator.
    CreateListener -> NonEmpty PortRange
portRanges :: Prelude.NonEmpty PortRange,
    -- | The protocol for connections from clients to your accelerator.
    CreateListener -> Protocol
protocol :: Protocol,
    -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency—that is, the uniqueness—of the request.
    CreateListener -> Text
idempotencyToken :: Prelude.Text
  }
  deriving (CreateListener -> CreateListener -> Bool
(CreateListener -> CreateListener -> Bool)
-> (CreateListener -> CreateListener -> Bool) -> Eq CreateListener
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]
(Int -> ReadS CreateListener)
-> ReadS [CreateListener]
-> ReadPrec CreateListener
-> ReadPrec [CreateListener]
-> Read 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
(Int -> CreateListener -> ShowS)
-> (CreateListener -> String)
-> ([CreateListener] -> ShowS)
-> Show CreateListener
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. CreateListener -> Rep CreateListener x)
-> (forall x. Rep CreateListener x -> CreateListener)
-> Generic CreateListener
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:
--
-- 'clientAffinity', 'createListener_clientAffinity' - Client affinity lets you direct all requests from a user to the same
-- endpoint, if you have stateful applications, regardless of the port and
-- protocol of the client request. Client affinity gives you control over
-- whether to always route each client to the same specific endpoint.
--
-- AWS Global Accelerator uses a consistent-flow hashing algorithm to
-- choose the optimal endpoint for a connection. If client affinity is
-- @NONE@, Global Accelerator uses the \"five-tuple\" (5-tuple)
-- properties—source IP address, source port, destination IP address,
-- destination port, and protocol—to select the hash value, and then
-- chooses the best endpoint. However, with this setting, if someone uses
-- different ports to connect to Global Accelerator, their connections
-- might not be always routed to the same endpoint because the hash value
-- changes.
--
-- If you want a given client to always be routed to the same endpoint, set
-- client affinity to @SOURCE_IP@ instead. When you use the @SOURCE_IP@
-- setting, Global Accelerator uses the \"two-tuple\" (2-tuple) properties—
-- source (client) IP address and destination IP address—to select the hash
-- value.
--
-- The default value is @NONE@.
--
-- 'acceleratorArn', 'createListener_acceleratorArn' - The Amazon Resource Name (ARN) of your accelerator.
--
-- 'portRanges', 'createListener_portRanges' - The list of port ranges to support for connections from clients to your
-- accelerator.
--
-- 'protocol', 'createListener_protocol' - The protocol for connections from clients to your accelerator.
--
-- 'idempotencyToken', 'createListener_idempotencyToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency—that is, the uniqueness—of the request.
newCreateListener ::
  -- | 'acceleratorArn'
  Prelude.Text ->
  -- | 'portRanges'
  Prelude.NonEmpty PortRange ->
  -- | 'protocol'
  Protocol ->
  -- | 'idempotencyToken'
  Prelude.Text ->
  CreateListener
newCreateListener :: Text -> NonEmpty PortRange -> Protocol -> Text -> CreateListener
newCreateListener
  Text
pAcceleratorArn_
  NonEmpty PortRange
pPortRanges_
  Protocol
pProtocol_
  Text
pIdempotencyToken_ =
    CreateListener' :: Maybe ClientAffinity
-> Text -> NonEmpty PortRange -> Protocol -> Text -> CreateListener
CreateListener'
      { $sel:clientAffinity:CreateListener' :: Maybe ClientAffinity
clientAffinity = Maybe ClientAffinity
forall a. Maybe a
Prelude.Nothing,
        $sel:acceleratorArn:CreateListener' :: Text
acceleratorArn = Text
pAcceleratorArn_,
        $sel:portRanges:CreateListener' :: NonEmpty PortRange
portRanges = Tagged (NonEmpty PortRange) (Identity (NonEmpty PortRange))
-> Tagged (NonEmpty PortRange) (Identity (NonEmpty PortRange))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty PortRange) (Identity (NonEmpty PortRange))
 -> Tagged (NonEmpty PortRange) (Identity (NonEmpty PortRange)))
-> NonEmpty PortRange -> NonEmpty PortRange
forall t b. AReview t b -> b -> t
Lens.# NonEmpty PortRange
pPortRanges_,
        $sel:protocol:CreateListener' :: Protocol
protocol = Protocol
pProtocol_,
        $sel:idempotencyToken:CreateListener' :: Text
idempotencyToken = Text
pIdempotencyToken_
      }

-- | Client affinity lets you direct all requests from a user to the same
-- endpoint, if you have stateful applications, regardless of the port and
-- protocol of the client request. Client affinity gives you control over
-- whether to always route each client to the same specific endpoint.
--
-- AWS Global Accelerator uses a consistent-flow hashing algorithm to
-- choose the optimal endpoint for a connection. If client affinity is
-- @NONE@, Global Accelerator uses the \"five-tuple\" (5-tuple)
-- properties—source IP address, source port, destination IP address,
-- destination port, and protocol—to select the hash value, and then
-- chooses the best endpoint. However, with this setting, if someone uses
-- different ports to connect to Global Accelerator, their connections
-- might not be always routed to the same endpoint because the hash value
-- changes.
--
-- If you want a given client to always be routed to the same endpoint, set
-- client affinity to @SOURCE_IP@ instead. When you use the @SOURCE_IP@
-- setting, Global Accelerator uses the \"two-tuple\" (2-tuple) properties—
-- source (client) IP address and destination IP address—to select the hash
-- value.
--
-- The default value is @NONE@.
createListener_clientAffinity :: Lens.Lens' CreateListener (Prelude.Maybe ClientAffinity)
createListener_clientAffinity :: (Maybe ClientAffinity -> f (Maybe ClientAffinity))
-> CreateListener -> f CreateListener
createListener_clientAffinity = (CreateListener -> Maybe ClientAffinity)
-> (CreateListener -> Maybe ClientAffinity -> CreateListener)
-> Lens
     CreateListener
     CreateListener
     (Maybe ClientAffinity)
     (Maybe ClientAffinity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Maybe ClientAffinity
clientAffinity :: Maybe ClientAffinity
$sel:clientAffinity:CreateListener' :: CreateListener -> Maybe ClientAffinity
clientAffinity} -> Maybe ClientAffinity
clientAffinity) (\s :: CreateListener
s@CreateListener' {} Maybe ClientAffinity
a -> CreateListener
s {$sel:clientAffinity:CreateListener' :: Maybe ClientAffinity
clientAffinity = Maybe ClientAffinity
a} :: CreateListener)

-- | The Amazon Resource Name (ARN) of your accelerator.
createListener_acceleratorArn :: Lens.Lens' CreateListener Prelude.Text
createListener_acceleratorArn :: (Text -> f Text) -> CreateListener -> f CreateListener
createListener_acceleratorArn = (CreateListener -> Text)
-> (CreateListener -> Text -> CreateListener)
-> Lens CreateListener CreateListener Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Text
acceleratorArn :: Text
$sel:acceleratorArn:CreateListener' :: CreateListener -> Text
acceleratorArn} -> Text
acceleratorArn) (\s :: CreateListener
s@CreateListener' {} Text
a -> CreateListener
s {$sel:acceleratorArn:CreateListener' :: Text
acceleratorArn = Text
a} :: CreateListener)

-- | The list of port ranges to support for connections from clients to your
-- accelerator.
createListener_portRanges :: Lens.Lens' CreateListener (Prelude.NonEmpty PortRange)
createListener_portRanges :: (NonEmpty PortRange -> f (NonEmpty PortRange))
-> CreateListener -> f CreateListener
createListener_portRanges = (CreateListener -> NonEmpty PortRange)
-> (CreateListener -> NonEmpty PortRange -> CreateListener)
-> Lens
     CreateListener
     CreateListener
     (NonEmpty PortRange)
     (NonEmpty PortRange)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {NonEmpty PortRange
portRanges :: NonEmpty PortRange
$sel:portRanges:CreateListener' :: CreateListener -> NonEmpty PortRange
portRanges} -> NonEmpty PortRange
portRanges) (\s :: CreateListener
s@CreateListener' {} NonEmpty PortRange
a -> CreateListener
s {$sel:portRanges:CreateListener' :: NonEmpty PortRange
portRanges = NonEmpty PortRange
a} :: CreateListener) ((NonEmpty PortRange -> f (NonEmpty PortRange))
 -> CreateListener -> f CreateListener)
-> ((NonEmpty PortRange -> f (NonEmpty PortRange))
    -> NonEmpty PortRange -> f (NonEmpty PortRange))
-> (NonEmpty PortRange -> f (NonEmpty PortRange))
-> CreateListener
-> f CreateListener
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty PortRange -> f (NonEmpty PortRange))
-> NonEmpty PortRange -> f (NonEmpty PortRange)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The protocol for connections from clients to your accelerator.
createListener_protocol :: Lens.Lens' CreateListener Protocol
createListener_protocol :: (Protocol -> f Protocol) -> CreateListener -> f CreateListener
createListener_protocol = (CreateListener -> Protocol)
-> (CreateListener -> Protocol -> CreateListener)
-> Lens CreateListener CreateListener Protocol Protocol
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Protocol
protocol :: Protocol
$sel:protocol:CreateListener' :: CreateListener -> Protocol
protocol} -> Protocol
protocol) (\s :: CreateListener
s@CreateListener' {} Protocol
a -> CreateListener
s {$sel:protocol:CreateListener' :: Protocol
protocol = Protocol
a} :: CreateListener)

-- | A unique, case-sensitive identifier that you provide to ensure the
-- idempotency—that is, the uniqueness—of the request.
createListener_idempotencyToken :: Lens.Lens' CreateListener Prelude.Text
createListener_idempotencyToken :: (Text -> f Text) -> CreateListener -> f CreateListener
createListener_idempotencyToken = (CreateListener -> Text)
-> (CreateListener -> Text -> CreateListener)
-> Lens CreateListener CreateListener Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListener' {Text
idempotencyToken :: Text
$sel:idempotencyToken:CreateListener' :: CreateListener -> Text
idempotencyToken} -> Text
idempotencyToken) (\s :: CreateListener
s@CreateListener' {} Text
a -> CreateListener
s {$sel:idempotencyToken:CreateListener' :: Text
idempotencyToken = Text
a} :: CreateListener)

instance Core.AWSRequest CreateListener where
  type
    AWSResponse CreateListener =
      CreateListenerResponse
  request :: CreateListener -> Request CreateListener
request = Service -> CreateListener -> Request CreateListener
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateListener)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateListener))
-> Logger
-> Service
-> Proxy CreateListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateListener)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Listener -> Int -> CreateListenerResponse
CreateListenerResponse'
            (Maybe Listener -> Int -> CreateListenerResponse)
-> Either String (Maybe Listener)
-> Either String (Int -> CreateListenerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Listener)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Listener")
            Either String (Int -> CreateListenerResponse)
-> Either String Int -> Either String CreateListenerResponse
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 CreateListener

instance Prelude.NFData CreateListener

instance Core.ToHeaders CreateListener where
  toHeaders :: CreateListener -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateListener -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"GlobalAccelerator_V20180706.CreateListener" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateListener where
  toJSON :: CreateListener -> Value
toJSON CreateListener' {Maybe ClientAffinity
NonEmpty PortRange
Text
Protocol
idempotencyToken :: Text
protocol :: Protocol
portRanges :: NonEmpty PortRange
acceleratorArn :: Text
clientAffinity :: Maybe ClientAffinity
$sel:idempotencyToken:CreateListener' :: CreateListener -> Text
$sel:protocol:CreateListener' :: CreateListener -> Protocol
$sel:portRanges:CreateListener' :: CreateListener -> NonEmpty PortRange
$sel:acceleratorArn:CreateListener' :: CreateListener -> Text
$sel:clientAffinity:CreateListener' :: CreateListener -> Maybe ClientAffinity
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ClientAffinity" Text -> ClientAffinity -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ClientAffinity -> Pair) -> Maybe ClientAffinity -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ClientAffinity
clientAffinity,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"AcceleratorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
acceleratorArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PortRanges" Text -> NonEmpty PortRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty PortRange
portRanges),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Protocol" Text -> Protocol -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Protocol
protocol),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IdempotencyToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
idempotencyToken)
          ]
      )

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

instance Core.ToQuery CreateListener where
  toQuery :: CreateListener -> QueryString
toQuery = QueryString -> CreateListener -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateListenerResponse' smart constructor.
data CreateListenerResponse = CreateListenerResponse'
  { -- | The listener that you\'ve created.
    CreateListenerResponse -> Maybe Listener
listener :: Prelude.Maybe Listener,
    -- | The response's http status code.
    CreateListenerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateListenerResponse -> CreateListenerResponse -> Bool
(CreateListenerResponse -> CreateListenerResponse -> Bool)
-> (CreateListenerResponse -> CreateListenerResponse -> Bool)
-> Eq CreateListenerResponse
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]
(Int -> ReadS CreateListenerResponse)
-> ReadS [CreateListenerResponse]
-> ReadPrec CreateListenerResponse
-> ReadPrec [CreateListenerResponse]
-> Read 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
(Int -> CreateListenerResponse -> ShowS)
-> (CreateListenerResponse -> String)
-> ([CreateListenerResponse] -> ShowS)
-> Show CreateListenerResponse
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. CreateListenerResponse -> Rep CreateListenerResponse x)
-> (forall x.
    Rep CreateListenerResponse x -> CreateListenerResponse)
-> Generic CreateListenerResponse
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:
--
-- 'listener', 'createListenerResponse_listener' - The listener that you\'ve created.
--
-- 'httpStatus', 'createListenerResponse_httpStatus' - The response's http status code.
newCreateListenerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateListenerResponse
newCreateListenerResponse :: Int -> CreateListenerResponse
newCreateListenerResponse Int
pHttpStatus_ =
  CreateListenerResponse' :: Maybe Listener -> Int -> CreateListenerResponse
CreateListenerResponse'
    { $sel:listener:CreateListenerResponse' :: Maybe Listener
listener = Maybe Listener
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateListenerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The listener that you\'ve created.
createListenerResponse_listener :: Lens.Lens' CreateListenerResponse (Prelude.Maybe Listener)
createListenerResponse_listener :: (Maybe Listener -> f (Maybe Listener))
-> CreateListenerResponse -> f CreateListenerResponse
createListenerResponse_listener = (CreateListenerResponse -> Maybe Listener)
-> (CreateListenerResponse
    -> Maybe Listener -> CreateListenerResponse)
-> Lens
     CreateListenerResponse
     CreateListenerResponse
     (Maybe Listener)
     (Maybe Listener)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateListenerResponse' {Maybe Listener
listener :: Maybe Listener
$sel:listener:CreateListenerResponse' :: CreateListenerResponse -> Maybe Listener
listener} -> Maybe Listener
listener) (\s :: CreateListenerResponse
s@CreateListenerResponse' {} Maybe Listener
a -> CreateListenerResponse
s {$sel:listener:CreateListenerResponse' :: Maybe Listener
listener = Maybe Listener
a} :: CreateListenerResponse)

-- | The response's http status code.
createListenerResponse_httpStatus :: Lens.Lens' CreateListenerResponse Prelude.Int
createListenerResponse_httpStatus :: (Int -> f Int)
-> CreateListenerResponse -> f CreateListenerResponse
createListenerResponse_httpStatus = (CreateListenerResponse -> Int)
-> (CreateListenerResponse -> Int -> CreateListenerResponse)
-> Lens CreateListenerResponse CreateListenerResponse Int Int
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