{-# 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FIS.Types
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
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]
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
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. 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' {$sel:id:GetAction' :: Text
id = Text
pId_}
getAction_id :: Lens.Lens' GetAction Prelude.Text
getAction_id :: Lens' GetAction Text
getAction_id = 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 :: (Service -> Service) -> GetAction -> Request GetAction
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetAction
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAction)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Action -> Int -> GetActionResponse
GetActionResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"action")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetAction where
hashWithSalt :: Int -> GetAction -> Int
hashWithSalt Int
_salt GetAction' {Text
id :: Text
$sel:id:GetAction' :: GetAction -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetAction where
rnf :: GetAction -> ()
rnf GetAction' {Text
id :: Text
$sel:id:GetAction' :: GetAction -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetAction where
toHeaders :: GetAction -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetAction where
toPath :: GetAction -> ByteString
toPath GetAction' {Text
id :: Text
$sel:id:GetAction' :: GetAction -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/actions/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]
instance Data.ToQuery GetAction where
toQuery :: GetAction -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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. 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'
{ $sel:action:GetActionResponse' :: Maybe Action
action = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetActionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getActionResponse_action :: Lens.Lens' GetActionResponse (Prelude.Maybe Action)
getActionResponse_action :: Lens' GetActionResponse (Maybe Action)
getActionResponse_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 :: Lens' GetActionResponse Int
getActionResponse_httpStatus = 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 where
rnf :: GetActionResponse -> ()
rnf GetActionResponse' {Int
Maybe Action
httpStatus :: Int
action :: Maybe Action
$sel:httpStatus:GetActionResponse' :: GetActionResponse -> Int
$sel:action:GetActionResponse' :: GetActionResponse -> Maybe Action
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Action
action
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus