{-# 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.MigrationHubOrchestrator.GetTemplate
(
GetTemplate (..),
newGetTemplate,
getTemplate_id,
GetTemplateResponse (..),
newGetTemplateResponse,
getTemplateResponse_creationTime,
getTemplateResponse_description,
getTemplateResponse_id,
getTemplateResponse_inputs,
getTemplateResponse_name,
getTemplateResponse_status,
getTemplateResponse_tools,
getTemplateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubOrchestrator.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetTemplate = GetTemplate'
{
GetTemplate -> Text
id :: Prelude.Text
}
deriving (GetTemplate -> GetTemplate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTemplate -> GetTemplate -> Bool
$c/= :: GetTemplate -> GetTemplate -> Bool
== :: GetTemplate -> GetTemplate -> Bool
$c== :: GetTemplate -> GetTemplate -> Bool
Prelude.Eq, ReadPrec [GetTemplate]
ReadPrec GetTemplate
Int -> ReadS GetTemplate
ReadS [GetTemplate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTemplate]
$creadListPrec :: ReadPrec [GetTemplate]
readPrec :: ReadPrec GetTemplate
$creadPrec :: ReadPrec GetTemplate
readList :: ReadS [GetTemplate]
$creadList :: ReadS [GetTemplate]
readsPrec :: Int -> ReadS GetTemplate
$creadsPrec :: Int -> ReadS GetTemplate
Prelude.Read, Int -> GetTemplate -> ShowS
[GetTemplate] -> ShowS
GetTemplate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTemplate] -> ShowS
$cshowList :: [GetTemplate] -> ShowS
show :: GetTemplate -> String
$cshow :: GetTemplate -> String
showsPrec :: Int -> GetTemplate -> ShowS
$cshowsPrec :: Int -> GetTemplate -> ShowS
Prelude.Show, forall x. Rep GetTemplate x -> GetTemplate
forall x. GetTemplate -> Rep GetTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTemplate x -> GetTemplate
$cfrom :: forall x. GetTemplate -> Rep GetTemplate x
Prelude.Generic)
newGetTemplate ::
Prelude.Text ->
GetTemplate
newGetTemplate :: Text -> GetTemplate
newGetTemplate Text
pId_ = GetTemplate' {$sel:id:GetTemplate' :: Text
id = Text
pId_}
getTemplate_id :: Lens.Lens' GetTemplate Prelude.Text
getTemplate_id :: Lens' GetTemplate Text
getTemplate_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplate' {Text
id :: Text
$sel:id:GetTemplate' :: GetTemplate -> Text
id} -> Text
id) (\s :: GetTemplate
s@GetTemplate' {} Text
a -> GetTemplate
s {$sel:id:GetTemplate' :: Text
id = Text
a} :: GetTemplate)
instance Core.AWSRequest GetTemplate where
type AWSResponse GetTemplate = GetTemplateResponse
request :: (Service -> Service) -> GetTemplate -> Request GetTemplate
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 GetTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTemplate)))
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 POSIX
-> Maybe Text
-> Maybe Text
-> Maybe [TemplateInput]
-> Maybe Text
-> Maybe TemplateStatus
-> Maybe [Tool]
-> Int
-> GetTemplateResponse
GetTemplateResponse'
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
"creationTime")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"description")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"inputs" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"status")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"tools" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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 GetTemplate where
hashWithSalt :: Int -> GetTemplate -> Int
hashWithSalt Int
_salt GetTemplate' {Text
id :: Text
$sel:id:GetTemplate' :: GetTemplate -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetTemplate where
rnf :: GetTemplate -> ()
rnf GetTemplate' {Text
id :: Text
$sel:id:GetTemplate' :: GetTemplate -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetTemplate where
toHeaders :: GetTemplate -> 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 GetTemplate where
toPath :: GetTemplate -> ByteString
toPath GetTemplate' {Text
id :: Text
$sel:id:GetTemplate' :: GetTemplate -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/migrationworkflowtemplate/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]
instance Data.ToQuery GetTemplate where
toQuery :: GetTemplate -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetTemplateResponse = GetTemplateResponse'
{
GetTemplateResponse -> Maybe POSIX
creationTime :: Prelude.Maybe Data.POSIX,
GetTemplateResponse -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
GetTemplateResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
GetTemplateResponse -> Maybe [TemplateInput]
inputs :: Prelude.Maybe [TemplateInput],
GetTemplateResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
GetTemplateResponse -> Maybe TemplateStatus
status :: Prelude.Maybe TemplateStatus,
GetTemplateResponse -> Maybe [Tool]
tools :: Prelude.Maybe [Tool],
GetTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTemplateResponse -> GetTemplateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTemplateResponse -> GetTemplateResponse -> Bool
$c/= :: GetTemplateResponse -> GetTemplateResponse -> Bool
== :: GetTemplateResponse -> GetTemplateResponse -> Bool
$c== :: GetTemplateResponse -> GetTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetTemplateResponse]
ReadPrec GetTemplateResponse
Int -> ReadS GetTemplateResponse
ReadS [GetTemplateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTemplateResponse]
$creadListPrec :: ReadPrec [GetTemplateResponse]
readPrec :: ReadPrec GetTemplateResponse
$creadPrec :: ReadPrec GetTemplateResponse
readList :: ReadS [GetTemplateResponse]
$creadList :: ReadS [GetTemplateResponse]
readsPrec :: Int -> ReadS GetTemplateResponse
$creadsPrec :: Int -> ReadS GetTemplateResponse
Prelude.Read, Int -> GetTemplateResponse -> ShowS
[GetTemplateResponse] -> ShowS
GetTemplateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTemplateResponse] -> ShowS
$cshowList :: [GetTemplateResponse] -> ShowS
show :: GetTemplateResponse -> String
$cshow :: GetTemplateResponse -> String
showsPrec :: Int -> GetTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetTemplateResponse -> ShowS
Prelude.Show, forall x. Rep GetTemplateResponse x -> GetTemplateResponse
forall x. GetTemplateResponse -> Rep GetTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTemplateResponse x -> GetTemplateResponse
$cfrom :: forall x. GetTemplateResponse -> Rep GetTemplateResponse x
Prelude.Generic)
newGetTemplateResponse ::
Prelude.Int ->
GetTemplateResponse
newGetTemplateResponse :: Int -> GetTemplateResponse
newGetTemplateResponse Int
pHttpStatus_ =
GetTemplateResponse'
{ $sel:creationTime:GetTemplateResponse' :: Maybe POSIX
creationTime =
forall a. Maybe a
Prelude.Nothing,
$sel:description:GetTemplateResponse' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:id:GetTemplateResponse' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
$sel:inputs:GetTemplateResponse' :: Maybe [TemplateInput]
inputs = forall a. Maybe a
Prelude.Nothing,
$sel:name:GetTemplateResponse' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:status:GetTemplateResponse' :: Maybe TemplateStatus
status = forall a. Maybe a
Prelude.Nothing,
$sel:tools:GetTemplateResponse' :: Maybe [Tool]
tools = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTemplateResponse_creationTime :: Lens.Lens' GetTemplateResponse (Prelude.Maybe Prelude.UTCTime)
getTemplateResponse_creationTime :: Lens' GetTemplateResponse (Maybe UTCTime)
getTemplateResponse_creationTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe POSIX
creationTime :: Maybe POSIX
$sel:creationTime:GetTemplateResponse' :: GetTemplateResponse -> Maybe POSIX
creationTime} -> Maybe POSIX
creationTime) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe POSIX
a -> GetTemplateResponse
s {$sel:creationTime:GetTemplateResponse' :: Maybe POSIX
creationTime = Maybe POSIX
a} :: GetTemplateResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
getTemplateResponse_description :: Lens.Lens' GetTemplateResponse (Prelude.Maybe Prelude.Text)
getTemplateResponse_description :: Lens' GetTemplateResponse (Maybe Text)
getTemplateResponse_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe Text
description :: Maybe Text
$sel:description:GetTemplateResponse' :: GetTemplateResponse -> Maybe Text
description} -> Maybe Text
description) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe Text
a -> GetTemplateResponse
s {$sel:description:GetTemplateResponse' :: Maybe Text
description = Maybe Text
a} :: GetTemplateResponse)
getTemplateResponse_id :: Lens.Lens' GetTemplateResponse (Prelude.Maybe Prelude.Text)
getTemplateResponse_id :: Lens' GetTemplateResponse (Maybe Text)
getTemplateResponse_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe Text
id :: Maybe Text
$sel:id:GetTemplateResponse' :: GetTemplateResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe Text
a -> GetTemplateResponse
s {$sel:id:GetTemplateResponse' :: Maybe Text
id = Maybe Text
a} :: GetTemplateResponse)
getTemplateResponse_inputs :: Lens.Lens' GetTemplateResponse (Prelude.Maybe [TemplateInput])
getTemplateResponse_inputs :: Lens' GetTemplateResponse (Maybe [TemplateInput])
getTemplateResponse_inputs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe [TemplateInput]
inputs :: Maybe [TemplateInput]
$sel:inputs:GetTemplateResponse' :: GetTemplateResponse -> Maybe [TemplateInput]
inputs} -> Maybe [TemplateInput]
inputs) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe [TemplateInput]
a -> GetTemplateResponse
s {$sel:inputs:GetTemplateResponse' :: Maybe [TemplateInput]
inputs = Maybe [TemplateInput]
a} :: GetTemplateResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getTemplateResponse_name :: Lens.Lens' GetTemplateResponse (Prelude.Maybe Prelude.Text)
getTemplateResponse_name :: Lens' GetTemplateResponse (Maybe Text)
getTemplateResponse_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe Text
name :: Maybe Text
$sel:name:GetTemplateResponse' :: GetTemplateResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe Text
a -> GetTemplateResponse
s {$sel:name:GetTemplateResponse' :: Maybe Text
name = Maybe Text
a} :: GetTemplateResponse)
getTemplateResponse_status :: Lens.Lens' GetTemplateResponse (Prelude.Maybe TemplateStatus)
getTemplateResponse_status :: Lens' GetTemplateResponse (Maybe TemplateStatus)
getTemplateResponse_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe TemplateStatus
status :: Maybe TemplateStatus
$sel:status:GetTemplateResponse' :: GetTemplateResponse -> Maybe TemplateStatus
status} -> Maybe TemplateStatus
status) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe TemplateStatus
a -> GetTemplateResponse
s {$sel:status:GetTemplateResponse' :: Maybe TemplateStatus
status = Maybe TemplateStatus
a} :: GetTemplateResponse)
getTemplateResponse_tools :: Lens.Lens' GetTemplateResponse (Prelude.Maybe [Tool])
getTemplateResponse_tools :: Lens' GetTemplateResponse (Maybe [Tool])
getTemplateResponse_tools = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe [Tool]
tools :: Maybe [Tool]
$sel:tools:GetTemplateResponse' :: GetTemplateResponse -> Maybe [Tool]
tools} -> Maybe [Tool]
tools) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe [Tool]
a -> GetTemplateResponse
s {$sel:tools:GetTemplateResponse' :: Maybe [Tool]
tools = Maybe [Tool]
a} :: GetTemplateResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getTemplateResponse_httpStatus :: Lens.Lens' GetTemplateResponse Prelude.Int
getTemplateResponse_httpStatus :: Lens' GetTemplateResponse Int
getTemplateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTemplateResponse' :: GetTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Int
a -> GetTemplateResponse
s {$sel:httpStatus:GetTemplateResponse' :: Int
httpStatus = Int
a} :: GetTemplateResponse)
instance Prelude.NFData GetTemplateResponse where
rnf :: GetTemplateResponse -> ()
rnf GetTemplateResponse' {Int
Maybe [TemplateInput]
Maybe [Tool]
Maybe Text
Maybe POSIX
Maybe TemplateStatus
httpStatus :: Int
tools :: Maybe [Tool]
status :: Maybe TemplateStatus
name :: Maybe Text
inputs :: Maybe [TemplateInput]
id :: Maybe Text
description :: Maybe Text
creationTime :: Maybe POSIX
$sel:httpStatus:GetTemplateResponse' :: GetTemplateResponse -> Int
$sel:tools:GetTemplateResponse' :: GetTemplateResponse -> Maybe [Tool]
$sel:status:GetTemplateResponse' :: GetTemplateResponse -> Maybe TemplateStatus
$sel:name:GetTemplateResponse' :: GetTemplateResponse -> Maybe Text
$sel:inputs:GetTemplateResponse' :: GetTemplateResponse -> Maybe [TemplateInput]
$sel:id:GetTemplateResponse' :: GetTemplateResponse -> Maybe Text
$sel:description:GetTemplateResponse' :: GetTemplateResponse -> Maybe Text
$sel:creationTime:GetTemplateResponse' :: GetTemplateResponse -> Maybe POSIX
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TemplateInput]
inputs
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TemplateStatus
status
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tool]
tools
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus