{-# 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.MigrationHub.AssociateDiscoveredResource
(
AssociateDiscoveredResource (..),
newAssociateDiscoveredResource,
associateDiscoveredResource_dryRun,
associateDiscoveredResource_progressUpdateStream,
associateDiscoveredResource_migrationTaskName,
associateDiscoveredResource_discoveredResource,
AssociateDiscoveredResourceResponse (..),
newAssociateDiscoveredResourceResponse,
associateDiscoveredResourceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MigrationHub.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssociateDiscoveredResource = AssociateDiscoveredResource'
{
AssociateDiscoveredResource -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
AssociateDiscoveredResource -> Text
progressUpdateStream :: Prelude.Text,
AssociateDiscoveredResource -> Text
migrationTaskName :: Prelude.Text,
AssociateDiscoveredResource -> DiscoveredResource
discoveredResource :: DiscoveredResource
}
deriving (AssociateDiscoveredResource -> AssociateDiscoveredResource -> Bool
(AssociateDiscoveredResource
-> AssociateDiscoveredResource -> Bool)
-> (AssociateDiscoveredResource
-> AssociateDiscoveredResource -> Bool)
-> Eq AssociateDiscoveredResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateDiscoveredResource -> AssociateDiscoveredResource -> Bool
$c/= :: AssociateDiscoveredResource -> AssociateDiscoveredResource -> Bool
== :: AssociateDiscoveredResource -> AssociateDiscoveredResource -> Bool
$c== :: AssociateDiscoveredResource -> AssociateDiscoveredResource -> Bool
Prelude.Eq, ReadPrec [AssociateDiscoveredResource]
ReadPrec AssociateDiscoveredResource
Int -> ReadS AssociateDiscoveredResource
ReadS [AssociateDiscoveredResource]
(Int -> ReadS AssociateDiscoveredResource)
-> ReadS [AssociateDiscoveredResource]
-> ReadPrec AssociateDiscoveredResource
-> ReadPrec [AssociateDiscoveredResource]
-> Read AssociateDiscoveredResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateDiscoveredResource]
$creadListPrec :: ReadPrec [AssociateDiscoveredResource]
readPrec :: ReadPrec AssociateDiscoveredResource
$creadPrec :: ReadPrec AssociateDiscoveredResource
readList :: ReadS [AssociateDiscoveredResource]
$creadList :: ReadS [AssociateDiscoveredResource]
readsPrec :: Int -> ReadS AssociateDiscoveredResource
$creadsPrec :: Int -> ReadS AssociateDiscoveredResource
Prelude.Read, Int -> AssociateDiscoveredResource -> ShowS
[AssociateDiscoveredResource] -> ShowS
AssociateDiscoveredResource -> String
(Int -> AssociateDiscoveredResource -> ShowS)
-> (AssociateDiscoveredResource -> String)
-> ([AssociateDiscoveredResource] -> ShowS)
-> Show AssociateDiscoveredResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateDiscoveredResource] -> ShowS
$cshowList :: [AssociateDiscoveredResource] -> ShowS
show :: AssociateDiscoveredResource -> String
$cshow :: AssociateDiscoveredResource -> String
showsPrec :: Int -> AssociateDiscoveredResource -> ShowS
$cshowsPrec :: Int -> AssociateDiscoveredResource -> ShowS
Prelude.Show, (forall x.
AssociateDiscoveredResource -> Rep AssociateDiscoveredResource x)
-> (forall x.
Rep AssociateDiscoveredResource x -> AssociateDiscoveredResource)
-> Generic AssociateDiscoveredResource
forall x.
Rep AssociateDiscoveredResource x -> AssociateDiscoveredResource
forall x.
AssociateDiscoveredResource -> Rep AssociateDiscoveredResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateDiscoveredResource x -> AssociateDiscoveredResource
$cfrom :: forall x.
AssociateDiscoveredResource -> Rep AssociateDiscoveredResource x
Prelude.Generic)
newAssociateDiscoveredResource ::
Prelude.Text ->
Prelude.Text ->
DiscoveredResource ->
AssociateDiscoveredResource
newAssociateDiscoveredResource :: Text -> Text -> DiscoveredResource -> AssociateDiscoveredResource
newAssociateDiscoveredResource
Text
pProgressUpdateStream_
Text
pMigrationTaskName_
DiscoveredResource
pDiscoveredResource_ =
AssociateDiscoveredResource' :: Maybe Bool
-> Text
-> Text
-> DiscoveredResource
-> AssociateDiscoveredResource
AssociateDiscoveredResource'
{ $sel:dryRun:AssociateDiscoveredResource' :: Maybe Bool
dryRun =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:progressUpdateStream:AssociateDiscoveredResource' :: Text
progressUpdateStream = Text
pProgressUpdateStream_,
$sel:migrationTaskName:AssociateDiscoveredResource' :: Text
migrationTaskName = Text
pMigrationTaskName_,
$sel:discoveredResource:AssociateDiscoveredResource' :: DiscoveredResource
discoveredResource = DiscoveredResource
pDiscoveredResource_
}
associateDiscoveredResource_dryRun :: Lens.Lens' AssociateDiscoveredResource (Prelude.Maybe Prelude.Bool)
associateDiscoveredResource_dryRun :: (Maybe Bool -> f (Maybe Bool))
-> AssociateDiscoveredResource -> f AssociateDiscoveredResource
associateDiscoveredResource_dryRun = (AssociateDiscoveredResource -> Maybe Bool)
-> (AssociateDiscoveredResource
-> Maybe Bool -> AssociateDiscoveredResource)
-> Lens
AssociateDiscoveredResource
AssociateDiscoveredResource
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDiscoveredResource' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:AssociateDiscoveredResource' :: AssociateDiscoveredResource -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: AssociateDiscoveredResource
s@AssociateDiscoveredResource' {} Maybe Bool
a -> AssociateDiscoveredResource
s {$sel:dryRun:AssociateDiscoveredResource' :: Maybe Bool
dryRun = Maybe Bool
a} :: AssociateDiscoveredResource)
associateDiscoveredResource_progressUpdateStream :: Lens.Lens' AssociateDiscoveredResource Prelude.Text
associateDiscoveredResource_progressUpdateStream :: (Text -> f Text)
-> AssociateDiscoveredResource -> f AssociateDiscoveredResource
associateDiscoveredResource_progressUpdateStream = (AssociateDiscoveredResource -> Text)
-> (AssociateDiscoveredResource
-> Text -> AssociateDiscoveredResource)
-> Lens
AssociateDiscoveredResource AssociateDiscoveredResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDiscoveredResource' {Text
progressUpdateStream :: Text
$sel:progressUpdateStream:AssociateDiscoveredResource' :: AssociateDiscoveredResource -> Text
progressUpdateStream} -> Text
progressUpdateStream) (\s :: AssociateDiscoveredResource
s@AssociateDiscoveredResource' {} Text
a -> AssociateDiscoveredResource
s {$sel:progressUpdateStream:AssociateDiscoveredResource' :: Text
progressUpdateStream = Text
a} :: AssociateDiscoveredResource)
associateDiscoveredResource_migrationTaskName :: Lens.Lens' AssociateDiscoveredResource Prelude.Text
associateDiscoveredResource_migrationTaskName :: (Text -> f Text)
-> AssociateDiscoveredResource -> f AssociateDiscoveredResource
associateDiscoveredResource_migrationTaskName = (AssociateDiscoveredResource -> Text)
-> (AssociateDiscoveredResource
-> Text -> AssociateDiscoveredResource)
-> Lens
AssociateDiscoveredResource AssociateDiscoveredResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDiscoveredResource' {Text
migrationTaskName :: Text
$sel:migrationTaskName:AssociateDiscoveredResource' :: AssociateDiscoveredResource -> Text
migrationTaskName} -> Text
migrationTaskName) (\s :: AssociateDiscoveredResource
s@AssociateDiscoveredResource' {} Text
a -> AssociateDiscoveredResource
s {$sel:migrationTaskName:AssociateDiscoveredResource' :: Text
migrationTaskName = Text
a} :: AssociateDiscoveredResource)
associateDiscoveredResource_discoveredResource :: Lens.Lens' AssociateDiscoveredResource DiscoveredResource
associateDiscoveredResource_discoveredResource :: (DiscoveredResource -> f DiscoveredResource)
-> AssociateDiscoveredResource -> f AssociateDiscoveredResource
associateDiscoveredResource_discoveredResource = (AssociateDiscoveredResource -> DiscoveredResource)
-> (AssociateDiscoveredResource
-> DiscoveredResource -> AssociateDiscoveredResource)
-> Lens
AssociateDiscoveredResource
AssociateDiscoveredResource
DiscoveredResource
DiscoveredResource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDiscoveredResource' {DiscoveredResource
discoveredResource :: DiscoveredResource
$sel:discoveredResource:AssociateDiscoveredResource' :: AssociateDiscoveredResource -> DiscoveredResource
discoveredResource} -> DiscoveredResource
discoveredResource) (\s :: AssociateDiscoveredResource
s@AssociateDiscoveredResource' {} DiscoveredResource
a -> AssociateDiscoveredResource
s {$sel:discoveredResource:AssociateDiscoveredResource' :: DiscoveredResource
discoveredResource = DiscoveredResource
a} :: AssociateDiscoveredResource)
instance Core.AWSRequest AssociateDiscoveredResource where
type
AWSResponse AssociateDiscoveredResource =
AssociateDiscoveredResourceResponse
request :: AssociateDiscoveredResource -> Request AssociateDiscoveredResource
request = Service
-> AssociateDiscoveredResource
-> Request AssociateDiscoveredResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateDiscoveredResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateDiscoveredResource)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AssociateDiscoveredResource))
-> Logger
-> Service
-> Proxy AssociateDiscoveredResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateDiscoveredResource)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AssociateDiscoveredResourceResponse
AssociateDiscoveredResourceResponse'
(Int -> AssociateDiscoveredResourceResponse)
-> Either String Int
-> Either String AssociateDiscoveredResourceResponse
forall (f :: * -> *) a b. Functor 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 AssociateDiscoveredResource
instance Prelude.NFData AssociateDiscoveredResource
instance Core.ToHeaders AssociateDiscoveredResource where
toHeaders :: AssociateDiscoveredResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateDiscoveredResource -> 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
"AWSMigrationHub.AssociateDiscoveredResource" ::
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 AssociateDiscoveredResource where
toJSON :: AssociateDiscoveredResource -> Value
toJSON AssociateDiscoveredResource' {Maybe Bool
Text
DiscoveredResource
discoveredResource :: DiscoveredResource
migrationTaskName :: Text
progressUpdateStream :: Text
dryRun :: Maybe Bool
$sel:discoveredResource:AssociateDiscoveredResource' :: AssociateDiscoveredResource -> DiscoveredResource
$sel:migrationTaskName:AssociateDiscoveredResource' :: AssociateDiscoveredResource -> Text
$sel:progressUpdateStream:AssociateDiscoveredResource' :: AssociateDiscoveredResource -> Text
$sel:dryRun:AssociateDiscoveredResource' :: AssociateDiscoveredResource -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DryRun" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
dryRun,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"ProgressUpdateStream"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
progressUpdateStream
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"MigrationTaskName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
migrationTaskName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DiscoveredResource" Text -> DiscoveredResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DiscoveredResource
discoveredResource)
]
)
instance Core.ToPath AssociateDiscoveredResource where
toPath :: AssociateDiscoveredResource -> ByteString
toPath = ByteString -> AssociateDiscoveredResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateDiscoveredResource where
toQuery :: AssociateDiscoveredResource -> QueryString
toQuery = QueryString -> AssociateDiscoveredResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateDiscoveredResourceResponse = AssociateDiscoveredResourceResponse'
{
AssociateDiscoveredResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateDiscoveredResourceResponse
-> AssociateDiscoveredResourceResponse -> Bool
(AssociateDiscoveredResourceResponse
-> AssociateDiscoveredResourceResponse -> Bool)
-> (AssociateDiscoveredResourceResponse
-> AssociateDiscoveredResourceResponse -> Bool)
-> Eq AssociateDiscoveredResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateDiscoveredResourceResponse
-> AssociateDiscoveredResourceResponse -> Bool
$c/= :: AssociateDiscoveredResourceResponse
-> AssociateDiscoveredResourceResponse -> Bool
== :: AssociateDiscoveredResourceResponse
-> AssociateDiscoveredResourceResponse -> Bool
$c== :: AssociateDiscoveredResourceResponse
-> AssociateDiscoveredResourceResponse -> Bool
Prelude.Eq, ReadPrec [AssociateDiscoveredResourceResponse]
ReadPrec AssociateDiscoveredResourceResponse
Int -> ReadS AssociateDiscoveredResourceResponse
ReadS [AssociateDiscoveredResourceResponse]
(Int -> ReadS AssociateDiscoveredResourceResponse)
-> ReadS [AssociateDiscoveredResourceResponse]
-> ReadPrec AssociateDiscoveredResourceResponse
-> ReadPrec [AssociateDiscoveredResourceResponse]
-> Read AssociateDiscoveredResourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateDiscoveredResourceResponse]
$creadListPrec :: ReadPrec [AssociateDiscoveredResourceResponse]
readPrec :: ReadPrec AssociateDiscoveredResourceResponse
$creadPrec :: ReadPrec AssociateDiscoveredResourceResponse
readList :: ReadS [AssociateDiscoveredResourceResponse]
$creadList :: ReadS [AssociateDiscoveredResourceResponse]
readsPrec :: Int -> ReadS AssociateDiscoveredResourceResponse
$creadsPrec :: Int -> ReadS AssociateDiscoveredResourceResponse
Prelude.Read, Int -> AssociateDiscoveredResourceResponse -> ShowS
[AssociateDiscoveredResourceResponse] -> ShowS
AssociateDiscoveredResourceResponse -> String
(Int -> AssociateDiscoveredResourceResponse -> ShowS)
-> (AssociateDiscoveredResourceResponse -> String)
-> ([AssociateDiscoveredResourceResponse] -> ShowS)
-> Show AssociateDiscoveredResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateDiscoveredResourceResponse] -> ShowS
$cshowList :: [AssociateDiscoveredResourceResponse] -> ShowS
show :: AssociateDiscoveredResourceResponse -> String
$cshow :: AssociateDiscoveredResourceResponse -> String
showsPrec :: Int -> AssociateDiscoveredResourceResponse -> ShowS
$cshowsPrec :: Int -> AssociateDiscoveredResourceResponse -> ShowS
Prelude.Show, (forall x.
AssociateDiscoveredResourceResponse
-> Rep AssociateDiscoveredResourceResponse x)
-> (forall x.
Rep AssociateDiscoveredResourceResponse x
-> AssociateDiscoveredResourceResponse)
-> Generic AssociateDiscoveredResourceResponse
forall x.
Rep AssociateDiscoveredResourceResponse x
-> AssociateDiscoveredResourceResponse
forall x.
AssociateDiscoveredResourceResponse
-> Rep AssociateDiscoveredResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateDiscoveredResourceResponse x
-> AssociateDiscoveredResourceResponse
$cfrom :: forall x.
AssociateDiscoveredResourceResponse
-> Rep AssociateDiscoveredResourceResponse x
Prelude.Generic)
newAssociateDiscoveredResourceResponse ::
Prelude.Int ->
AssociateDiscoveredResourceResponse
newAssociateDiscoveredResourceResponse :: Int -> AssociateDiscoveredResourceResponse
newAssociateDiscoveredResourceResponse Int
pHttpStatus_ =
AssociateDiscoveredResourceResponse' :: Int -> AssociateDiscoveredResourceResponse
AssociateDiscoveredResourceResponse'
{ $sel:httpStatus:AssociateDiscoveredResourceResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
associateDiscoveredResourceResponse_httpStatus :: Lens.Lens' AssociateDiscoveredResourceResponse Prelude.Int
associateDiscoveredResourceResponse_httpStatus :: (Int -> f Int)
-> AssociateDiscoveredResourceResponse
-> f AssociateDiscoveredResourceResponse
associateDiscoveredResourceResponse_httpStatus = (AssociateDiscoveredResourceResponse -> Int)
-> (AssociateDiscoveredResourceResponse
-> Int -> AssociateDiscoveredResourceResponse)
-> Lens
AssociateDiscoveredResourceResponse
AssociateDiscoveredResourceResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateDiscoveredResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateDiscoveredResourceResponse' :: AssociateDiscoveredResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateDiscoveredResourceResponse
s@AssociateDiscoveredResourceResponse' {} Int
a -> AssociateDiscoveredResourceResponse
s {$sel:httpStatus:AssociateDiscoveredResourceResponse' :: Int
httpStatus = Int
a} :: AssociateDiscoveredResourceResponse)
instance
Prelude.NFData
AssociateDiscoveredResourceResponse