{-# 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.StartSchemaExtension
(
StartSchemaExtension (..),
newStartSchemaExtension,
startSchemaExtension_directoryId,
startSchemaExtension_createSnapshotBeforeSchemaExtension,
startSchemaExtension_ldifContent,
startSchemaExtension_description,
StartSchemaExtensionResponse (..),
newStartSchemaExtensionResponse,
startSchemaExtensionResponse_schemaExtensionId,
startSchemaExtensionResponse_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 StartSchemaExtension = StartSchemaExtension'
{
StartSchemaExtension -> Text
directoryId :: Prelude.Text,
StartSchemaExtension -> Bool
createSnapshotBeforeSchemaExtension :: Prelude.Bool,
StartSchemaExtension -> Text
ldifContent :: Prelude.Text,
StartSchemaExtension -> Text
description :: Prelude.Text
}
deriving (StartSchemaExtension -> StartSchemaExtension -> Bool
(StartSchemaExtension -> StartSchemaExtension -> Bool)
-> (StartSchemaExtension -> StartSchemaExtension -> Bool)
-> Eq StartSchemaExtension
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSchemaExtension -> StartSchemaExtension -> Bool
$c/= :: StartSchemaExtension -> StartSchemaExtension -> Bool
== :: StartSchemaExtension -> StartSchemaExtension -> Bool
$c== :: StartSchemaExtension -> StartSchemaExtension -> Bool
Prelude.Eq, ReadPrec [StartSchemaExtension]
ReadPrec StartSchemaExtension
Int -> ReadS StartSchemaExtension
ReadS [StartSchemaExtension]
(Int -> ReadS StartSchemaExtension)
-> ReadS [StartSchemaExtension]
-> ReadPrec StartSchemaExtension
-> ReadPrec [StartSchemaExtension]
-> Read StartSchemaExtension
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSchemaExtension]
$creadListPrec :: ReadPrec [StartSchemaExtension]
readPrec :: ReadPrec StartSchemaExtension
$creadPrec :: ReadPrec StartSchemaExtension
readList :: ReadS [StartSchemaExtension]
$creadList :: ReadS [StartSchemaExtension]
readsPrec :: Int -> ReadS StartSchemaExtension
$creadsPrec :: Int -> ReadS StartSchemaExtension
Prelude.Read, Int -> StartSchemaExtension -> ShowS
[StartSchemaExtension] -> ShowS
StartSchemaExtension -> String
(Int -> StartSchemaExtension -> ShowS)
-> (StartSchemaExtension -> String)
-> ([StartSchemaExtension] -> ShowS)
-> Show StartSchemaExtension
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSchemaExtension] -> ShowS
$cshowList :: [StartSchemaExtension] -> ShowS
show :: StartSchemaExtension -> String
$cshow :: StartSchemaExtension -> String
showsPrec :: Int -> StartSchemaExtension -> ShowS
$cshowsPrec :: Int -> StartSchemaExtension -> ShowS
Prelude.Show, (forall x. StartSchemaExtension -> Rep StartSchemaExtension x)
-> (forall x. Rep StartSchemaExtension x -> StartSchemaExtension)
-> Generic StartSchemaExtension
forall x. Rep StartSchemaExtension x -> StartSchemaExtension
forall x. StartSchemaExtension -> Rep StartSchemaExtension x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartSchemaExtension x -> StartSchemaExtension
$cfrom :: forall x. StartSchemaExtension -> Rep StartSchemaExtension x
Prelude.Generic)
newStartSchemaExtension ::
Prelude.Text ->
Prelude.Bool ->
Prelude.Text ->
Prelude.Text ->
StartSchemaExtension
newStartSchemaExtension :: Text -> Bool -> Text -> Text -> StartSchemaExtension
newStartSchemaExtension
Text
pDirectoryId_
Bool
pCreateSnapshotBeforeSchemaExtension_
Text
pLdifContent_
Text
pDescription_ =
StartSchemaExtension' :: Text -> Bool -> Text -> Text -> StartSchemaExtension
StartSchemaExtension'
{ $sel:directoryId:StartSchemaExtension' :: Text
directoryId = Text
pDirectoryId_,
$sel:createSnapshotBeforeSchemaExtension:StartSchemaExtension' :: Bool
createSnapshotBeforeSchemaExtension =
Bool
pCreateSnapshotBeforeSchemaExtension_,
$sel:ldifContent:StartSchemaExtension' :: Text
ldifContent = Text
pLdifContent_,
$sel:description:StartSchemaExtension' :: Text
description = Text
pDescription_
}
startSchemaExtension_directoryId :: Lens.Lens' StartSchemaExtension Prelude.Text
startSchemaExtension_directoryId :: (Text -> f Text) -> StartSchemaExtension -> f StartSchemaExtension
startSchemaExtension_directoryId = (StartSchemaExtension -> Text)
-> (StartSchemaExtension -> Text -> StartSchemaExtension)
-> Lens StartSchemaExtension StartSchemaExtension Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaExtension' {Text
directoryId :: Text
$sel:directoryId:StartSchemaExtension' :: StartSchemaExtension -> Text
directoryId} -> Text
directoryId) (\s :: StartSchemaExtension
s@StartSchemaExtension' {} Text
a -> StartSchemaExtension
s {$sel:directoryId:StartSchemaExtension' :: Text
directoryId = Text
a} :: StartSchemaExtension)
startSchemaExtension_createSnapshotBeforeSchemaExtension :: Lens.Lens' StartSchemaExtension Prelude.Bool
startSchemaExtension_createSnapshotBeforeSchemaExtension :: (Bool -> f Bool) -> StartSchemaExtension -> f StartSchemaExtension
startSchemaExtension_createSnapshotBeforeSchemaExtension = (StartSchemaExtension -> Bool)
-> (StartSchemaExtension -> Bool -> StartSchemaExtension)
-> Lens StartSchemaExtension StartSchemaExtension Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaExtension' {Bool
createSnapshotBeforeSchemaExtension :: Bool
$sel:createSnapshotBeforeSchemaExtension:StartSchemaExtension' :: StartSchemaExtension -> Bool
createSnapshotBeforeSchemaExtension} -> Bool
createSnapshotBeforeSchemaExtension) (\s :: StartSchemaExtension
s@StartSchemaExtension' {} Bool
a -> StartSchemaExtension
s {$sel:createSnapshotBeforeSchemaExtension:StartSchemaExtension' :: Bool
createSnapshotBeforeSchemaExtension = Bool
a} :: StartSchemaExtension)
startSchemaExtension_ldifContent :: Lens.Lens' StartSchemaExtension Prelude.Text
startSchemaExtension_ldifContent :: (Text -> f Text) -> StartSchemaExtension -> f StartSchemaExtension
startSchemaExtension_ldifContent = (StartSchemaExtension -> Text)
-> (StartSchemaExtension -> Text -> StartSchemaExtension)
-> Lens StartSchemaExtension StartSchemaExtension Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaExtension' {Text
ldifContent :: Text
$sel:ldifContent:StartSchemaExtension' :: StartSchemaExtension -> Text
ldifContent} -> Text
ldifContent) (\s :: StartSchemaExtension
s@StartSchemaExtension' {} Text
a -> StartSchemaExtension
s {$sel:ldifContent:StartSchemaExtension' :: Text
ldifContent = Text
a} :: StartSchemaExtension)
startSchemaExtension_description :: Lens.Lens' StartSchemaExtension Prelude.Text
startSchemaExtension_description :: (Text -> f Text) -> StartSchemaExtension -> f StartSchemaExtension
startSchemaExtension_description = (StartSchemaExtension -> Text)
-> (StartSchemaExtension -> Text -> StartSchemaExtension)
-> Lens StartSchemaExtension StartSchemaExtension Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaExtension' {Text
description :: Text
$sel:description:StartSchemaExtension' :: StartSchemaExtension -> Text
description} -> Text
description) (\s :: StartSchemaExtension
s@StartSchemaExtension' {} Text
a -> StartSchemaExtension
s {$sel:description:StartSchemaExtension' :: Text
description = Text
a} :: StartSchemaExtension)
instance Core.AWSRequest StartSchemaExtension where
type
AWSResponse StartSchemaExtension =
StartSchemaExtensionResponse
request :: StartSchemaExtension -> Request StartSchemaExtension
request = Service -> StartSchemaExtension -> Request StartSchemaExtension
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartSchemaExtension
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartSchemaExtension)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartSchemaExtension))
-> Logger
-> Service
-> Proxy StartSchemaExtension
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartSchemaExtension)))
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 -> Int -> StartSchemaExtensionResponse
StartSchemaExtensionResponse'
(Maybe Text -> Int -> StartSchemaExtensionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartSchemaExtensionResponse)
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
"SchemaExtensionId")
Either String (Int -> StartSchemaExtensionResponse)
-> Either String Int -> Either String StartSchemaExtensionResponse
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 StartSchemaExtension
instance Prelude.NFData StartSchemaExtension
instance Core.ToHeaders StartSchemaExtension where
toHeaders :: StartSchemaExtension -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartSchemaExtension -> 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.StartSchemaExtension" ::
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 StartSchemaExtension where
toJSON :: StartSchemaExtension -> Value
toJSON StartSchemaExtension' {Bool
Text
description :: Text
ldifContent :: Text
createSnapshotBeforeSchemaExtension :: Bool
directoryId :: Text
$sel:description:StartSchemaExtension' :: StartSchemaExtension -> Text
$sel:ldifContent:StartSchemaExtension' :: StartSchemaExtension -> Text
$sel:createSnapshotBeforeSchemaExtension:StartSchemaExtension' :: StartSchemaExtension -> Bool
$sel:directoryId:StartSchemaExtension' :: StartSchemaExtension -> 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
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"CreateSnapshotBeforeSchemaExtension"
Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
createSnapshotBeforeSchemaExtension
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LdifContent" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ldifContent),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
description)
]
)
instance Core.ToPath StartSchemaExtension where
toPath :: StartSchemaExtension -> ByteString
toPath = ByteString -> StartSchemaExtension -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartSchemaExtension where
toQuery :: StartSchemaExtension -> QueryString
toQuery = QueryString -> StartSchemaExtension -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartSchemaExtensionResponse = StartSchemaExtensionResponse'
{
StartSchemaExtensionResponse -> Maybe Text
schemaExtensionId :: Prelude.Maybe Prelude.Text,
StartSchemaExtensionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartSchemaExtensionResponse
-> StartSchemaExtensionResponse -> Bool
(StartSchemaExtensionResponse
-> StartSchemaExtensionResponse -> Bool)
-> (StartSchemaExtensionResponse
-> StartSchemaExtensionResponse -> Bool)
-> Eq StartSchemaExtensionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartSchemaExtensionResponse
-> StartSchemaExtensionResponse -> Bool
$c/= :: StartSchemaExtensionResponse
-> StartSchemaExtensionResponse -> Bool
== :: StartSchemaExtensionResponse
-> StartSchemaExtensionResponse -> Bool
$c== :: StartSchemaExtensionResponse
-> StartSchemaExtensionResponse -> Bool
Prelude.Eq, ReadPrec [StartSchemaExtensionResponse]
ReadPrec StartSchemaExtensionResponse
Int -> ReadS StartSchemaExtensionResponse
ReadS [StartSchemaExtensionResponse]
(Int -> ReadS StartSchemaExtensionResponse)
-> ReadS [StartSchemaExtensionResponse]
-> ReadPrec StartSchemaExtensionResponse
-> ReadPrec [StartSchemaExtensionResponse]
-> Read StartSchemaExtensionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartSchemaExtensionResponse]
$creadListPrec :: ReadPrec [StartSchemaExtensionResponse]
readPrec :: ReadPrec StartSchemaExtensionResponse
$creadPrec :: ReadPrec StartSchemaExtensionResponse
readList :: ReadS [StartSchemaExtensionResponse]
$creadList :: ReadS [StartSchemaExtensionResponse]
readsPrec :: Int -> ReadS StartSchemaExtensionResponse
$creadsPrec :: Int -> ReadS StartSchemaExtensionResponse
Prelude.Read, Int -> StartSchemaExtensionResponse -> ShowS
[StartSchemaExtensionResponse] -> ShowS
StartSchemaExtensionResponse -> String
(Int -> StartSchemaExtensionResponse -> ShowS)
-> (StartSchemaExtensionResponse -> String)
-> ([StartSchemaExtensionResponse] -> ShowS)
-> Show StartSchemaExtensionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartSchemaExtensionResponse] -> ShowS
$cshowList :: [StartSchemaExtensionResponse] -> ShowS
show :: StartSchemaExtensionResponse -> String
$cshow :: StartSchemaExtensionResponse -> String
showsPrec :: Int -> StartSchemaExtensionResponse -> ShowS
$cshowsPrec :: Int -> StartSchemaExtensionResponse -> ShowS
Prelude.Show, (forall x.
StartSchemaExtensionResponse -> Rep StartSchemaExtensionResponse x)
-> (forall x.
Rep StartSchemaExtensionResponse x -> StartSchemaExtensionResponse)
-> Generic StartSchemaExtensionResponse
forall x.
Rep StartSchemaExtensionResponse x -> StartSchemaExtensionResponse
forall x.
StartSchemaExtensionResponse -> Rep StartSchemaExtensionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartSchemaExtensionResponse x -> StartSchemaExtensionResponse
$cfrom :: forall x.
StartSchemaExtensionResponse -> Rep StartSchemaExtensionResponse x
Prelude.Generic)
newStartSchemaExtensionResponse ::
Prelude.Int ->
StartSchemaExtensionResponse
newStartSchemaExtensionResponse :: Int -> StartSchemaExtensionResponse
newStartSchemaExtensionResponse Int
pHttpStatus_ =
StartSchemaExtensionResponse' :: Maybe Text -> Int -> StartSchemaExtensionResponse
StartSchemaExtensionResponse'
{ $sel:schemaExtensionId:StartSchemaExtensionResponse' :: Maybe Text
schemaExtensionId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartSchemaExtensionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startSchemaExtensionResponse_schemaExtensionId :: Lens.Lens' StartSchemaExtensionResponse (Prelude.Maybe Prelude.Text)
startSchemaExtensionResponse_schemaExtensionId :: (Maybe Text -> f (Maybe Text))
-> StartSchemaExtensionResponse -> f StartSchemaExtensionResponse
startSchemaExtensionResponse_schemaExtensionId = (StartSchemaExtensionResponse -> Maybe Text)
-> (StartSchemaExtensionResponse
-> Maybe Text -> StartSchemaExtensionResponse)
-> Lens
StartSchemaExtensionResponse
StartSchemaExtensionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaExtensionResponse' {Maybe Text
schemaExtensionId :: Maybe Text
$sel:schemaExtensionId:StartSchemaExtensionResponse' :: StartSchemaExtensionResponse -> Maybe Text
schemaExtensionId} -> Maybe Text
schemaExtensionId) (\s :: StartSchemaExtensionResponse
s@StartSchemaExtensionResponse' {} Maybe Text
a -> StartSchemaExtensionResponse
s {$sel:schemaExtensionId:StartSchemaExtensionResponse' :: Maybe Text
schemaExtensionId = Maybe Text
a} :: StartSchemaExtensionResponse)
startSchemaExtensionResponse_httpStatus :: Lens.Lens' StartSchemaExtensionResponse Prelude.Int
startSchemaExtensionResponse_httpStatus :: (Int -> f Int)
-> StartSchemaExtensionResponse -> f StartSchemaExtensionResponse
startSchemaExtensionResponse_httpStatus = (StartSchemaExtensionResponse -> Int)
-> (StartSchemaExtensionResponse
-> Int -> StartSchemaExtensionResponse)
-> Lens
StartSchemaExtensionResponse StartSchemaExtensionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartSchemaExtensionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartSchemaExtensionResponse' :: StartSchemaExtensionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartSchemaExtensionResponse
s@StartSchemaExtensionResponse' {} Int
a -> StartSchemaExtensionResponse
s {$sel:httpStatus:StartSchemaExtensionResponse' :: Int
httpStatus = Int
a} :: StartSchemaExtensionResponse)
instance Prelude.NFData StartSchemaExtensionResponse