{-# 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.FIS.GetAction
(
GetAction (..),
newGetAction,
getAction_id,
GetActionResponse (..),
newGetActionResponse,
getActionResponse_action,
getActionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FIS.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 GetAction = GetAction'
{
GetAction -> Text
id :: Prelude.Text
}
deriving (GetAction -> GetAction -> Bool
(GetAction -> GetAction -> Bool)
-> (GetAction -> GetAction -> Bool) -> Eq GetAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAction -> GetAction -> Bool
$c/= :: GetAction -> GetAction -> Bool
== :: GetAction -> GetAction -> Bool
$c== :: GetAction -> GetAction -> Bool
Prelude.Eq, ReadPrec [GetAction]
ReadPrec GetAction
Int -> ReadS GetAction
ReadS [GetAction]
(Int -> ReadS GetAction)
-> ReadS [GetAction]
-> ReadPrec GetAction
-> ReadPrec [GetAction]
-> Read GetAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAction]
$creadListPrec :: ReadPrec [GetAction]
readPrec :: ReadPrec GetAction
$creadPrec :: ReadPrec GetAction
readList :: ReadS [GetAction]
$creadList :: ReadS [GetAction]
readsPrec :: Int -> ReadS GetAction
$creadsPrec :: Int -> ReadS GetAction
Prelude.Read, Int -> GetAction -> ShowS
[GetAction] -> ShowS
GetAction -> String
(Int -> GetAction -> ShowS)
-> (GetAction -> String)
-> ([GetAction] -> ShowS)
-> Show GetAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAction] -> ShowS
$cshowList :: [GetAction] -> ShowS
show :: GetAction -> String
$cshow :: GetAction -> String
showsPrec :: Int -> GetAction -> ShowS
$cshowsPrec :: Int -> GetAction -> ShowS
Prelude.Show, (forall x. GetAction -> Rep GetAction x)
-> (forall x. Rep GetAction x -> GetAction) -> Generic GetAction
forall x. Rep GetAction x -> GetAction
forall x. GetAction -> Rep GetAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAction x -> GetAction
$cfrom :: forall x. GetAction -> Rep GetAction x
Prelude.Generic)
newGetAction ::
Prelude.Text ->
GetAction
newGetAction :: Text -> GetAction
newGetAction Text
pId_ = GetAction' :: Text -> GetAction
GetAction' {$sel:id:GetAction' :: Text
id = Text
pId_}
getAction_id :: Lens.Lens' GetAction Prelude.Text
getAction_id :: (Text -> f Text) -> GetAction -> f GetAction
getAction_id = (GetAction -> Text)
-> (GetAction -> Text -> GetAction)
-> Lens GetAction GetAction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAction' {Text
id :: Text
$sel:id:GetAction' :: GetAction -> Text
id} -> Text
id) (\s :: GetAction
s@GetAction' {} Text
a -> GetAction
s {$sel:id:GetAction' :: Text
id = Text
a} :: GetAction)
instance Core.AWSRequest GetAction where
type AWSResponse GetAction = GetActionResponse
request :: GetAction -> Request GetAction
request = Service -> GetAction -> Request GetAction
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetAction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAction)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetAction))
-> Logger
-> Service
-> Proxy GetAction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAction)))
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 Action -> Int -> GetActionResponse
GetActionResponse'
(Maybe Action -> Int -> GetActionResponse)
-> Either String (Maybe Action)
-> Either String (Int -> GetActionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Action)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"action")
Either String (Int -> GetActionResponse)
-> Either String Int -> Either String GetActionResponse
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 GetAction
instance Prelude.NFData GetAction
instance Core.ToHeaders GetAction where
toHeaders :: GetAction -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetAction -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath GetAction where
toPath :: GetAction -> ByteString
toPath GetAction' {Text
id :: Text
$sel:id:GetAction' :: GetAction -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/actions/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
id]
instance Core.ToQuery GetAction where
toQuery :: GetAction -> QueryString
toQuery = QueryString -> GetAction -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetActionResponse = GetActionResponse'
{
GetActionResponse -> Maybe Action
action :: Prelude.Maybe Action,
GetActionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetActionResponse -> GetActionResponse -> Bool
(GetActionResponse -> GetActionResponse -> Bool)
-> (GetActionResponse -> GetActionResponse -> Bool)
-> Eq GetActionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetActionResponse -> GetActionResponse -> Bool
$c/= :: GetActionResponse -> GetActionResponse -> Bool
== :: GetActionResponse -> GetActionResponse -> Bool
$c== :: GetActionResponse -> GetActionResponse -> Bool
Prelude.Eq, ReadPrec [GetActionResponse]
ReadPrec GetActionResponse
Int -> ReadS GetActionResponse
ReadS [GetActionResponse]
(Int -> ReadS GetActionResponse)
-> ReadS [GetActionResponse]
-> ReadPrec GetActionResponse
-> ReadPrec [GetActionResponse]
-> Read GetActionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetActionResponse]
$creadListPrec :: ReadPrec [GetActionResponse]
readPrec :: ReadPrec GetActionResponse
$creadPrec :: ReadPrec GetActionResponse
readList :: ReadS [GetActionResponse]
$creadList :: ReadS [GetActionResponse]
readsPrec :: Int -> ReadS GetActionResponse
$creadsPrec :: Int -> ReadS GetActionResponse
Prelude.Read, Int -> GetActionResponse -> ShowS
[GetActionResponse] -> ShowS
GetActionResponse -> String
(Int -> GetActionResponse -> ShowS)
-> (GetActionResponse -> String)
-> ([GetActionResponse] -> ShowS)
-> Show GetActionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetActionResponse] -> ShowS
$cshowList :: [GetActionResponse] -> ShowS
show :: GetActionResponse -> String
$cshow :: GetActionResponse -> String
showsPrec :: Int -> GetActionResponse -> ShowS
$cshowsPrec :: Int -> GetActionResponse -> ShowS
Prelude.Show, (forall x. GetActionResponse -> Rep GetActionResponse x)
-> (forall x. Rep GetActionResponse x -> GetActionResponse)
-> Generic GetActionResponse
forall x. Rep GetActionResponse x -> GetActionResponse
forall x. GetActionResponse -> Rep GetActionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetActionResponse x -> GetActionResponse
$cfrom :: forall x. GetActionResponse -> Rep GetActionResponse x
Prelude.Generic)
newGetActionResponse ::
Prelude.Int ->
GetActionResponse
newGetActionResponse :: Int -> GetActionResponse
newGetActionResponse Int
pHttpStatus_ =
GetActionResponse' :: Maybe Action -> Int -> GetActionResponse
GetActionResponse'
{ $sel:action:GetActionResponse' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetActionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getActionResponse_action :: Lens.Lens' GetActionResponse (Prelude.Maybe Action)
getActionResponse_action :: (Maybe Action -> f (Maybe Action))
-> GetActionResponse -> f GetActionResponse
getActionResponse_action = (GetActionResponse -> Maybe Action)
-> (GetActionResponse -> Maybe Action -> GetActionResponse)
-> Lens
GetActionResponse GetActionResponse (Maybe Action) (Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetActionResponse' {Maybe Action
action :: Maybe Action
$sel:action:GetActionResponse' :: GetActionResponse -> Maybe Action
action} -> Maybe Action
action) (\s :: GetActionResponse
s@GetActionResponse' {} Maybe Action
a -> GetActionResponse
s {$sel:action:GetActionResponse' :: Maybe Action
action = Maybe Action
a} :: GetActionResponse)
getActionResponse_httpStatus :: Lens.Lens' GetActionResponse Prelude.Int
getActionResponse_httpStatus :: (Int -> f Int) -> GetActionResponse -> f GetActionResponse
getActionResponse_httpStatus = (GetActionResponse -> Int)
-> (GetActionResponse -> Int -> GetActionResponse)
-> Lens GetActionResponse GetActionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetActionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetActionResponse' :: GetActionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetActionResponse
s@GetActionResponse' {} Int
a -> GetActionResponse
s {$sel:httpStatus:GetActionResponse' :: Int
httpStatus = Int
a} :: GetActionResponse)
instance Prelude.NFData GetActionResponse