{-# 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.SSM.GetOpsItem
(
GetOpsItem (..),
newGetOpsItem,
getOpsItem_opsItemId,
GetOpsItemResponse (..),
newGetOpsItemResponse,
getOpsItemResponse_opsItem,
getOpsItemResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SSM.Types
data GetOpsItem = GetOpsItem'
{
GetOpsItem -> Text
opsItemId :: Prelude.Text
}
deriving (GetOpsItem -> GetOpsItem -> Bool
(GetOpsItem -> GetOpsItem -> Bool)
-> (GetOpsItem -> GetOpsItem -> Bool) -> Eq GetOpsItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOpsItem -> GetOpsItem -> Bool
$c/= :: GetOpsItem -> GetOpsItem -> Bool
== :: GetOpsItem -> GetOpsItem -> Bool
$c== :: GetOpsItem -> GetOpsItem -> Bool
Prelude.Eq, ReadPrec [GetOpsItem]
ReadPrec GetOpsItem
Int -> ReadS GetOpsItem
ReadS [GetOpsItem]
(Int -> ReadS GetOpsItem)
-> ReadS [GetOpsItem]
-> ReadPrec GetOpsItem
-> ReadPrec [GetOpsItem]
-> Read GetOpsItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOpsItem]
$creadListPrec :: ReadPrec [GetOpsItem]
readPrec :: ReadPrec GetOpsItem
$creadPrec :: ReadPrec GetOpsItem
readList :: ReadS [GetOpsItem]
$creadList :: ReadS [GetOpsItem]
readsPrec :: Int -> ReadS GetOpsItem
$creadsPrec :: Int -> ReadS GetOpsItem
Prelude.Read, Int -> GetOpsItem -> ShowS
[GetOpsItem] -> ShowS
GetOpsItem -> String
(Int -> GetOpsItem -> ShowS)
-> (GetOpsItem -> String)
-> ([GetOpsItem] -> ShowS)
-> Show GetOpsItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOpsItem] -> ShowS
$cshowList :: [GetOpsItem] -> ShowS
show :: GetOpsItem -> String
$cshow :: GetOpsItem -> String
showsPrec :: Int -> GetOpsItem -> ShowS
$cshowsPrec :: Int -> GetOpsItem -> ShowS
Prelude.Show, (forall x. GetOpsItem -> Rep GetOpsItem x)
-> (forall x. Rep GetOpsItem x -> GetOpsItem) -> Generic GetOpsItem
forall x. Rep GetOpsItem x -> GetOpsItem
forall x. GetOpsItem -> Rep GetOpsItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOpsItem x -> GetOpsItem
$cfrom :: forall x. GetOpsItem -> Rep GetOpsItem x
Prelude.Generic)
newGetOpsItem ::
Prelude.Text ->
GetOpsItem
newGetOpsItem :: Text -> GetOpsItem
newGetOpsItem Text
pOpsItemId_ =
GetOpsItem' :: Text -> GetOpsItem
GetOpsItem' {$sel:opsItemId:GetOpsItem' :: Text
opsItemId = Text
pOpsItemId_}
getOpsItem_opsItemId :: Lens.Lens' GetOpsItem Prelude.Text
getOpsItem_opsItemId :: (Text -> f Text) -> GetOpsItem -> f GetOpsItem
getOpsItem_opsItemId = (GetOpsItem -> Text)
-> (GetOpsItem -> Text -> GetOpsItem)
-> Lens GetOpsItem GetOpsItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsItem' {Text
opsItemId :: Text
$sel:opsItemId:GetOpsItem' :: GetOpsItem -> Text
opsItemId} -> Text
opsItemId) (\s :: GetOpsItem
s@GetOpsItem' {} Text
a -> GetOpsItem
s {$sel:opsItemId:GetOpsItem' :: Text
opsItemId = Text
a} :: GetOpsItem)
instance Core.AWSRequest GetOpsItem where
type AWSResponse GetOpsItem = GetOpsItemResponse
request :: GetOpsItem -> Request GetOpsItem
request = Service -> GetOpsItem -> Request GetOpsItem
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetOpsItem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetOpsItem)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetOpsItem))
-> Logger
-> Service
-> Proxy GetOpsItem
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetOpsItem)))
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 OpsItem -> Int -> GetOpsItemResponse
GetOpsItemResponse'
(Maybe OpsItem -> Int -> GetOpsItemResponse)
-> Either String (Maybe OpsItem)
-> Either String (Int -> GetOpsItemResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe OpsItem)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"OpsItem")
Either String (Int -> GetOpsItemResponse)
-> Either String Int -> Either String GetOpsItemResponse
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 GetOpsItem
instance Prelude.NFData GetOpsItem
instance Core.ToHeaders GetOpsItem where
toHeaders :: GetOpsItem -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetOpsItem -> 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
"AmazonSSM.GetOpsItem" :: 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 GetOpsItem where
toJSON :: GetOpsItem -> Value
toJSON GetOpsItem' {Text
opsItemId :: Text
$sel:opsItemId:GetOpsItem' :: GetOpsItem -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"OpsItemId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
opsItemId)]
)
instance Core.ToPath GetOpsItem where
toPath :: GetOpsItem -> ByteString
toPath = ByteString -> GetOpsItem -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetOpsItem where
toQuery :: GetOpsItem -> QueryString
toQuery = QueryString -> GetOpsItem -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetOpsItemResponse = GetOpsItemResponse'
{
GetOpsItemResponse -> Maybe OpsItem
opsItem :: Prelude.Maybe OpsItem,
GetOpsItemResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetOpsItemResponse -> GetOpsItemResponse -> Bool
(GetOpsItemResponse -> GetOpsItemResponse -> Bool)
-> (GetOpsItemResponse -> GetOpsItemResponse -> Bool)
-> Eq GetOpsItemResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOpsItemResponse -> GetOpsItemResponse -> Bool
$c/= :: GetOpsItemResponse -> GetOpsItemResponse -> Bool
== :: GetOpsItemResponse -> GetOpsItemResponse -> Bool
$c== :: GetOpsItemResponse -> GetOpsItemResponse -> Bool
Prelude.Eq, ReadPrec [GetOpsItemResponse]
ReadPrec GetOpsItemResponse
Int -> ReadS GetOpsItemResponse
ReadS [GetOpsItemResponse]
(Int -> ReadS GetOpsItemResponse)
-> ReadS [GetOpsItemResponse]
-> ReadPrec GetOpsItemResponse
-> ReadPrec [GetOpsItemResponse]
-> Read GetOpsItemResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOpsItemResponse]
$creadListPrec :: ReadPrec [GetOpsItemResponse]
readPrec :: ReadPrec GetOpsItemResponse
$creadPrec :: ReadPrec GetOpsItemResponse
readList :: ReadS [GetOpsItemResponse]
$creadList :: ReadS [GetOpsItemResponse]
readsPrec :: Int -> ReadS GetOpsItemResponse
$creadsPrec :: Int -> ReadS GetOpsItemResponse
Prelude.Read, Int -> GetOpsItemResponse -> ShowS
[GetOpsItemResponse] -> ShowS
GetOpsItemResponse -> String
(Int -> GetOpsItemResponse -> ShowS)
-> (GetOpsItemResponse -> String)
-> ([GetOpsItemResponse] -> ShowS)
-> Show GetOpsItemResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOpsItemResponse] -> ShowS
$cshowList :: [GetOpsItemResponse] -> ShowS
show :: GetOpsItemResponse -> String
$cshow :: GetOpsItemResponse -> String
showsPrec :: Int -> GetOpsItemResponse -> ShowS
$cshowsPrec :: Int -> GetOpsItemResponse -> ShowS
Prelude.Show, (forall x. GetOpsItemResponse -> Rep GetOpsItemResponse x)
-> (forall x. Rep GetOpsItemResponse x -> GetOpsItemResponse)
-> Generic GetOpsItemResponse
forall x. Rep GetOpsItemResponse x -> GetOpsItemResponse
forall x. GetOpsItemResponse -> Rep GetOpsItemResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOpsItemResponse x -> GetOpsItemResponse
$cfrom :: forall x. GetOpsItemResponse -> Rep GetOpsItemResponse x
Prelude.Generic)
newGetOpsItemResponse ::
Prelude.Int ->
GetOpsItemResponse
newGetOpsItemResponse :: Int -> GetOpsItemResponse
newGetOpsItemResponse Int
pHttpStatus_ =
GetOpsItemResponse' :: Maybe OpsItem -> Int -> GetOpsItemResponse
GetOpsItemResponse'
{ $sel:opsItem:GetOpsItemResponse' :: Maybe OpsItem
opsItem = Maybe OpsItem
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetOpsItemResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getOpsItemResponse_opsItem :: Lens.Lens' GetOpsItemResponse (Prelude.Maybe OpsItem)
getOpsItemResponse_opsItem :: (Maybe OpsItem -> f (Maybe OpsItem))
-> GetOpsItemResponse -> f GetOpsItemResponse
getOpsItemResponse_opsItem = (GetOpsItemResponse -> Maybe OpsItem)
-> (GetOpsItemResponse -> Maybe OpsItem -> GetOpsItemResponse)
-> Lens
GetOpsItemResponse
GetOpsItemResponse
(Maybe OpsItem)
(Maybe OpsItem)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsItemResponse' {Maybe OpsItem
opsItem :: Maybe OpsItem
$sel:opsItem:GetOpsItemResponse' :: GetOpsItemResponse -> Maybe OpsItem
opsItem} -> Maybe OpsItem
opsItem) (\s :: GetOpsItemResponse
s@GetOpsItemResponse' {} Maybe OpsItem
a -> GetOpsItemResponse
s {$sel:opsItem:GetOpsItemResponse' :: Maybe OpsItem
opsItem = Maybe OpsItem
a} :: GetOpsItemResponse)
getOpsItemResponse_httpStatus :: Lens.Lens' GetOpsItemResponse Prelude.Int
getOpsItemResponse_httpStatus :: (Int -> f Int) -> GetOpsItemResponse -> f GetOpsItemResponse
getOpsItemResponse_httpStatus = (GetOpsItemResponse -> Int)
-> (GetOpsItemResponse -> Int -> GetOpsItemResponse)
-> Lens GetOpsItemResponse GetOpsItemResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOpsItemResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetOpsItemResponse' :: GetOpsItemResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetOpsItemResponse
s@GetOpsItemResponse' {} Int
a -> GetOpsItemResponse
s {$sel:httpStatus:GetOpsItemResponse' :: Int
httpStatus = Int
a} :: GetOpsItemResponse)
instance Prelude.NFData GetOpsItemResponse