{-# 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.AppStream.CreateDirectoryConfig
(
CreateDirectoryConfig (..),
newCreateDirectoryConfig,
createDirectoryConfig_serviceAccountCredentials,
createDirectoryConfig_directoryName,
createDirectoryConfig_organizationalUnitDistinguishedNames,
CreateDirectoryConfigResponse (..),
newCreateDirectoryConfigResponse,
createDirectoryConfigResponse_directoryConfig,
createDirectoryConfigResponse_httpStatus,
)
where
import Amazonka.AppStream.Types
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
data CreateDirectoryConfig = CreateDirectoryConfig'
{
CreateDirectoryConfig -> Maybe ServiceAccountCredentials
serviceAccountCredentials :: Prelude.Maybe ServiceAccountCredentials,
CreateDirectoryConfig -> Text
directoryName :: Prelude.Text,
CreateDirectoryConfig -> [Text]
organizationalUnitDistinguishedNames :: [Prelude.Text]
}
deriving (CreateDirectoryConfig -> CreateDirectoryConfig -> Bool
(CreateDirectoryConfig -> CreateDirectoryConfig -> Bool)
-> (CreateDirectoryConfig -> CreateDirectoryConfig -> Bool)
-> Eq CreateDirectoryConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDirectoryConfig -> CreateDirectoryConfig -> Bool
$c/= :: CreateDirectoryConfig -> CreateDirectoryConfig -> Bool
== :: CreateDirectoryConfig -> CreateDirectoryConfig -> Bool
$c== :: CreateDirectoryConfig -> CreateDirectoryConfig -> Bool
Prelude.Eq, Int -> CreateDirectoryConfig -> ShowS
[CreateDirectoryConfig] -> ShowS
CreateDirectoryConfig -> String
(Int -> CreateDirectoryConfig -> ShowS)
-> (CreateDirectoryConfig -> String)
-> ([CreateDirectoryConfig] -> ShowS)
-> Show CreateDirectoryConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDirectoryConfig] -> ShowS
$cshowList :: [CreateDirectoryConfig] -> ShowS
show :: CreateDirectoryConfig -> String
$cshow :: CreateDirectoryConfig -> String
showsPrec :: Int -> CreateDirectoryConfig -> ShowS
$cshowsPrec :: Int -> CreateDirectoryConfig -> ShowS
Prelude.Show, (forall x. CreateDirectoryConfig -> Rep CreateDirectoryConfig x)
-> (forall x. Rep CreateDirectoryConfig x -> CreateDirectoryConfig)
-> Generic CreateDirectoryConfig
forall x. Rep CreateDirectoryConfig x -> CreateDirectoryConfig
forall x. CreateDirectoryConfig -> Rep CreateDirectoryConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDirectoryConfig x -> CreateDirectoryConfig
$cfrom :: forall x. CreateDirectoryConfig -> Rep CreateDirectoryConfig x
Prelude.Generic)
newCreateDirectoryConfig ::
Prelude.Text ->
CreateDirectoryConfig
newCreateDirectoryConfig :: Text -> CreateDirectoryConfig
newCreateDirectoryConfig Text
pDirectoryName_ =
CreateDirectoryConfig' :: Maybe ServiceAccountCredentials
-> Text -> [Text] -> CreateDirectoryConfig
CreateDirectoryConfig'
{ $sel:serviceAccountCredentials:CreateDirectoryConfig' :: Maybe ServiceAccountCredentials
serviceAccountCredentials =
Maybe ServiceAccountCredentials
forall a. Maybe a
Prelude.Nothing,
$sel:directoryName:CreateDirectoryConfig' :: Text
directoryName = Text
pDirectoryName_,
$sel:organizationalUnitDistinguishedNames:CreateDirectoryConfig' :: [Text]
organizationalUnitDistinguishedNames =
[Text]
forall a. Monoid a => a
Prelude.mempty
}
createDirectoryConfig_serviceAccountCredentials :: Lens.Lens' CreateDirectoryConfig (Prelude.Maybe ServiceAccountCredentials)
createDirectoryConfig_serviceAccountCredentials :: (Maybe ServiceAccountCredentials
-> f (Maybe ServiceAccountCredentials))
-> CreateDirectoryConfig -> f CreateDirectoryConfig
createDirectoryConfig_serviceAccountCredentials = (CreateDirectoryConfig -> Maybe ServiceAccountCredentials)
-> (CreateDirectoryConfig
-> Maybe ServiceAccountCredentials -> CreateDirectoryConfig)
-> Lens
CreateDirectoryConfig
CreateDirectoryConfig
(Maybe ServiceAccountCredentials)
(Maybe ServiceAccountCredentials)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectoryConfig' {Maybe ServiceAccountCredentials
serviceAccountCredentials :: Maybe ServiceAccountCredentials
$sel:serviceAccountCredentials:CreateDirectoryConfig' :: CreateDirectoryConfig -> Maybe ServiceAccountCredentials
serviceAccountCredentials} -> Maybe ServiceAccountCredentials
serviceAccountCredentials) (\s :: CreateDirectoryConfig
s@CreateDirectoryConfig' {} Maybe ServiceAccountCredentials
a -> CreateDirectoryConfig
s {$sel:serviceAccountCredentials:CreateDirectoryConfig' :: Maybe ServiceAccountCredentials
serviceAccountCredentials = Maybe ServiceAccountCredentials
a} :: CreateDirectoryConfig)
createDirectoryConfig_directoryName :: Lens.Lens' CreateDirectoryConfig Prelude.Text
createDirectoryConfig_directoryName :: (Text -> f Text)
-> CreateDirectoryConfig -> f CreateDirectoryConfig
createDirectoryConfig_directoryName = (CreateDirectoryConfig -> Text)
-> (CreateDirectoryConfig -> Text -> CreateDirectoryConfig)
-> Lens CreateDirectoryConfig CreateDirectoryConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectoryConfig' {Text
directoryName :: Text
$sel:directoryName:CreateDirectoryConfig' :: CreateDirectoryConfig -> Text
directoryName} -> Text
directoryName) (\s :: CreateDirectoryConfig
s@CreateDirectoryConfig' {} Text
a -> CreateDirectoryConfig
s {$sel:directoryName:CreateDirectoryConfig' :: Text
directoryName = Text
a} :: CreateDirectoryConfig)
createDirectoryConfig_organizationalUnitDistinguishedNames :: Lens.Lens' CreateDirectoryConfig [Prelude.Text]
createDirectoryConfig_organizationalUnitDistinguishedNames :: ([Text] -> f [Text])
-> CreateDirectoryConfig -> f CreateDirectoryConfig
createDirectoryConfig_organizationalUnitDistinguishedNames = (CreateDirectoryConfig -> [Text])
-> (CreateDirectoryConfig -> [Text] -> CreateDirectoryConfig)
-> Lens CreateDirectoryConfig CreateDirectoryConfig [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectoryConfig' {[Text]
organizationalUnitDistinguishedNames :: [Text]
$sel:organizationalUnitDistinguishedNames:CreateDirectoryConfig' :: CreateDirectoryConfig -> [Text]
organizationalUnitDistinguishedNames} -> [Text]
organizationalUnitDistinguishedNames) (\s :: CreateDirectoryConfig
s@CreateDirectoryConfig' {} [Text]
a -> CreateDirectoryConfig
s {$sel:organizationalUnitDistinguishedNames:CreateDirectoryConfig' :: [Text]
organizationalUnitDistinguishedNames = [Text]
a} :: CreateDirectoryConfig) (([Text] -> f [Text])
-> CreateDirectoryConfig -> f CreateDirectoryConfig)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateDirectoryConfig
-> f CreateDirectoryConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateDirectoryConfig where
type
AWSResponse CreateDirectoryConfig =
CreateDirectoryConfigResponse
request :: CreateDirectoryConfig -> Request CreateDirectoryConfig
request = Service -> CreateDirectoryConfig -> Request CreateDirectoryConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateDirectoryConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDirectoryConfig)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateDirectoryConfig))
-> Logger
-> Service
-> Proxy CreateDirectoryConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateDirectoryConfig)))
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 DirectoryConfig -> Int -> CreateDirectoryConfigResponse
CreateDirectoryConfigResponse'
(Maybe DirectoryConfig -> Int -> CreateDirectoryConfigResponse)
-> Either String (Maybe DirectoryConfig)
-> Either String (Int -> CreateDirectoryConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DirectoryConfig)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DirectoryConfig")
Either String (Int -> CreateDirectoryConfigResponse)
-> Either String Int -> Either String CreateDirectoryConfigResponse
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 CreateDirectoryConfig
instance Prelude.NFData CreateDirectoryConfig
instance Core.ToHeaders CreateDirectoryConfig where
toHeaders :: CreateDirectoryConfig -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateDirectoryConfig -> 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
"PhotonAdminProxyService.CreateDirectoryConfig" ::
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 CreateDirectoryConfig where
toJSON :: CreateDirectoryConfig -> Value
toJSON CreateDirectoryConfig' {[Text]
Maybe ServiceAccountCredentials
Text
organizationalUnitDistinguishedNames :: [Text]
directoryName :: Text
serviceAccountCredentials :: Maybe ServiceAccountCredentials
$sel:organizationalUnitDistinguishedNames:CreateDirectoryConfig' :: CreateDirectoryConfig -> [Text]
$sel:directoryName:CreateDirectoryConfig' :: CreateDirectoryConfig -> Text
$sel:serviceAccountCredentials:CreateDirectoryConfig' :: CreateDirectoryConfig -> Maybe ServiceAccountCredentials
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ServiceAccountCredentials" Text -> ServiceAccountCredentials -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(ServiceAccountCredentials -> Pair)
-> Maybe ServiceAccountCredentials -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ServiceAccountCredentials
serviceAccountCredentials,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DirectoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
directoryName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"OrganizationalUnitDistinguishedNames"
Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
organizationalUnitDistinguishedNames
)
]
)
instance Core.ToPath CreateDirectoryConfig where
toPath :: CreateDirectoryConfig -> ByteString
toPath = ByteString -> CreateDirectoryConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateDirectoryConfig where
toQuery :: CreateDirectoryConfig -> QueryString
toQuery = QueryString -> CreateDirectoryConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateDirectoryConfigResponse = CreateDirectoryConfigResponse'
{
CreateDirectoryConfigResponse -> Maybe DirectoryConfig
directoryConfig :: Prelude.Maybe DirectoryConfig,
CreateDirectoryConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateDirectoryConfigResponse
-> CreateDirectoryConfigResponse -> Bool
(CreateDirectoryConfigResponse
-> CreateDirectoryConfigResponse -> Bool)
-> (CreateDirectoryConfigResponse
-> CreateDirectoryConfigResponse -> Bool)
-> Eq CreateDirectoryConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDirectoryConfigResponse
-> CreateDirectoryConfigResponse -> Bool
$c/= :: CreateDirectoryConfigResponse
-> CreateDirectoryConfigResponse -> Bool
== :: CreateDirectoryConfigResponse
-> CreateDirectoryConfigResponse -> Bool
$c== :: CreateDirectoryConfigResponse
-> CreateDirectoryConfigResponse -> Bool
Prelude.Eq, Int -> CreateDirectoryConfigResponse -> ShowS
[CreateDirectoryConfigResponse] -> ShowS
CreateDirectoryConfigResponse -> String
(Int -> CreateDirectoryConfigResponse -> ShowS)
-> (CreateDirectoryConfigResponse -> String)
-> ([CreateDirectoryConfigResponse] -> ShowS)
-> Show CreateDirectoryConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDirectoryConfigResponse] -> ShowS
$cshowList :: [CreateDirectoryConfigResponse] -> ShowS
show :: CreateDirectoryConfigResponse -> String
$cshow :: CreateDirectoryConfigResponse -> String
showsPrec :: Int -> CreateDirectoryConfigResponse -> ShowS
$cshowsPrec :: Int -> CreateDirectoryConfigResponse -> ShowS
Prelude.Show, (forall x.
CreateDirectoryConfigResponse
-> Rep CreateDirectoryConfigResponse x)
-> (forall x.
Rep CreateDirectoryConfigResponse x
-> CreateDirectoryConfigResponse)
-> Generic CreateDirectoryConfigResponse
forall x.
Rep CreateDirectoryConfigResponse x
-> CreateDirectoryConfigResponse
forall x.
CreateDirectoryConfigResponse
-> Rep CreateDirectoryConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDirectoryConfigResponse x
-> CreateDirectoryConfigResponse
$cfrom :: forall x.
CreateDirectoryConfigResponse
-> Rep CreateDirectoryConfigResponse x
Prelude.Generic)
newCreateDirectoryConfigResponse ::
Prelude.Int ->
CreateDirectoryConfigResponse
newCreateDirectoryConfigResponse :: Int -> CreateDirectoryConfigResponse
newCreateDirectoryConfigResponse Int
pHttpStatus_ =
CreateDirectoryConfigResponse' :: Maybe DirectoryConfig -> Int -> CreateDirectoryConfigResponse
CreateDirectoryConfigResponse'
{ $sel:directoryConfig:CreateDirectoryConfigResponse' :: Maybe DirectoryConfig
directoryConfig =
Maybe DirectoryConfig
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateDirectoryConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createDirectoryConfigResponse_directoryConfig :: Lens.Lens' CreateDirectoryConfigResponse (Prelude.Maybe DirectoryConfig)
createDirectoryConfigResponse_directoryConfig :: (Maybe DirectoryConfig -> f (Maybe DirectoryConfig))
-> CreateDirectoryConfigResponse -> f CreateDirectoryConfigResponse
createDirectoryConfigResponse_directoryConfig = (CreateDirectoryConfigResponse -> Maybe DirectoryConfig)
-> (CreateDirectoryConfigResponse
-> Maybe DirectoryConfig -> CreateDirectoryConfigResponse)
-> Lens
CreateDirectoryConfigResponse
CreateDirectoryConfigResponse
(Maybe DirectoryConfig)
(Maybe DirectoryConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectoryConfigResponse' {Maybe DirectoryConfig
directoryConfig :: Maybe DirectoryConfig
$sel:directoryConfig:CreateDirectoryConfigResponse' :: CreateDirectoryConfigResponse -> Maybe DirectoryConfig
directoryConfig} -> Maybe DirectoryConfig
directoryConfig) (\s :: CreateDirectoryConfigResponse
s@CreateDirectoryConfigResponse' {} Maybe DirectoryConfig
a -> CreateDirectoryConfigResponse
s {$sel:directoryConfig:CreateDirectoryConfigResponse' :: Maybe DirectoryConfig
directoryConfig = Maybe DirectoryConfig
a} :: CreateDirectoryConfigResponse)
createDirectoryConfigResponse_httpStatus :: Lens.Lens' CreateDirectoryConfigResponse Prelude.Int
createDirectoryConfigResponse_httpStatus :: (Int -> f Int)
-> CreateDirectoryConfigResponse -> f CreateDirectoryConfigResponse
createDirectoryConfigResponse_httpStatus = (CreateDirectoryConfigResponse -> Int)
-> (CreateDirectoryConfigResponse
-> Int -> CreateDirectoryConfigResponse)
-> Lens
CreateDirectoryConfigResponse CreateDirectoryConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDirectoryConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateDirectoryConfigResponse' :: CreateDirectoryConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateDirectoryConfigResponse
s@CreateDirectoryConfigResponse' {} Int
a -> CreateDirectoryConfigResponse
s {$sel:httpStatus:CreateDirectoryConfigResponse' :: Int
httpStatus = Int
a} :: CreateDirectoryConfigResponse)
instance Prelude.NFData CreateDirectoryConfigResponse