{-# 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.WorkSpaces.MigrateWorkspace
(
MigrateWorkspace (..),
newMigrateWorkspace,
migrateWorkspace_sourceWorkspaceId,
migrateWorkspace_bundleId,
MigrateWorkspaceResponse (..),
newMigrateWorkspaceResponse,
migrateWorkspaceResponse_sourceWorkspaceId,
migrateWorkspaceResponse_targetWorkspaceId,
migrateWorkspaceResponse_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.WorkSpaces.Types
data MigrateWorkspace = MigrateWorkspace'
{
MigrateWorkspace -> Text
sourceWorkspaceId :: Prelude.Text,
MigrateWorkspace -> Text
bundleId :: Prelude.Text
}
deriving (MigrateWorkspace -> MigrateWorkspace -> Bool
(MigrateWorkspace -> MigrateWorkspace -> Bool)
-> (MigrateWorkspace -> MigrateWorkspace -> Bool)
-> Eq MigrateWorkspace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MigrateWorkspace -> MigrateWorkspace -> Bool
$c/= :: MigrateWorkspace -> MigrateWorkspace -> Bool
== :: MigrateWorkspace -> MigrateWorkspace -> Bool
$c== :: MigrateWorkspace -> MigrateWorkspace -> Bool
Prelude.Eq, ReadPrec [MigrateWorkspace]
ReadPrec MigrateWorkspace
Int -> ReadS MigrateWorkspace
ReadS [MigrateWorkspace]
(Int -> ReadS MigrateWorkspace)
-> ReadS [MigrateWorkspace]
-> ReadPrec MigrateWorkspace
-> ReadPrec [MigrateWorkspace]
-> Read MigrateWorkspace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MigrateWorkspace]
$creadListPrec :: ReadPrec [MigrateWorkspace]
readPrec :: ReadPrec MigrateWorkspace
$creadPrec :: ReadPrec MigrateWorkspace
readList :: ReadS [MigrateWorkspace]
$creadList :: ReadS [MigrateWorkspace]
readsPrec :: Int -> ReadS MigrateWorkspace
$creadsPrec :: Int -> ReadS MigrateWorkspace
Prelude.Read, Int -> MigrateWorkspace -> ShowS
[MigrateWorkspace] -> ShowS
MigrateWorkspace -> String
(Int -> MigrateWorkspace -> ShowS)
-> (MigrateWorkspace -> String)
-> ([MigrateWorkspace] -> ShowS)
-> Show MigrateWorkspace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MigrateWorkspace] -> ShowS
$cshowList :: [MigrateWorkspace] -> ShowS
show :: MigrateWorkspace -> String
$cshow :: MigrateWorkspace -> String
showsPrec :: Int -> MigrateWorkspace -> ShowS
$cshowsPrec :: Int -> MigrateWorkspace -> ShowS
Prelude.Show, (forall x. MigrateWorkspace -> Rep MigrateWorkspace x)
-> (forall x. Rep MigrateWorkspace x -> MigrateWorkspace)
-> Generic MigrateWorkspace
forall x. Rep MigrateWorkspace x -> MigrateWorkspace
forall x. MigrateWorkspace -> Rep MigrateWorkspace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MigrateWorkspace x -> MigrateWorkspace
$cfrom :: forall x. MigrateWorkspace -> Rep MigrateWorkspace x
Prelude.Generic)
newMigrateWorkspace ::
Prelude.Text ->
Prelude.Text ->
MigrateWorkspace
newMigrateWorkspace :: Text -> Text -> MigrateWorkspace
newMigrateWorkspace Text
pSourceWorkspaceId_ Text
pBundleId_ =
MigrateWorkspace' :: Text -> Text -> MigrateWorkspace
MigrateWorkspace'
{ $sel:sourceWorkspaceId:MigrateWorkspace' :: Text
sourceWorkspaceId =
Text
pSourceWorkspaceId_,
$sel:bundleId:MigrateWorkspace' :: Text
bundleId = Text
pBundleId_
}
migrateWorkspace_sourceWorkspaceId :: Lens.Lens' MigrateWorkspace Prelude.Text
migrateWorkspace_sourceWorkspaceId :: (Text -> f Text) -> MigrateWorkspace -> f MigrateWorkspace
migrateWorkspace_sourceWorkspaceId = (MigrateWorkspace -> Text)
-> (MigrateWorkspace -> Text -> MigrateWorkspace)
-> Lens MigrateWorkspace MigrateWorkspace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrateWorkspace' {Text
sourceWorkspaceId :: Text
$sel:sourceWorkspaceId:MigrateWorkspace' :: MigrateWorkspace -> Text
sourceWorkspaceId} -> Text
sourceWorkspaceId) (\s :: MigrateWorkspace
s@MigrateWorkspace' {} Text
a -> MigrateWorkspace
s {$sel:sourceWorkspaceId:MigrateWorkspace' :: Text
sourceWorkspaceId = Text
a} :: MigrateWorkspace)
migrateWorkspace_bundleId :: Lens.Lens' MigrateWorkspace Prelude.Text
migrateWorkspace_bundleId :: (Text -> f Text) -> MigrateWorkspace -> f MigrateWorkspace
migrateWorkspace_bundleId = (MigrateWorkspace -> Text)
-> (MigrateWorkspace -> Text -> MigrateWorkspace)
-> Lens MigrateWorkspace MigrateWorkspace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrateWorkspace' {Text
bundleId :: Text
$sel:bundleId:MigrateWorkspace' :: MigrateWorkspace -> Text
bundleId} -> Text
bundleId) (\s :: MigrateWorkspace
s@MigrateWorkspace' {} Text
a -> MigrateWorkspace
s {$sel:bundleId:MigrateWorkspace' :: Text
bundleId = Text
a} :: MigrateWorkspace)
instance Core.AWSRequest MigrateWorkspace where
type
AWSResponse MigrateWorkspace =
MigrateWorkspaceResponse
request :: MigrateWorkspace -> Request MigrateWorkspace
request = Service -> MigrateWorkspace -> Request MigrateWorkspace
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy MigrateWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse MigrateWorkspace)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse MigrateWorkspace))
-> Logger
-> Service
-> Proxy MigrateWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse MigrateWorkspace)))
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 Text -> Maybe Text -> Int -> MigrateWorkspaceResponse
MigrateWorkspaceResponse'
(Maybe Text -> Maybe Text -> Int -> MigrateWorkspaceResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> MigrateWorkspaceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SourceWorkspaceId")
Either String (Maybe Text -> Int -> MigrateWorkspaceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> MigrateWorkspaceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TargetWorkspaceId")
Either String (Int -> MigrateWorkspaceResponse)
-> Either String Int -> Either String MigrateWorkspaceResponse
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 MigrateWorkspace
instance Prelude.NFData MigrateWorkspace
instance Core.ToHeaders MigrateWorkspace where
toHeaders :: MigrateWorkspace -> ResponseHeaders
toHeaders =
ResponseHeaders -> MigrateWorkspace -> 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
"WorkspacesService.MigrateWorkspace" ::
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 MigrateWorkspace where
toJSON :: MigrateWorkspace -> Value
toJSON MigrateWorkspace' {Text
bundleId :: Text
sourceWorkspaceId :: Text
$sel:bundleId:MigrateWorkspace' :: MigrateWorkspace -> Text
$sel:sourceWorkspaceId:MigrateWorkspace' :: MigrateWorkspace -> 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
"SourceWorkspaceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceWorkspaceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"BundleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bundleId)
]
)
instance Core.ToPath MigrateWorkspace where
toPath :: MigrateWorkspace -> ByteString
toPath = ByteString -> MigrateWorkspace -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery MigrateWorkspace where
toQuery :: MigrateWorkspace -> QueryString
toQuery = QueryString -> MigrateWorkspace -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data MigrateWorkspaceResponse = MigrateWorkspaceResponse'
{
MigrateWorkspaceResponse -> Maybe Text
sourceWorkspaceId :: Prelude.Maybe Prelude.Text,
MigrateWorkspaceResponse -> Maybe Text
targetWorkspaceId :: Prelude.Maybe Prelude.Text,
MigrateWorkspaceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (MigrateWorkspaceResponse -> MigrateWorkspaceResponse -> Bool
(MigrateWorkspaceResponse -> MigrateWorkspaceResponse -> Bool)
-> (MigrateWorkspaceResponse -> MigrateWorkspaceResponse -> Bool)
-> Eq MigrateWorkspaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MigrateWorkspaceResponse -> MigrateWorkspaceResponse -> Bool
$c/= :: MigrateWorkspaceResponse -> MigrateWorkspaceResponse -> Bool
== :: MigrateWorkspaceResponse -> MigrateWorkspaceResponse -> Bool
$c== :: MigrateWorkspaceResponse -> MigrateWorkspaceResponse -> Bool
Prelude.Eq, ReadPrec [MigrateWorkspaceResponse]
ReadPrec MigrateWorkspaceResponse
Int -> ReadS MigrateWorkspaceResponse
ReadS [MigrateWorkspaceResponse]
(Int -> ReadS MigrateWorkspaceResponse)
-> ReadS [MigrateWorkspaceResponse]
-> ReadPrec MigrateWorkspaceResponse
-> ReadPrec [MigrateWorkspaceResponse]
-> Read MigrateWorkspaceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MigrateWorkspaceResponse]
$creadListPrec :: ReadPrec [MigrateWorkspaceResponse]
readPrec :: ReadPrec MigrateWorkspaceResponse
$creadPrec :: ReadPrec MigrateWorkspaceResponse
readList :: ReadS [MigrateWorkspaceResponse]
$creadList :: ReadS [MigrateWorkspaceResponse]
readsPrec :: Int -> ReadS MigrateWorkspaceResponse
$creadsPrec :: Int -> ReadS MigrateWorkspaceResponse
Prelude.Read, Int -> MigrateWorkspaceResponse -> ShowS
[MigrateWorkspaceResponse] -> ShowS
MigrateWorkspaceResponse -> String
(Int -> MigrateWorkspaceResponse -> ShowS)
-> (MigrateWorkspaceResponse -> String)
-> ([MigrateWorkspaceResponse] -> ShowS)
-> Show MigrateWorkspaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MigrateWorkspaceResponse] -> ShowS
$cshowList :: [MigrateWorkspaceResponse] -> ShowS
show :: MigrateWorkspaceResponse -> String
$cshow :: MigrateWorkspaceResponse -> String
showsPrec :: Int -> MigrateWorkspaceResponse -> ShowS
$cshowsPrec :: Int -> MigrateWorkspaceResponse -> ShowS
Prelude.Show, (forall x.
MigrateWorkspaceResponse -> Rep MigrateWorkspaceResponse x)
-> (forall x.
Rep MigrateWorkspaceResponse x -> MigrateWorkspaceResponse)
-> Generic MigrateWorkspaceResponse
forall x.
Rep MigrateWorkspaceResponse x -> MigrateWorkspaceResponse
forall x.
MigrateWorkspaceResponse -> Rep MigrateWorkspaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep MigrateWorkspaceResponse x -> MigrateWorkspaceResponse
$cfrom :: forall x.
MigrateWorkspaceResponse -> Rep MigrateWorkspaceResponse x
Prelude.Generic)
newMigrateWorkspaceResponse ::
Prelude.Int ->
MigrateWorkspaceResponse
newMigrateWorkspaceResponse :: Int -> MigrateWorkspaceResponse
newMigrateWorkspaceResponse Int
pHttpStatus_ =
MigrateWorkspaceResponse' :: Maybe Text -> Maybe Text -> Int -> MigrateWorkspaceResponse
MigrateWorkspaceResponse'
{ $sel:sourceWorkspaceId:MigrateWorkspaceResponse' :: Maybe Text
sourceWorkspaceId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:targetWorkspaceId:MigrateWorkspaceResponse' :: Maybe Text
targetWorkspaceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:MigrateWorkspaceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
migrateWorkspaceResponse_sourceWorkspaceId :: Lens.Lens' MigrateWorkspaceResponse (Prelude.Maybe Prelude.Text)
migrateWorkspaceResponse_sourceWorkspaceId :: (Maybe Text -> f (Maybe Text))
-> MigrateWorkspaceResponse -> f MigrateWorkspaceResponse
migrateWorkspaceResponse_sourceWorkspaceId = (MigrateWorkspaceResponse -> Maybe Text)
-> (MigrateWorkspaceResponse
-> Maybe Text -> MigrateWorkspaceResponse)
-> Lens
MigrateWorkspaceResponse
MigrateWorkspaceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrateWorkspaceResponse' {Maybe Text
sourceWorkspaceId :: Maybe Text
$sel:sourceWorkspaceId:MigrateWorkspaceResponse' :: MigrateWorkspaceResponse -> Maybe Text
sourceWorkspaceId} -> Maybe Text
sourceWorkspaceId) (\s :: MigrateWorkspaceResponse
s@MigrateWorkspaceResponse' {} Maybe Text
a -> MigrateWorkspaceResponse
s {$sel:sourceWorkspaceId:MigrateWorkspaceResponse' :: Maybe Text
sourceWorkspaceId = Maybe Text
a} :: MigrateWorkspaceResponse)
migrateWorkspaceResponse_targetWorkspaceId :: Lens.Lens' MigrateWorkspaceResponse (Prelude.Maybe Prelude.Text)
migrateWorkspaceResponse_targetWorkspaceId :: (Maybe Text -> f (Maybe Text))
-> MigrateWorkspaceResponse -> f MigrateWorkspaceResponse
migrateWorkspaceResponse_targetWorkspaceId = (MigrateWorkspaceResponse -> Maybe Text)
-> (MigrateWorkspaceResponse
-> Maybe Text -> MigrateWorkspaceResponse)
-> Lens
MigrateWorkspaceResponse
MigrateWorkspaceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrateWorkspaceResponse' {Maybe Text
targetWorkspaceId :: Maybe Text
$sel:targetWorkspaceId:MigrateWorkspaceResponse' :: MigrateWorkspaceResponse -> Maybe Text
targetWorkspaceId} -> Maybe Text
targetWorkspaceId) (\s :: MigrateWorkspaceResponse
s@MigrateWorkspaceResponse' {} Maybe Text
a -> MigrateWorkspaceResponse
s {$sel:targetWorkspaceId:MigrateWorkspaceResponse' :: Maybe Text
targetWorkspaceId = Maybe Text
a} :: MigrateWorkspaceResponse)
migrateWorkspaceResponse_httpStatus :: Lens.Lens' MigrateWorkspaceResponse Prelude.Int
migrateWorkspaceResponse_httpStatus :: (Int -> f Int)
-> MigrateWorkspaceResponse -> f MigrateWorkspaceResponse
migrateWorkspaceResponse_httpStatus = (MigrateWorkspaceResponse -> Int)
-> (MigrateWorkspaceResponse -> Int -> MigrateWorkspaceResponse)
-> Lens MigrateWorkspaceResponse MigrateWorkspaceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MigrateWorkspaceResponse' {Int
httpStatus :: Int
$sel:httpStatus:MigrateWorkspaceResponse' :: MigrateWorkspaceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: MigrateWorkspaceResponse
s@MigrateWorkspaceResponse' {} Int
a -> MigrateWorkspaceResponse
s {$sel:httpStatus:MigrateWorkspaceResponse' :: Int
httpStatus = Int
a} :: MigrateWorkspaceResponse)
instance Prelude.NFData MigrateWorkspaceResponse