{-# 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 Amazonka.DirectoryService.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 RestoreFromSnapshot = RestoreFromSnapshot'
{
RestoreFromSnapshot -> Text
snapshotId :: Prelude.Text
}
deriving (RestoreFromSnapshot -> RestoreFromSnapshot -> Bool
(RestoreFromSnapshot -> RestoreFromSnapshot -> Bool)
-> (RestoreFromSnapshot -> RestoreFromSnapshot -> Bool)
-> Eq RestoreFromSnapshot
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]
(Int -> ReadS RestoreFromSnapshot)
-> ReadS [RestoreFromSnapshot]
-> ReadPrec RestoreFromSnapshot
-> ReadPrec [RestoreFromSnapshot]
-> Read 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
(Int -> RestoreFromSnapshot -> ShowS)
-> (RestoreFromSnapshot -> String)
-> ([RestoreFromSnapshot] -> ShowS)
-> Show RestoreFromSnapshot
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. RestoreFromSnapshot -> Rep RestoreFromSnapshot x)
-> (forall x. Rep RestoreFromSnapshot x -> RestoreFromSnapshot)
-> Generic RestoreFromSnapshot
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' :: Text -> RestoreFromSnapshot
RestoreFromSnapshot' {$sel:snapshotId:RestoreFromSnapshot' :: Text
snapshotId = Text
pSnapshotId_}
restoreFromSnapshot_snapshotId :: Lens.Lens' RestoreFromSnapshot Prelude.Text
restoreFromSnapshot_snapshotId :: (Text -> f Text) -> RestoreFromSnapshot -> f RestoreFromSnapshot
restoreFromSnapshot_snapshotId = (RestoreFromSnapshot -> Text)
-> (RestoreFromSnapshot -> Text -> RestoreFromSnapshot)
-> Lens RestoreFromSnapshot RestoreFromSnapshot Text Text
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 :: RestoreFromSnapshot -> Request RestoreFromSnapshot
request = Service -> RestoreFromSnapshot -> Request RestoreFromSnapshot
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RestoreFromSnapshot
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RestoreFromSnapshot)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RestoreFromSnapshot))
-> Logger
-> Service
-> Proxy RestoreFromSnapshot
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RestoreFromSnapshot)))
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 -> RestoreFromSnapshotResponse
RestoreFromSnapshotResponse'
(Int -> RestoreFromSnapshotResponse)
-> Either String Int -> Either String RestoreFromSnapshotResponse
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 RestoreFromSnapshot
instance Prelude.NFData RestoreFromSnapshot
instance Core.ToHeaders RestoreFromSnapshot where
toHeaders :: RestoreFromSnapshot -> ResponseHeaders
toHeaders =
ResponseHeaders -> RestoreFromSnapshot -> 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
"DirectoryService_20150416.RestoreFromSnapshot" ::
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 RestoreFromSnapshot where
toJSON :: RestoreFromSnapshot -> Value
toJSON RestoreFromSnapshot' {Text
snapshotId :: Text
$sel:snapshotId:RestoreFromSnapshot' :: RestoreFromSnapshot -> 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
"SnapshotId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
snapshotId)]
)
instance Core.ToPath RestoreFromSnapshot where
toPath :: RestoreFromSnapshot -> ByteString
toPath = ByteString -> RestoreFromSnapshot -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RestoreFromSnapshot where
toQuery :: RestoreFromSnapshot -> QueryString
toQuery = QueryString -> RestoreFromSnapshot -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RestoreFromSnapshotResponse = RestoreFromSnapshotResponse'
{
RestoreFromSnapshotResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RestoreFromSnapshotResponse -> RestoreFromSnapshotResponse -> Bool
(RestoreFromSnapshotResponse
-> RestoreFromSnapshotResponse -> Bool)
-> (RestoreFromSnapshotResponse
-> RestoreFromSnapshotResponse -> Bool)
-> Eq RestoreFromSnapshotResponse
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]
(Int -> ReadS RestoreFromSnapshotResponse)
-> ReadS [RestoreFromSnapshotResponse]
-> ReadPrec RestoreFromSnapshotResponse
-> ReadPrec [RestoreFromSnapshotResponse]
-> Read 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
(Int -> RestoreFromSnapshotResponse -> ShowS)
-> (RestoreFromSnapshotResponse -> String)
-> ([RestoreFromSnapshotResponse] -> ShowS)
-> Show RestoreFromSnapshotResponse
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.
RestoreFromSnapshotResponse -> Rep RestoreFromSnapshotResponse x)
-> (forall x.
Rep RestoreFromSnapshotResponse x -> RestoreFromSnapshotResponse)
-> Generic RestoreFromSnapshotResponse
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' :: Int -> RestoreFromSnapshotResponse
RestoreFromSnapshotResponse'
{ $sel:httpStatus:RestoreFromSnapshotResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
restoreFromSnapshotResponse_httpStatus :: Lens.Lens' RestoreFromSnapshotResponse Prelude.Int
restoreFromSnapshotResponse_httpStatus :: (Int -> f Int)
-> RestoreFromSnapshotResponse -> f RestoreFromSnapshotResponse
restoreFromSnapshotResponse_httpStatus = (RestoreFromSnapshotResponse -> Int)
-> (RestoreFromSnapshotResponse
-> Int -> RestoreFromSnapshotResponse)
-> Lens
RestoreFromSnapshotResponse RestoreFromSnapshotResponse Int Int
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