{-# 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.Discovery.StartImportTask
(
StartImportTask (..),
newStartImportTask,
startImportTask_clientRequestToken,
startImportTask_name,
startImportTask_importUrl,
StartImportTaskResponse (..),
newStartImportTaskResponse,
startImportTaskResponse_task,
startImportTaskResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Discovery.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 StartImportTask = StartImportTask'
{
StartImportTask -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
StartImportTask -> Text
name :: Prelude.Text,
StartImportTask -> Text
importUrl :: Prelude.Text
}
deriving (StartImportTask -> StartImportTask -> Bool
(StartImportTask -> StartImportTask -> Bool)
-> (StartImportTask -> StartImportTask -> Bool)
-> Eq StartImportTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartImportTask -> StartImportTask -> Bool
$c/= :: StartImportTask -> StartImportTask -> Bool
== :: StartImportTask -> StartImportTask -> Bool
$c== :: StartImportTask -> StartImportTask -> Bool
Prelude.Eq, ReadPrec [StartImportTask]
ReadPrec StartImportTask
Int -> ReadS StartImportTask
ReadS [StartImportTask]
(Int -> ReadS StartImportTask)
-> ReadS [StartImportTask]
-> ReadPrec StartImportTask
-> ReadPrec [StartImportTask]
-> Read StartImportTask
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartImportTask]
$creadListPrec :: ReadPrec [StartImportTask]
readPrec :: ReadPrec StartImportTask
$creadPrec :: ReadPrec StartImportTask
readList :: ReadS [StartImportTask]
$creadList :: ReadS [StartImportTask]
readsPrec :: Int -> ReadS StartImportTask
$creadsPrec :: Int -> ReadS StartImportTask
Prelude.Read, Int -> StartImportTask -> ShowS
[StartImportTask] -> ShowS
StartImportTask -> String
(Int -> StartImportTask -> ShowS)
-> (StartImportTask -> String)
-> ([StartImportTask] -> ShowS)
-> Show StartImportTask
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartImportTask] -> ShowS
$cshowList :: [StartImportTask] -> ShowS
show :: StartImportTask -> String
$cshow :: StartImportTask -> String
showsPrec :: Int -> StartImportTask -> ShowS
$cshowsPrec :: Int -> StartImportTask -> ShowS
Prelude.Show, (forall x. StartImportTask -> Rep StartImportTask x)
-> (forall x. Rep StartImportTask x -> StartImportTask)
-> Generic StartImportTask
forall x. Rep StartImportTask x -> StartImportTask
forall x. StartImportTask -> Rep StartImportTask x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartImportTask x -> StartImportTask
$cfrom :: forall x. StartImportTask -> Rep StartImportTask x
Prelude.Generic)
newStartImportTask ::
Prelude.Text ->
Prelude.Text ->
StartImportTask
newStartImportTask :: Text -> Text -> StartImportTask
newStartImportTask Text
pName_ Text
pImportUrl_ =
StartImportTask' :: Maybe Text -> Text -> Text -> StartImportTask
StartImportTask'
{ $sel:clientRequestToken:StartImportTask' :: Maybe Text
clientRequestToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:StartImportTask' :: Text
name = Text
pName_,
$sel:importUrl:StartImportTask' :: Text
importUrl = Text
pImportUrl_
}
startImportTask_clientRequestToken :: Lens.Lens' StartImportTask (Prelude.Maybe Prelude.Text)
startImportTask_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartImportTask -> f StartImportTask
startImportTask_clientRequestToken = (StartImportTask -> Maybe Text)
-> (StartImportTask -> Maybe Text -> StartImportTask)
-> Lens StartImportTask StartImportTask (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportTask' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartImportTask' :: StartImportTask -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartImportTask
s@StartImportTask' {} Maybe Text
a -> StartImportTask
s {$sel:clientRequestToken:StartImportTask' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartImportTask)
startImportTask_name :: Lens.Lens' StartImportTask Prelude.Text
startImportTask_name :: (Text -> f Text) -> StartImportTask -> f StartImportTask
startImportTask_name = (StartImportTask -> Text)
-> (StartImportTask -> Text -> StartImportTask)
-> Lens StartImportTask StartImportTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportTask' {Text
name :: Text
$sel:name:StartImportTask' :: StartImportTask -> Text
name} -> Text
name) (\s :: StartImportTask
s@StartImportTask' {} Text
a -> StartImportTask
s {$sel:name:StartImportTask' :: Text
name = Text
a} :: StartImportTask)
startImportTask_importUrl :: Lens.Lens' StartImportTask Prelude.Text
startImportTask_importUrl :: (Text -> f Text) -> StartImportTask -> f StartImportTask
startImportTask_importUrl = (StartImportTask -> Text)
-> (StartImportTask -> Text -> StartImportTask)
-> Lens StartImportTask StartImportTask Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportTask' {Text
importUrl :: Text
$sel:importUrl:StartImportTask' :: StartImportTask -> Text
importUrl} -> Text
importUrl) (\s :: StartImportTask
s@StartImportTask' {} Text
a -> StartImportTask
s {$sel:importUrl:StartImportTask' :: Text
importUrl = Text
a} :: StartImportTask)
instance Core.AWSRequest StartImportTask where
type
AWSResponse StartImportTask =
StartImportTaskResponse
request :: StartImportTask -> Request StartImportTask
request = Service -> StartImportTask -> Request StartImportTask
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartImportTask
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartImportTask)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartImportTask))
-> Logger
-> Service
-> Proxy StartImportTask
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartImportTask)))
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 ImportTask -> Int -> StartImportTaskResponse
StartImportTaskResponse'
(Maybe ImportTask -> Int -> StartImportTaskResponse)
-> Either String (Maybe ImportTask)
-> Either String (Int -> StartImportTaskResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ImportTask)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"task")
Either String (Int -> StartImportTaskResponse)
-> Either String Int -> Either String StartImportTaskResponse
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 StartImportTask
instance Prelude.NFData StartImportTask
instance Core.ToHeaders StartImportTask where
toHeaders :: StartImportTask -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartImportTask -> 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
"AWSPoseidonService_V2015_11_01.StartImportTask" ::
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 StartImportTask where
toJSON :: StartImportTask -> Value
toJSON StartImportTask' {Maybe Text
Text
importUrl :: Text
name :: Text
clientRequestToken :: Maybe Text
$sel:importUrl:StartImportTask' :: StartImportTask -> Text
$sel:name:StartImportTask' :: StartImportTask -> Text
$sel:clientRequestToken:StartImportTask' :: StartImportTask -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientRequestToken,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"importUrl" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
importUrl)
]
)
instance Core.ToPath StartImportTask where
toPath :: StartImportTask -> ByteString
toPath = ByteString -> StartImportTask -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartImportTask where
toQuery :: StartImportTask -> QueryString
toQuery = QueryString -> StartImportTask -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartImportTaskResponse = StartImportTaskResponse'
{
StartImportTaskResponse -> Maybe ImportTask
task :: Prelude.Maybe ImportTask,
StartImportTaskResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartImportTaskResponse -> StartImportTaskResponse -> Bool
(StartImportTaskResponse -> StartImportTaskResponse -> Bool)
-> (StartImportTaskResponse -> StartImportTaskResponse -> Bool)
-> Eq StartImportTaskResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartImportTaskResponse -> StartImportTaskResponse -> Bool
$c/= :: StartImportTaskResponse -> StartImportTaskResponse -> Bool
== :: StartImportTaskResponse -> StartImportTaskResponse -> Bool
$c== :: StartImportTaskResponse -> StartImportTaskResponse -> Bool
Prelude.Eq, ReadPrec [StartImportTaskResponse]
ReadPrec StartImportTaskResponse
Int -> ReadS StartImportTaskResponse
ReadS [StartImportTaskResponse]
(Int -> ReadS StartImportTaskResponse)
-> ReadS [StartImportTaskResponse]
-> ReadPrec StartImportTaskResponse
-> ReadPrec [StartImportTaskResponse]
-> Read StartImportTaskResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartImportTaskResponse]
$creadListPrec :: ReadPrec [StartImportTaskResponse]
readPrec :: ReadPrec StartImportTaskResponse
$creadPrec :: ReadPrec StartImportTaskResponse
readList :: ReadS [StartImportTaskResponse]
$creadList :: ReadS [StartImportTaskResponse]
readsPrec :: Int -> ReadS StartImportTaskResponse
$creadsPrec :: Int -> ReadS StartImportTaskResponse
Prelude.Read, Int -> StartImportTaskResponse -> ShowS
[StartImportTaskResponse] -> ShowS
StartImportTaskResponse -> String
(Int -> StartImportTaskResponse -> ShowS)
-> (StartImportTaskResponse -> String)
-> ([StartImportTaskResponse] -> ShowS)
-> Show StartImportTaskResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartImportTaskResponse] -> ShowS
$cshowList :: [StartImportTaskResponse] -> ShowS
show :: StartImportTaskResponse -> String
$cshow :: StartImportTaskResponse -> String
showsPrec :: Int -> StartImportTaskResponse -> ShowS
$cshowsPrec :: Int -> StartImportTaskResponse -> ShowS
Prelude.Show, (forall x.
StartImportTaskResponse -> Rep StartImportTaskResponse x)
-> (forall x.
Rep StartImportTaskResponse x -> StartImportTaskResponse)
-> Generic StartImportTaskResponse
forall x. Rep StartImportTaskResponse x -> StartImportTaskResponse
forall x. StartImportTaskResponse -> Rep StartImportTaskResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartImportTaskResponse x -> StartImportTaskResponse
$cfrom :: forall x. StartImportTaskResponse -> Rep StartImportTaskResponse x
Prelude.Generic)
newStartImportTaskResponse ::
Prelude.Int ->
StartImportTaskResponse
newStartImportTaskResponse :: Int -> StartImportTaskResponse
newStartImportTaskResponse Int
pHttpStatus_ =
StartImportTaskResponse' :: Maybe ImportTask -> Int -> StartImportTaskResponse
StartImportTaskResponse'
{ $sel:task:StartImportTaskResponse' :: Maybe ImportTask
task = Maybe ImportTask
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartImportTaskResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startImportTaskResponse_task :: Lens.Lens' StartImportTaskResponse (Prelude.Maybe ImportTask)
startImportTaskResponse_task :: (Maybe ImportTask -> f (Maybe ImportTask))
-> StartImportTaskResponse -> f StartImportTaskResponse
startImportTaskResponse_task = (StartImportTaskResponse -> Maybe ImportTask)
-> (StartImportTaskResponse
-> Maybe ImportTask -> StartImportTaskResponse)
-> Lens
StartImportTaskResponse
StartImportTaskResponse
(Maybe ImportTask)
(Maybe ImportTask)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportTaskResponse' {Maybe ImportTask
task :: Maybe ImportTask
$sel:task:StartImportTaskResponse' :: StartImportTaskResponse -> Maybe ImportTask
task} -> Maybe ImportTask
task) (\s :: StartImportTaskResponse
s@StartImportTaskResponse' {} Maybe ImportTask
a -> StartImportTaskResponse
s {$sel:task:StartImportTaskResponse' :: Maybe ImportTask
task = Maybe ImportTask
a} :: StartImportTaskResponse)
startImportTaskResponse_httpStatus :: Lens.Lens' StartImportTaskResponse Prelude.Int
startImportTaskResponse_httpStatus :: (Int -> f Int)
-> StartImportTaskResponse -> f StartImportTaskResponse
startImportTaskResponse_httpStatus = (StartImportTaskResponse -> Int)
-> (StartImportTaskResponse -> Int -> StartImportTaskResponse)
-> Lens StartImportTaskResponse StartImportTaskResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartImportTaskResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartImportTaskResponse' :: StartImportTaskResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartImportTaskResponse
s@StartImportTaskResponse' {} Int
a -> StartImportTaskResponse
s {$sel:httpStatus:StartImportTaskResponse' :: Int
httpStatus = Int
a} :: StartImportTaskResponse)
instance Prelude.NFData StartImportTaskResponse