{-# 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 #-}
module Amazonka.GlobalAccelerator.UpdateListener
(
UpdateListener (..),
newUpdateListener,
updateListener_portRanges,
updateListener_protocol,
updateListener_clientAffinity,
updateListener_listenerArn,
UpdateListenerResponse (..),
newUpdateListenerResponse,
updateListenerResponse_listener,
updateListenerResponse_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
data UpdateListener = UpdateListener'
{
UpdateListener -> Maybe (NonEmpty PortRange)
portRanges :: Prelude.Maybe (Prelude.NonEmpty PortRange),
UpdateListener -> Maybe Protocol
protocol :: Prelude.Maybe Protocol,
UpdateListener -> Maybe ClientAffinity
clientAffinity :: Prelude.Maybe ClientAffinity,
UpdateListener -> Text
listenerArn :: Prelude.Text
}
deriving (UpdateListener -> UpdateListener -> Bool
(UpdateListener -> UpdateListener -> Bool)
-> (UpdateListener -> UpdateListener -> Bool) -> Eq UpdateListener
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateListener -> UpdateListener -> Bool
$c/= :: UpdateListener -> UpdateListener -> Bool
== :: UpdateListener -> UpdateListener -> Bool
$c== :: UpdateListener -> UpdateListener -> Bool
Prelude.Eq, ReadPrec [UpdateListener]
ReadPrec UpdateListener
Int -> ReadS UpdateListener
ReadS [UpdateListener]
(Int -> ReadS UpdateListener)
-> ReadS [UpdateListener]
-> ReadPrec UpdateListener
-> ReadPrec [UpdateListener]
-> Read UpdateListener
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateListener]
$creadListPrec :: ReadPrec [UpdateListener]
readPrec :: ReadPrec UpdateListener
$creadPrec :: ReadPrec UpdateListener
readList :: ReadS [UpdateListener]
$creadList :: ReadS [UpdateListener]
readsPrec :: Int -> ReadS UpdateListener
$creadsPrec :: Int -> ReadS UpdateListener
Prelude.Read, Int -> UpdateListener -> ShowS
[UpdateListener] -> ShowS
UpdateListener -> String
(Int -> UpdateListener -> ShowS)
-> (UpdateListener -> String)
-> ([UpdateListener] -> ShowS)
-> Show UpdateListener
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateListener] -> ShowS
$cshowList :: [UpdateListener] -> ShowS
show :: UpdateListener -> String
$cshow :: UpdateListener -> String
showsPrec :: Int -> UpdateListener -> ShowS
$cshowsPrec :: Int -> UpdateListener -> ShowS
Prelude.Show, (forall x. UpdateListener -> Rep UpdateListener x)
-> (forall x. Rep UpdateListener x -> UpdateListener)
-> Generic UpdateListener
forall x. Rep UpdateListener x -> UpdateListener
forall x. UpdateListener -> Rep UpdateListener x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateListener x -> UpdateListener
$cfrom :: forall x. UpdateListener -> Rep UpdateListener x
Prelude.Generic)
newUpdateListener ::
Prelude.Text ->
UpdateListener
newUpdateListener :: Text -> UpdateListener
newUpdateListener Text
pListenerArn_ =
UpdateListener' :: Maybe (NonEmpty PortRange)
-> Maybe Protocol -> Maybe ClientAffinity -> Text -> UpdateListener
UpdateListener'
{ $sel:portRanges:UpdateListener' :: Maybe (NonEmpty PortRange)
portRanges = Maybe (NonEmpty PortRange)
forall a. Maybe a
Prelude.Nothing,
$sel:protocol:UpdateListener' :: Maybe Protocol
protocol = Maybe Protocol
forall a. Maybe a
Prelude.Nothing,
$sel:clientAffinity:UpdateListener' :: Maybe ClientAffinity
clientAffinity = Maybe ClientAffinity
forall a. Maybe a
Prelude.Nothing,
$sel:listenerArn:UpdateListener' :: Text
listenerArn = Text
pListenerArn_
}
updateListener_portRanges :: Lens.Lens' UpdateListener (Prelude.Maybe (Prelude.NonEmpty PortRange))
updateListener_portRanges :: (Maybe (NonEmpty PortRange) -> f (Maybe (NonEmpty PortRange)))
-> UpdateListener -> f UpdateListener
updateListener_portRanges = (UpdateListener -> Maybe (NonEmpty PortRange))
-> (UpdateListener -> Maybe (NonEmpty PortRange) -> UpdateListener)
-> Lens
UpdateListener
UpdateListener
(Maybe (NonEmpty PortRange))
(Maybe (NonEmpty PortRange))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateListener' {Maybe (NonEmpty PortRange)
portRanges :: Maybe (NonEmpty PortRange)
$sel:portRanges:UpdateListener' :: UpdateListener -> Maybe (NonEmpty PortRange)
portRanges} -> Maybe (NonEmpty PortRange)
portRanges) (\s :: UpdateListener
s@UpdateListener' {} Maybe (NonEmpty PortRange)
a -> UpdateListener
s {$sel:portRanges:UpdateListener' :: Maybe (NonEmpty PortRange)
portRanges = Maybe (NonEmpty PortRange)
a} :: UpdateListener) ((Maybe (NonEmpty PortRange) -> f (Maybe (NonEmpty PortRange)))
-> UpdateListener -> f UpdateListener)
-> ((Maybe (NonEmpty PortRange) -> f (Maybe (NonEmpty PortRange)))
-> Maybe (NonEmpty PortRange) -> f (Maybe (NonEmpty PortRange)))
-> (Maybe (NonEmpty PortRange) -> f (Maybe (NonEmpty PortRange)))
-> UpdateListener
-> f UpdateListener
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty PortRange)
(NonEmpty PortRange)
(NonEmpty PortRange)
(NonEmpty PortRange)
-> Iso
(Maybe (NonEmpty PortRange))
(Maybe (NonEmpty PortRange))
(Maybe (NonEmpty PortRange))
(Maybe (NonEmpty PortRange))
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
(NonEmpty PortRange)
(NonEmpty PortRange)
(NonEmpty PortRange)
(NonEmpty PortRange)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateListener_protocol :: Lens.Lens' UpdateListener (Prelude.Maybe Protocol)
updateListener_protocol :: (Maybe Protocol -> f (Maybe Protocol))
-> UpdateListener -> f UpdateListener
updateListener_protocol = (UpdateListener -> Maybe Protocol)
-> (UpdateListener -> Maybe Protocol -> UpdateListener)
-> Lens
UpdateListener UpdateListener (Maybe Protocol) (Maybe Protocol)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateListener' {Maybe Protocol
protocol :: Maybe Protocol
$sel:protocol:UpdateListener' :: UpdateListener -> Maybe Protocol
protocol} -> Maybe Protocol
protocol) (\s :: UpdateListener
s@UpdateListener' {} Maybe Protocol
a -> UpdateListener
s {$sel:protocol:UpdateListener' :: Maybe Protocol
protocol = Maybe Protocol
a} :: UpdateListener)
updateListener_clientAffinity :: Lens.Lens' UpdateListener (Prelude.Maybe ClientAffinity)
updateListener_clientAffinity :: (Maybe ClientAffinity -> f (Maybe ClientAffinity))
-> UpdateListener -> f UpdateListener
updateListener_clientAffinity = (UpdateListener -> Maybe ClientAffinity)
-> (UpdateListener -> Maybe ClientAffinity -> UpdateListener)
-> Lens
UpdateListener
UpdateListener
(Maybe ClientAffinity)
(Maybe ClientAffinity)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateListener' {Maybe ClientAffinity
clientAffinity :: Maybe ClientAffinity
$sel:clientAffinity:UpdateListener' :: UpdateListener -> Maybe ClientAffinity
clientAffinity} -> Maybe ClientAffinity
clientAffinity) (\s :: UpdateListener
s@UpdateListener' {} Maybe ClientAffinity
a -> UpdateListener
s {$sel:clientAffinity:UpdateListener' :: Maybe ClientAffinity
clientAffinity = Maybe ClientAffinity
a} :: UpdateListener)
updateListener_listenerArn :: Lens.Lens' UpdateListener Prelude.Text
updateListener_listenerArn :: (Text -> f Text) -> UpdateListener -> f UpdateListener
updateListener_listenerArn = (UpdateListener -> Text)
-> (UpdateListener -> Text -> UpdateListener)
-> Lens UpdateListener UpdateListener Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateListener' {Text
listenerArn :: Text
$sel:listenerArn:UpdateListener' :: UpdateListener -> Text
listenerArn} -> Text
listenerArn) (\s :: UpdateListener
s@UpdateListener' {} Text
a -> UpdateListener
s {$sel:listenerArn:UpdateListener' :: Text
listenerArn = Text
a} :: UpdateListener)
instance Core.AWSRequest UpdateListener where
type
AWSResponse UpdateListener =
UpdateListenerResponse
request :: UpdateListener -> Request UpdateListener
request = Service -> UpdateListener -> Request UpdateListener
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateListener)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateListener))
-> Logger
-> Service
-> Proxy UpdateListener
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateListener)))
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 -> UpdateListenerResponse
UpdateListenerResponse'
(Maybe Listener -> Int -> UpdateListenerResponse)
-> Either String (Maybe Listener)
-> Either String (Int -> UpdateListenerResponse)
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 -> UpdateListenerResponse)
-> Either String Int -> Either String UpdateListenerResponse
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 UpdateListener
instance Prelude.NFData UpdateListener
instance Core.ToHeaders UpdateListener where
toHeaders :: UpdateListener -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateListener -> 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.UpdateListener" ::
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 UpdateListener where
toJSON :: UpdateListener -> Value
toJSON UpdateListener' {Maybe (NonEmpty PortRange)
Maybe ClientAffinity
Maybe Protocol
Text
listenerArn :: Text
clientAffinity :: Maybe ClientAffinity
protocol :: Maybe Protocol
portRanges :: Maybe (NonEmpty PortRange)
$sel:listenerArn:UpdateListener' :: UpdateListener -> Text
$sel:clientAffinity:UpdateListener' :: UpdateListener -> Maybe ClientAffinity
$sel:protocol:UpdateListener' :: UpdateListener -> Maybe Protocol
$sel:portRanges:UpdateListener' :: UpdateListener -> Maybe (NonEmpty PortRange)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PortRanges" Text -> NonEmpty PortRange -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty PortRange -> Pair)
-> Maybe (NonEmpty PortRange) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty PortRange)
portRanges,
(Text
"Protocol" Text -> Protocol -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Protocol -> Pair) -> Maybe Protocol -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Protocol
protocol,
(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
"ListenerArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
listenerArn)
]
)
instance Core.ToPath UpdateListener where
toPath :: UpdateListener -> ByteString
toPath = ByteString -> UpdateListener -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateListener where
toQuery :: UpdateListener -> QueryString
toQuery = QueryString -> UpdateListener -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateListenerResponse = UpdateListenerResponse'
{
UpdateListenerResponse -> Maybe Listener
listener :: Prelude.Maybe Listener,
UpdateListenerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateListenerResponse -> UpdateListenerResponse -> Bool
(UpdateListenerResponse -> UpdateListenerResponse -> Bool)
-> (UpdateListenerResponse -> UpdateListenerResponse -> Bool)
-> Eq UpdateListenerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateListenerResponse -> UpdateListenerResponse -> Bool
$c/= :: UpdateListenerResponse -> UpdateListenerResponse -> Bool
== :: UpdateListenerResponse -> UpdateListenerResponse -> Bool
$c== :: UpdateListenerResponse -> UpdateListenerResponse -> Bool
Prelude.Eq, ReadPrec [UpdateListenerResponse]
ReadPrec UpdateListenerResponse
Int -> ReadS UpdateListenerResponse
ReadS [UpdateListenerResponse]
(Int -> ReadS UpdateListenerResponse)
-> ReadS [UpdateListenerResponse]
-> ReadPrec UpdateListenerResponse
-> ReadPrec [UpdateListenerResponse]
-> Read UpdateListenerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateListenerResponse]
$creadListPrec :: ReadPrec [UpdateListenerResponse]
readPrec :: ReadPrec UpdateListenerResponse
$creadPrec :: ReadPrec UpdateListenerResponse
readList :: ReadS [UpdateListenerResponse]
$creadList :: ReadS [UpdateListenerResponse]
readsPrec :: Int -> ReadS UpdateListenerResponse
$creadsPrec :: Int -> ReadS UpdateListenerResponse
Prelude.Read, Int -> UpdateListenerResponse -> ShowS
[UpdateListenerResponse] -> ShowS
UpdateListenerResponse -> String
(Int -> UpdateListenerResponse -> ShowS)
-> (UpdateListenerResponse -> String)
-> ([UpdateListenerResponse] -> ShowS)
-> Show UpdateListenerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateListenerResponse] -> ShowS
$cshowList :: [UpdateListenerResponse] -> ShowS
show :: UpdateListenerResponse -> String
$cshow :: UpdateListenerResponse -> String
showsPrec :: Int -> UpdateListenerResponse -> ShowS
$cshowsPrec :: Int -> UpdateListenerResponse -> ShowS
Prelude.Show, (forall x. UpdateListenerResponse -> Rep UpdateListenerResponse x)
-> (forall x.
Rep UpdateListenerResponse x -> UpdateListenerResponse)
-> Generic UpdateListenerResponse
forall x. Rep UpdateListenerResponse x -> UpdateListenerResponse
forall x. UpdateListenerResponse -> Rep UpdateListenerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateListenerResponse x -> UpdateListenerResponse
$cfrom :: forall x. UpdateListenerResponse -> Rep UpdateListenerResponse x
Prelude.Generic)
newUpdateListenerResponse ::
Prelude.Int ->
UpdateListenerResponse
newUpdateListenerResponse :: Int -> UpdateListenerResponse
newUpdateListenerResponse Int
pHttpStatus_ =
UpdateListenerResponse' :: Maybe Listener -> Int -> UpdateListenerResponse
UpdateListenerResponse'
{ $sel:listener:UpdateListenerResponse' :: Maybe Listener
listener = Maybe Listener
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateListenerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateListenerResponse_listener :: Lens.Lens' UpdateListenerResponse (Prelude.Maybe Listener)
updateListenerResponse_listener :: (Maybe Listener -> f (Maybe Listener))
-> UpdateListenerResponse -> f UpdateListenerResponse
updateListenerResponse_listener = (UpdateListenerResponse -> Maybe Listener)
-> (UpdateListenerResponse
-> Maybe Listener -> UpdateListenerResponse)
-> Lens
UpdateListenerResponse
UpdateListenerResponse
(Maybe Listener)
(Maybe Listener)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateListenerResponse' {Maybe Listener
listener :: Maybe Listener
$sel:listener:UpdateListenerResponse' :: UpdateListenerResponse -> Maybe Listener
listener} -> Maybe Listener
listener) (\s :: UpdateListenerResponse
s@UpdateListenerResponse' {} Maybe Listener
a -> UpdateListenerResponse
s {$sel:listener:UpdateListenerResponse' :: Maybe Listener
listener = Maybe Listener
a} :: UpdateListenerResponse)
updateListenerResponse_httpStatus :: Lens.Lens' UpdateListenerResponse Prelude.Int
updateListenerResponse_httpStatus :: (Int -> f Int)
-> UpdateListenerResponse -> f UpdateListenerResponse
updateListenerResponse_httpStatus = (UpdateListenerResponse -> Int)
-> (UpdateListenerResponse -> Int -> UpdateListenerResponse)
-> Lens UpdateListenerResponse UpdateListenerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateListenerResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateListenerResponse' :: UpdateListenerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateListenerResponse
s@UpdateListenerResponse' {} Int
a -> UpdateListenerResponse
s {$sel:httpStatus:UpdateListenerResponse' :: Int
httpStatus = Int
a} :: UpdateListenerResponse)
instance Prelude.NFData UpdateListenerResponse