{-# 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.FMS.GetProtocolsList
(
GetProtocolsList (..),
newGetProtocolsList,
getProtocolsList_defaultList,
getProtocolsList_listId,
GetProtocolsListResponse (..),
newGetProtocolsListResponse,
getProtocolsListResponse_protocolsList,
getProtocolsListResponse_protocolsListArn,
getProtocolsListResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FMS.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 GetProtocolsList = GetProtocolsList'
{
GetProtocolsList -> Maybe Bool
defaultList :: Prelude.Maybe Prelude.Bool,
GetProtocolsList -> Text
listId :: Prelude.Text
}
deriving (GetProtocolsList -> GetProtocolsList -> Bool
(GetProtocolsList -> GetProtocolsList -> Bool)
-> (GetProtocolsList -> GetProtocolsList -> Bool)
-> Eq GetProtocolsList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProtocolsList -> GetProtocolsList -> Bool
$c/= :: GetProtocolsList -> GetProtocolsList -> Bool
== :: GetProtocolsList -> GetProtocolsList -> Bool
$c== :: GetProtocolsList -> GetProtocolsList -> Bool
Prelude.Eq, ReadPrec [GetProtocolsList]
ReadPrec GetProtocolsList
Int -> ReadS GetProtocolsList
ReadS [GetProtocolsList]
(Int -> ReadS GetProtocolsList)
-> ReadS [GetProtocolsList]
-> ReadPrec GetProtocolsList
-> ReadPrec [GetProtocolsList]
-> Read GetProtocolsList
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProtocolsList]
$creadListPrec :: ReadPrec [GetProtocolsList]
readPrec :: ReadPrec GetProtocolsList
$creadPrec :: ReadPrec GetProtocolsList
readList :: ReadS [GetProtocolsList]
$creadList :: ReadS [GetProtocolsList]
readsPrec :: Int -> ReadS GetProtocolsList
$creadsPrec :: Int -> ReadS GetProtocolsList
Prelude.Read, Int -> GetProtocolsList -> ShowS
[GetProtocolsList] -> ShowS
GetProtocolsList -> String
(Int -> GetProtocolsList -> ShowS)
-> (GetProtocolsList -> String)
-> ([GetProtocolsList] -> ShowS)
-> Show GetProtocolsList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProtocolsList] -> ShowS
$cshowList :: [GetProtocolsList] -> ShowS
show :: GetProtocolsList -> String
$cshow :: GetProtocolsList -> String
showsPrec :: Int -> GetProtocolsList -> ShowS
$cshowsPrec :: Int -> GetProtocolsList -> ShowS
Prelude.Show, (forall x. GetProtocolsList -> Rep GetProtocolsList x)
-> (forall x. Rep GetProtocolsList x -> GetProtocolsList)
-> Generic GetProtocolsList
forall x. Rep GetProtocolsList x -> GetProtocolsList
forall x. GetProtocolsList -> Rep GetProtocolsList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetProtocolsList x -> GetProtocolsList
$cfrom :: forall x. GetProtocolsList -> Rep GetProtocolsList x
Prelude.Generic)
newGetProtocolsList ::
Prelude.Text ->
GetProtocolsList
newGetProtocolsList :: Text -> GetProtocolsList
newGetProtocolsList Text
pListId_ =
GetProtocolsList' :: Maybe Bool -> Text -> GetProtocolsList
GetProtocolsList'
{ $sel:defaultList:GetProtocolsList' :: Maybe Bool
defaultList = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:listId:GetProtocolsList' :: Text
listId = Text
pListId_
}
getProtocolsList_defaultList :: Lens.Lens' GetProtocolsList (Prelude.Maybe Prelude.Bool)
getProtocolsList_defaultList :: (Maybe Bool -> f (Maybe Bool))
-> GetProtocolsList -> f GetProtocolsList
getProtocolsList_defaultList = (GetProtocolsList -> Maybe Bool)
-> (GetProtocolsList -> Maybe Bool -> GetProtocolsList)
-> Lens GetProtocolsList GetProtocolsList (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtocolsList' {Maybe Bool
defaultList :: Maybe Bool
$sel:defaultList:GetProtocolsList' :: GetProtocolsList -> Maybe Bool
defaultList} -> Maybe Bool
defaultList) (\s :: GetProtocolsList
s@GetProtocolsList' {} Maybe Bool
a -> GetProtocolsList
s {$sel:defaultList:GetProtocolsList' :: Maybe Bool
defaultList = Maybe Bool
a} :: GetProtocolsList)
getProtocolsList_listId :: Lens.Lens' GetProtocolsList Prelude.Text
getProtocolsList_listId :: (Text -> f Text) -> GetProtocolsList -> f GetProtocolsList
getProtocolsList_listId = (GetProtocolsList -> Text)
-> (GetProtocolsList -> Text -> GetProtocolsList)
-> Lens GetProtocolsList GetProtocolsList Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtocolsList' {Text
listId :: Text
$sel:listId:GetProtocolsList' :: GetProtocolsList -> Text
listId} -> Text
listId) (\s :: GetProtocolsList
s@GetProtocolsList' {} Text
a -> GetProtocolsList
s {$sel:listId:GetProtocolsList' :: Text
listId = Text
a} :: GetProtocolsList)
instance Core.AWSRequest GetProtocolsList where
type
AWSResponse GetProtocolsList =
GetProtocolsListResponse
request :: GetProtocolsList -> Request GetProtocolsList
request = Service -> GetProtocolsList -> Request GetProtocolsList
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetProtocolsList
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProtocolsList)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetProtocolsList))
-> Logger
-> Service
-> Proxy GetProtocolsList
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetProtocolsList)))
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 ProtocolsListData
-> Maybe Text -> Int -> GetProtocolsListResponse
GetProtocolsListResponse'
(Maybe ProtocolsListData
-> Maybe Text -> Int -> GetProtocolsListResponse)
-> Either String (Maybe ProtocolsListData)
-> Either String (Maybe Text -> Int -> GetProtocolsListResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ProtocolsListData)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProtocolsList")
Either String (Maybe Text -> Int -> GetProtocolsListResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetProtocolsListResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProtocolsListArn")
Either String (Int -> GetProtocolsListResponse)
-> Either String Int -> Either String GetProtocolsListResponse
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 GetProtocolsList
instance Prelude.NFData GetProtocolsList
instance Core.ToHeaders GetProtocolsList where
toHeaders :: GetProtocolsList -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetProtocolsList -> 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
"AWSFMS_20180101.GetProtocolsList" ::
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 GetProtocolsList where
toJSON :: GetProtocolsList -> Value
toJSON GetProtocolsList' {Maybe Bool
Text
listId :: Text
defaultList :: Maybe Bool
$sel:listId:GetProtocolsList' :: GetProtocolsList -> Text
$sel:defaultList:GetProtocolsList' :: GetProtocolsList -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DefaultList" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
defaultList,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ListId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
listId)
]
)
instance Core.ToPath GetProtocolsList where
toPath :: GetProtocolsList -> ByteString
toPath = ByteString -> GetProtocolsList -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetProtocolsList where
toQuery :: GetProtocolsList -> QueryString
toQuery = QueryString -> GetProtocolsList -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetProtocolsListResponse = GetProtocolsListResponse'
{
GetProtocolsListResponse -> Maybe ProtocolsListData
protocolsList :: Prelude.Maybe ProtocolsListData,
GetProtocolsListResponse -> Maybe Text
protocolsListArn :: Prelude.Maybe Prelude.Text,
GetProtocolsListResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetProtocolsListResponse -> GetProtocolsListResponse -> Bool
(GetProtocolsListResponse -> GetProtocolsListResponse -> Bool)
-> (GetProtocolsListResponse -> GetProtocolsListResponse -> Bool)
-> Eq GetProtocolsListResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetProtocolsListResponse -> GetProtocolsListResponse -> Bool
$c/= :: GetProtocolsListResponse -> GetProtocolsListResponse -> Bool
== :: GetProtocolsListResponse -> GetProtocolsListResponse -> Bool
$c== :: GetProtocolsListResponse -> GetProtocolsListResponse -> Bool
Prelude.Eq, ReadPrec [GetProtocolsListResponse]
ReadPrec GetProtocolsListResponse
Int -> ReadS GetProtocolsListResponse
ReadS [GetProtocolsListResponse]
(Int -> ReadS GetProtocolsListResponse)
-> ReadS [GetProtocolsListResponse]
-> ReadPrec GetProtocolsListResponse
-> ReadPrec [GetProtocolsListResponse]
-> Read GetProtocolsListResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetProtocolsListResponse]
$creadListPrec :: ReadPrec [GetProtocolsListResponse]
readPrec :: ReadPrec GetProtocolsListResponse
$creadPrec :: ReadPrec GetProtocolsListResponse
readList :: ReadS [GetProtocolsListResponse]
$creadList :: ReadS [GetProtocolsListResponse]
readsPrec :: Int -> ReadS GetProtocolsListResponse
$creadsPrec :: Int -> ReadS GetProtocolsListResponse
Prelude.Read, Int -> GetProtocolsListResponse -> ShowS
[GetProtocolsListResponse] -> ShowS
GetProtocolsListResponse -> String
(Int -> GetProtocolsListResponse -> ShowS)
-> (GetProtocolsListResponse -> String)
-> ([GetProtocolsListResponse] -> ShowS)
-> Show GetProtocolsListResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetProtocolsListResponse] -> ShowS
$cshowList :: [GetProtocolsListResponse] -> ShowS
show :: GetProtocolsListResponse -> String
$cshow :: GetProtocolsListResponse -> String
showsPrec :: Int -> GetProtocolsListResponse -> ShowS
$cshowsPrec :: Int -> GetProtocolsListResponse -> ShowS
Prelude.Show, (forall x.
GetProtocolsListResponse -> Rep GetProtocolsListResponse x)
-> (forall x.
Rep GetProtocolsListResponse x -> GetProtocolsListResponse)
-> Generic GetProtocolsListResponse
forall x.
Rep GetProtocolsListResponse x -> GetProtocolsListResponse
forall x.
GetProtocolsListResponse -> Rep GetProtocolsListResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetProtocolsListResponse x -> GetProtocolsListResponse
$cfrom :: forall x.
GetProtocolsListResponse -> Rep GetProtocolsListResponse x
Prelude.Generic)
newGetProtocolsListResponse ::
Prelude.Int ->
GetProtocolsListResponse
newGetProtocolsListResponse :: Int -> GetProtocolsListResponse
newGetProtocolsListResponse Int
pHttpStatus_ =
GetProtocolsListResponse' :: Maybe ProtocolsListData
-> Maybe Text -> Int -> GetProtocolsListResponse
GetProtocolsListResponse'
{ $sel:protocolsList:GetProtocolsListResponse' :: Maybe ProtocolsListData
protocolsList =
Maybe ProtocolsListData
forall a. Maybe a
Prelude.Nothing,
$sel:protocolsListArn:GetProtocolsListResponse' :: Maybe Text
protocolsListArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetProtocolsListResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getProtocolsListResponse_protocolsList :: Lens.Lens' GetProtocolsListResponse (Prelude.Maybe ProtocolsListData)
getProtocolsListResponse_protocolsList :: (Maybe ProtocolsListData -> f (Maybe ProtocolsListData))
-> GetProtocolsListResponse -> f GetProtocolsListResponse
getProtocolsListResponse_protocolsList = (GetProtocolsListResponse -> Maybe ProtocolsListData)
-> (GetProtocolsListResponse
-> Maybe ProtocolsListData -> GetProtocolsListResponse)
-> Lens
GetProtocolsListResponse
GetProtocolsListResponse
(Maybe ProtocolsListData)
(Maybe ProtocolsListData)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtocolsListResponse' {Maybe ProtocolsListData
protocolsList :: Maybe ProtocolsListData
$sel:protocolsList:GetProtocolsListResponse' :: GetProtocolsListResponse -> Maybe ProtocolsListData
protocolsList} -> Maybe ProtocolsListData
protocolsList) (\s :: GetProtocolsListResponse
s@GetProtocolsListResponse' {} Maybe ProtocolsListData
a -> GetProtocolsListResponse
s {$sel:protocolsList:GetProtocolsListResponse' :: Maybe ProtocolsListData
protocolsList = Maybe ProtocolsListData
a} :: GetProtocolsListResponse)
getProtocolsListResponse_protocolsListArn :: Lens.Lens' GetProtocolsListResponse (Prelude.Maybe Prelude.Text)
getProtocolsListResponse_protocolsListArn :: (Maybe Text -> f (Maybe Text))
-> GetProtocolsListResponse -> f GetProtocolsListResponse
getProtocolsListResponse_protocolsListArn = (GetProtocolsListResponse -> Maybe Text)
-> (GetProtocolsListResponse
-> Maybe Text -> GetProtocolsListResponse)
-> Lens
GetProtocolsListResponse
GetProtocolsListResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtocolsListResponse' {Maybe Text
protocolsListArn :: Maybe Text
$sel:protocolsListArn:GetProtocolsListResponse' :: GetProtocolsListResponse -> Maybe Text
protocolsListArn} -> Maybe Text
protocolsListArn) (\s :: GetProtocolsListResponse
s@GetProtocolsListResponse' {} Maybe Text
a -> GetProtocolsListResponse
s {$sel:protocolsListArn:GetProtocolsListResponse' :: Maybe Text
protocolsListArn = Maybe Text
a} :: GetProtocolsListResponse)
getProtocolsListResponse_httpStatus :: Lens.Lens' GetProtocolsListResponse Prelude.Int
getProtocolsListResponse_httpStatus :: (Int -> f Int)
-> GetProtocolsListResponse -> f GetProtocolsListResponse
getProtocolsListResponse_httpStatus = (GetProtocolsListResponse -> Int)
-> (GetProtocolsListResponse -> Int -> GetProtocolsListResponse)
-> Lens GetProtocolsListResponse GetProtocolsListResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetProtocolsListResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetProtocolsListResponse' :: GetProtocolsListResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetProtocolsListResponse
s@GetProtocolsListResponse' {} Int
a -> GetProtocolsListResponse
s {$sel:httpStatus:GetProtocolsListResponse' :: Int
httpStatus = Int
a} :: GetProtocolsListResponse)
instance Prelude.NFData GetProtocolsListResponse