{-# 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.DirectoryService.RestoreFromSnapshot
(
RestoreFromSnapshot (..),
newRestoreFromSnapshot,
restoreFromSnapshot_snapshotId,
RestoreFromSnapshotResponse (..),
newRestoreFromSnapshotResponse,
restoreFromSnapshotResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectoryService.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RestoreFromSnapshot = RestoreFromSnapshot'
{
RestoreFromSnapshot -> Text
snapshotId :: Prelude.Text
}
deriving (RestoreFromSnapshot -> RestoreFromSnapshot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreFromSnapshot -> RestoreFromSnapshot -> Bool
$c/= :: RestoreFromSnapshot -> RestoreFromSnapshot -> Bool
== :: RestoreFromSnapshot -> RestoreFromSnapshot -> Bool
$c== :: RestoreFromSnapshot -> RestoreFromSnapshot -> Bool
Prelude.Eq, ReadPrec [RestoreFromSnapshot]
ReadPrec RestoreFromSnapshot
Int -> ReadS RestoreFromSnapshot
ReadS [RestoreFromSnapshot]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreFromSnapshot]
$creadListPrec :: ReadPrec [RestoreFromSnapshot]
readPrec :: ReadPrec RestoreFromSnapshot
$creadPrec :: ReadPrec RestoreFromSnapshot
readList :: ReadS [RestoreFromSnapshot]
$creadList :: ReadS [RestoreFromSnapshot]
readsPrec :: Int -> ReadS RestoreFromSnapshot
$creadsPrec :: Int -> ReadS RestoreFromSnapshot
Prelude.Read, Int -> RestoreFromSnapshot -> ShowS
[RestoreFromSnapshot] -> ShowS
RestoreFromSnapshot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreFromSnapshot] -> ShowS
$cshowList :: [RestoreFromSnapshot] -> ShowS
show :: RestoreFromSnapshot -> String
$cshow :: RestoreFromSnapshot -> String
showsPrec :: Int -> RestoreFromSnapshot -> ShowS
$cshowsPrec :: Int -> RestoreFromSnapshot -> ShowS
Prelude.Show, forall x. Rep RestoreFromSnapshot x -> RestoreFromSnapshot
forall x. RestoreFromSnapshot -> Rep RestoreFromSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RestoreFromSnapshot x -> RestoreFromSnapshot
$cfrom :: forall x. RestoreFromSnapshot -> Rep RestoreFromSnapshot x
Prelude.Generic)
newRestoreFromSnapshot ::
Prelude.Text ->
RestoreFromSnapshot
newRestoreFromSnapshot :: Text -> RestoreFromSnapshot
newRestoreFromSnapshot Text
pSnapshotId_ =
RestoreFromSnapshot' {$sel:snapshotId:RestoreFromSnapshot' :: Text
snapshotId = Text
pSnapshotId_}
restoreFromSnapshot_snapshotId :: Lens.Lens' RestoreFromSnapshot Prelude.Text
restoreFromSnapshot_snapshotId :: Lens' RestoreFromSnapshot Text
restoreFromSnapshot_snapshotId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreFromSnapshot' {Text
snapshotId :: Text
$sel:snapshotId:RestoreFromSnapshot' :: RestoreFromSnapshot -> Text
snapshotId} -> Text
snapshotId) (\s :: RestoreFromSnapshot
s@RestoreFromSnapshot' {} Text
a -> RestoreFromSnapshot
s {$sel:snapshotId:RestoreFromSnapshot' :: Text
snapshotId = Text
a} :: RestoreFromSnapshot)
instance Core.AWSRequest RestoreFromSnapshot where
type
AWSResponse RestoreFromSnapshot =
RestoreFromSnapshotResponse
request :: (Service -> Service)
-> RestoreFromSnapshot -> Request RestoreFromSnapshot
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy RestoreFromSnapshot
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RestoreFromSnapshot)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RestoreFromSnapshotResponse
RestoreFromSnapshotResponse'
forall (f :: * -> *) a b. Functor 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 RestoreFromSnapshot where
hashWithSalt :: Int -> RestoreFromSnapshot -> Int
hashWithSalt Int
_salt RestoreFromSnapshot' {Text
snapshotId :: Text
$sel:snapshotId:RestoreFromSnapshot' :: RestoreFromSnapshot -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
snapshotId
instance Prelude.NFData RestoreFromSnapshot where
rnf :: RestoreFromSnapshot -> ()
rnf RestoreFromSnapshot' {Text
snapshotId :: Text
$sel:snapshotId:RestoreFromSnapshot' :: RestoreFromSnapshot -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
snapshotId
instance Data.ToHeaders RestoreFromSnapshot where
toHeaders :: RestoreFromSnapshot -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"DirectoryService_20150416.RestoreFromSnapshot" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON RestoreFromSnapshot where
toJSON :: RestoreFromSnapshot -> Value
toJSON RestoreFromSnapshot' {Text
snapshotId :: Text
$sel:snapshotId:RestoreFromSnapshot' :: RestoreFromSnapshot -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"SnapshotId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
snapshotId)]
)
instance Data.ToPath RestoreFromSnapshot where
toPath :: RestoreFromSnapshot -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery RestoreFromSnapshot where
toQuery :: RestoreFromSnapshot -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data RestoreFromSnapshotResponse = RestoreFromSnapshotResponse'
{
RestoreFromSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RestoreFromSnapshotResponse -> RestoreFromSnapshotResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RestoreFromSnapshotResponse -> RestoreFromSnapshotResponse -> Bool
$c/= :: RestoreFromSnapshotResponse -> RestoreFromSnapshotResponse -> Bool
== :: RestoreFromSnapshotResponse -> RestoreFromSnapshotResponse -> Bool
$c== :: RestoreFromSnapshotResponse -> RestoreFromSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [RestoreFromSnapshotResponse]
ReadPrec RestoreFromSnapshotResponse
Int -> ReadS RestoreFromSnapshotResponse
ReadS [RestoreFromSnapshotResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RestoreFromSnapshotResponse]
$creadListPrec :: ReadPrec [RestoreFromSnapshotResponse]
readPrec :: ReadPrec RestoreFromSnapshotResponse
$creadPrec :: ReadPrec RestoreFromSnapshotResponse
readList :: ReadS [RestoreFromSnapshotResponse]
$creadList :: ReadS [RestoreFromSnapshotResponse]
readsPrec :: Int -> ReadS RestoreFromSnapshotResponse
$creadsPrec :: Int -> ReadS RestoreFromSnapshotResponse
Prelude.Read, Int -> RestoreFromSnapshotResponse -> ShowS
[RestoreFromSnapshotResponse] -> ShowS
RestoreFromSnapshotResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RestoreFromSnapshotResponse] -> ShowS
$cshowList :: [RestoreFromSnapshotResponse] -> ShowS
show :: RestoreFromSnapshotResponse -> String
$cshow :: RestoreFromSnapshotResponse -> String
showsPrec :: Int -> RestoreFromSnapshotResponse -> ShowS
$cshowsPrec :: Int -> RestoreFromSnapshotResponse -> ShowS
Prelude.Show, forall x.
Rep RestoreFromSnapshotResponse x -> RestoreFromSnapshotResponse
forall x.
RestoreFromSnapshotResponse -> Rep RestoreFromSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RestoreFromSnapshotResponse x -> RestoreFromSnapshotResponse
$cfrom :: forall x.
RestoreFromSnapshotResponse -> Rep RestoreFromSnapshotResponse x
Prelude.Generic)
newRestoreFromSnapshotResponse ::
Prelude.Int ->
RestoreFromSnapshotResponse
newRestoreFromSnapshotResponse :: Int -> RestoreFromSnapshotResponse
newRestoreFromSnapshotResponse Int
pHttpStatus_ =
RestoreFromSnapshotResponse'
{ $sel:httpStatus:RestoreFromSnapshotResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
restoreFromSnapshotResponse_httpStatus :: Lens.Lens' RestoreFromSnapshotResponse Prelude.Int
restoreFromSnapshotResponse_httpStatus :: Lens' RestoreFromSnapshotResponse Int
restoreFromSnapshotResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RestoreFromSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:RestoreFromSnapshotResponse' :: RestoreFromSnapshotResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RestoreFromSnapshotResponse
s@RestoreFromSnapshotResponse' {} Int
a -> RestoreFromSnapshotResponse
s {$sel:httpStatus:RestoreFromSnapshotResponse' :: Int
httpStatus = Int
a} :: RestoreFromSnapshotResponse)
instance Prelude.NFData RestoreFromSnapshotResponse where
rnf :: RestoreFromSnapshotResponse -> ()
rnf RestoreFromSnapshotResponse' {Int
httpStatus :: Int
$sel:httpStatus:RestoreFromSnapshotResponse' :: RestoreFromSnapshotResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus