{-# 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.RestoreWorkspace
(
RestoreWorkspace (..),
newRestoreWorkspace,
restoreWorkspace_workspaceId,
RestoreWorkspaceResponse (..),
newRestoreWorkspaceResponse,
restoreWorkspaceResponse_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 RestoreWorkspace = RestoreWorkspace'
{
RestoreWorkspace -> Text
workspaceId :: Prelude.Text
}
deriving (RestoreWorkspace -> RestoreWorkspace -> Bool
(RestoreWorkspace -> RestoreWorkspace -> Bool)
-> (RestoreWorkspace -> RestoreWorkspace -> Bool)
-> Eq RestoreWorkspace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreWorkspace -> RestoreWorkspace -> Bool
$c/= :: RestoreWorkspace -> RestoreWorkspace -> Bool
== :: RestoreWorkspace -> RestoreWorkspace -> Bool
$c== :: RestoreWorkspace -> RestoreWorkspace -> Bool
Prelude.Eq, ReadPrec [RestoreWorkspace]
ReadPrec RestoreWorkspace
Int -> ReadS RestoreWorkspace
ReadS [RestoreWorkspace]
(Int -> ReadS RestoreWorkspace)
-> ReadS [RestoreWorkspace]
-> ReadPrec RestoreWorkspace
-> ReadPrec [RestoreWorkspace]
-> Read RestoreWorkspace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreWorkspace]
$creadListPrec :: ReadPrec [RestoreWorkspace]
readPrec :: ReadPrec RestoreWorkspace
$creadPrec :: ReadPrec RestoreWorkspace
readList :: ReadS [RestoreWorkspace]
$creadList :: ReadS [RestoreWorkspace]
readsPrec :: Int -> ReadS RestoreWorkspace
$creadsPrec :: Int -> ReadS RestoreWorkspace
Prelude.Read, Int -> RestoreWorkspace -> ShowS
[RestoreWorkspace] -> ShowS
RestoreWorkspace -> String
(Int -> RestoreWorkspace -> ShowS)
-> (RestoreWorkspace -> String)
-> ([RestoreWorkspace] -> ShowS)
-> Show RestoreWorkspace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreWorkspace] -> ShowS
$cshowList :: [RestoreWorkspace] -> ShowS
show :: RestoreWorkspace -> String
$cshow :: RestoreWorkspace -> String
showsPrec :: Int -> RestoreWorkspace -> ShowS
$cshowsPrec :: Int -> RestoreWorkspace -> ShowS
Prelude.Show, (forall x. RestoreWorkspace -> Rep RestoreWorkspace x)
-> (forall x. Rep RestoreWorkspace x -> RestoreWorkspace)
-> Generic RestoreWorkspace
forall x. Rep RestoreWorkspace x -> RestoreWorkspace
forall x. RestoreWorkspace -> Rep RestoreWorkspace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RestoreWorkspace x -> RestoreWorkspace
$cfrom :: forall x. RestoreWorkspace -> Rep RestoreWorkspace x
Prelude.Generic)
newRestoreWorkspace ::
Prelude.Text ->
RestoreWorkspace
newRestoreWorkspace :: Text -> RestoreWorkspace
newRestoreWorkspace Text
pWorkspaceId_ =
RestoreWorkspace' :: Text -> RestoreWorkspace
RestoreWorkspace' {$sel:workspaceId:RestoreWorkspace' :: Text
workspaceId = Text
pWorkspaceId_}
restoreWorkspace_workspaceId :: Lens.Lens' RestoreWorkspace Prelude.Text
restoreWorkspace_workspaceId :: (Text -> f Text) -> RestoreWorkspace -> f RestoreWorkspace
restoreWorkspace_workspaceId = (RestoreWorkspace -> Text)
-> (RestoreWorkspace -> Text -> RestoreWorkspace)
-> Lens RestoreWorkspace RestoreWorkspace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreWorkspace' {Text
workspaceId :: Text
$sel:workspaceId:RestoreWorkspace' :: RestoreWorkspace -> Text
workspaceId} -> Text
workspaceId) (\s :: RestoreWorkspace
s@RestoreWorkspace' {} Text
a -> RestoreWorkspace
s {$sel:workspaceId:RestoreWorkspace' :: Text
workspaceId = Text
a} :: RestoreWorkspace)
instance Core.AWSRequest RestoreWorkspace where
type
AWSResponse RestoreWorkspace =
RestoreWorkspaceResponse
request :: RestoreWorkspace -> Request RestoreWorkspace
request = Service -> RestoreWorkspace -> Request RestoreWorkspace
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RestoreWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RestoreWorkspace)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RestoreWorkspace))
-> Logger
-> Service
-> Proxy RestoreWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RestoreWorkspace)))
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 -> RestoreWorkspaceResponse
RestoreWorkspaceResponse'
(Int -> RestoreWorkspaceResponse)
-> Either String Int -> Either String RestoreWorkspaceResponse
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 RestoreWorkspace
instance Prelude.NFData RestoreWorkspace
instance Core.ToHeaders RestoreWorkspace where
toHeaders :: RestoreWorkspace -> ResponseHeaders
toHeaders =
ResponseHeaders -> RestoreWorkspace -> 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.RestoreWorkspace" ::
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 RestoreWorkspace where
toJSON :: RestoreWorkspace -> Value
toJSON RestoreWorkspace' {Text
workspaceId :: Text
$sel:workspaceId:RestoreWorkspace' :: RestoreWorkspace -> 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
"WorkspaceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workspaceId)]
)
instance Core.ToPath RestoreWorkspace where
toPath :: RestoreWorkspace -> ByteString
toPath = ByteString -> RestoreWorkspace -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RestoreWorkspace where
toQuery :: RestoreWorkspace -> QueryString
toQuery = QueryString -> RestoreWorkspace -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RestoreWorkspaceResponse = RestoreWorkspaceResponse'
{
RestoreWorkspaceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RestoreWorkspaceResponse -> RestoreWorkspaceResponse -> Bool
(RestoreWorkspaceResponse -> RestoreWorkspaceResponse -> Bool)
-> (RestoreWorkspaceResponse -> RestoreWorkspaceResponse -> Bool)
-> Eq RestoreWorkspaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreWorkspaceResponse -> RestoreWorkspaceResponse -> Bool
$c/= :: RestoreWorkspaceResponse -> RestoreWorkspaceResponse -> Bool
== :: RestoreWorkspaceResponse -> RestoreWorkspaceResponse -> Bool
$c== :: RestoreWorkspaceResponse -> RestoreWorkspaceResponse -> Bool
Prelude.Eq, ReadPrec [RestoreWorkspaceResponse]
ReadPrec RestoreWorkspaceResponse
Int -> ReadS RestoreWorkspaceResponse
ReadS [RestoreWorkspaceResponse]
(Int -> ReadS RestoreWorkspaceResponse)
-> ReadS [RestoreWorkspaceResponse]
-> ReadPrec RestoreWorkspaceResponse
-> ReadPrec [RestoreWorkspaceResponse]
-> Read RestoreWorkspaceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreWorkspaceResponse]
$creadListPrec :: ReadPrec [RestoreWorkspaceResponse]
readPrec :: ReadPrec RestoreWorkspaceResponse
$creadPrec :: ReadPrec RestoreWorkspaceResponse
readList :: ReadS [RestoreWorkspaceResponse]
$creadList :: ReadS [RestoreWorkspaceResponse]
readsPrec :: Int -> ReadS RestoreWorkspaceResponse
$creadsPrec :: Int -> ReadS RestoreWorkspaceResponse
Prelude.Read, Int -> RestoreWorkspaceResponse -> ShowS
[RestoreWorkspaceResponse] -> ShowS
RestoreWorkspaceResponse -> String
(Int -> RestoreWorkspaceResponse -> ShowS)
-> (RestoreWorkspaceResponse -> String)
-> ([RestoreWorkspaceResponse] -> ShowS)
-> Show RestoreWorkspaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreWorkspaceResponse] -> ShowS
$cshowList :: [RestoreWorkspaceResponse] -> ShowS
show :: RestoreWorkspaceResponse -> String
$cshow :: RestoreWorkspaceResponse -> String
showsPrec :: Int -> RestoreWorkspaceResponse -> ShowS
$cshowsPrec :: Int -> RestoreWorkspaceResponse -> ShowS
Prelude.Show, (forall x.
RestoreWorkspaceResponse -> Rep RestoreWorkspaceResponse x)
-> (forall x.
Rep RestoreWorkspaceResponse x -> RestoreWorkspaceResponse)
-> Generic RestoreWorkspaceResponse
forall x.
Rep RestoreWorkspaceResponse x -> RestoreWorkspaceResponse
forall x.
RestoreWorkspaceResponse -> Rep RestoreWorkspaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RestoreWorkspaceResponse x -> RestoreWorkspaceResponse
$cfrom :: forall x.
RestoreWorkspaceResponse -> Rep RestoreWorkspaceResponse x
Prelude.Generic)
newRestoreWorkspaceResponse ::
Prelude.Int ->
RestoreWorkspaceResponse
newRestoreWorkspaceResponse :: Int -> RestoreWorkspaceResponse
newRestoreWorkspaceResponse Int
pHttpStatus_ =
RestoreWorkspaceResponse' :: Int -> RestoreWorkspaceResponse
RestoreWorkspaceResponse'
{ $sel:httpStatus:RestoreWorkspaceResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
restoreWorkspaceResponse_httpStatus :: Lens.Lens' RestoreWorkspaceResponse Prelude.Int
restoreWorkspaceResponse_httpStatus :: (Int -> f Int)
-> RestoreWorkspaceResponse -> f RestoreWorkspaceResponse
restoreWorkspaceResponse_httpStatus = (RestoreWorkspaceResponse -> Int)
-> (RestoreWorkspaceResponse -> Int -> RestoreWorkspaceResponse)
-> Lens RestoreWorkspaceResponse RestoreWorkspaceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreWorkspaceResponse' {Int
httpStatus :: Int
$sel:httpStatus:RestoreWorkspaceResponse' :: RestoreWorkspaceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RestoreWorkspaceResponse
s@RestoreWorkspaceResponse' {} Int
a -> RestoreWorkspaceResponse
s {$sel:httpStatus:RestoreWorkspaceResponse' :: Int
httpStatus = Int
a} :: RestoreWorkspaceResponse)
instance Prelude.NFData RestoreWorkspaceResponse