{-# 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.UpdateDirectoryConfig
(
UpdateDirectoryConfig (..),
newUpdateDirectoryConfig,
updateDirectoryConfig_serviceAccountCredentials,
updateDirectoryConfig_organizationalUnitDistinguishedNames,
updateDirectoryConfig_directoryName,
UpdateDirectoryConfigResponse (..),
newUpdateDirectoryConfigResponse,
updateDirectoryConfigResponse_directoryConfig,
updateDirectoryConfigResponse_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 UpdateDirectoryConfig = UpdateDirectoryConfig'
{
UpdateDirectoryConfig -> Maybe ServiceAccountCredentials
serviceAccountCredentials :: Prelude.Maybe ServiceAccountCredentials,
UpdateDirectoryConfig -> Maybe [Text]
organizationalUnitDistinguishedNames :: Prelude.Maybe [Prelude.Text],
UpdateDirectoryConfig -> Text
directoryName :: Prelude.Text
}
deriving (UpdateDirectoryConfig -> UpdateDirectoryConfig -> Bool
(UpdateDirectoryConfig -> UpdateDirectoryConfig -> Bool)
-> (UpdateDirectoryConfig -> UpdateDirectoryConfig -> Bool)
-> Eq UpdateDirectoryConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDirectoryConfig -> UpdateDirectoryConfig -> Bool
$c/= :: UpdateDirectoryConfig -> UpdateDirectoryConfig -> Bool
== :: UpdateDirectoryConfig -> UpdateDirectoryConfig -> Bool
$c== :: UpdateDirectoryConfig -> UpdateDirectoryConfig -> Bool
Prelude.Eq, Int -> UpdateDirectoryConfig -> ShowS
[UpdateDirectoryConfig] -> ShowS
UpdateDirectoryConfig -> String
(Int -> UpdateDirectoryConfig -> ShowS)
-> (UpdateDirectoryConfig -> String)
-> ([UpdateDirectoryConfig] -> ShowS)
-> Show UpdateDirectoryConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDirectoryConfig] -> ShowS
$cshowList :: [UpdateDirectoryConfig] -> ShowS
show :: UpdateDirectoryConfig -> String
$cshow :: UpdateDirectoryConfig -> String
showsPrec :: Int -> UpdateDirectoryConfig -> ShowS
$cshowsPrec :: Int -> UpdateDirectoryConfig -> ShowS
Prelude.Show, (forall x. UpdateDirectoryConfig -> Rep UpdateDirectoryConfig x)
-> (forall x. Rep UpdateDirectoryConfig x -> UpdateDirectoryConfig)
-> Generic UpdateDirectoryConfig
forall x. Rep UpdateDirectoryConfig x -> UpdateDirectoryConfig
forall x. UpdateDirectoryConfig -> Rep UpdateDirectoryConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDirectoryConfig x -> UpdateDirectoryConfig
$cfrom :: forall x. UpdateDirectoryConfig -> Rep UpdateDirectoryConfig x
Prelude.Generic)
newUpdateDirectoryConfig ::
Prelude.Text ->
UpdateDirectoryConfig
newUpdateDirectoryConfig :: Text -> UpdateDirectoryConfig
newUpdateDirectoryConfig Text
pDirectoryName_ =
UpdateDirectoryConfig' :: Maybe ServiceAccountCredentials
-> Maybe [Text] -> Text -> UpdateDirectoryConfig
UpdateDirectoryConfig'
{ $sel:serviceAccountCredentials:UpdateDirectoryConfig' :: Maybe ServiceAccountCredentials
serviceAccountCredentials =
Maybe ServiceAccountCredentials
forall a. Maybe a
Prelude.Nothing,
$sel:organizationalUnitDistinguishedNames:UpdateDirectoryConfig' :: Maybe [Text]
organizationalUnitDistinguishedNames =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:directoryName:UpdateDirectoryConfig' :: Text
directoryName = Text
pDirectoryName_
}
updateDirectoryConfig_serviceAccountCredentials :: Lens.Lens' UpdateDirectoryConfig (Prelude.Maybe ServiceAccountCredentials)
updateDirectoryConfig_serviceAccountCredentials :: (Maybe ServiceAccountCredentials
-> f (Maybe ServiceAccountCredentials))
-> UpdateDirectoryConfig -> f UpdateDirectoryConfig
updateDirectoryConfig_serviceAccountCredentials = (UpdateDirectoryConfig -> Maybe ServiceAccountCredentials)
-> (UpdateDirectoryConfig
-> Maybe ServiceAccountCredentials -> UpdateDirectoryConfig)
-> Lens
UpdateDirectoryConfig
UpdateDirectoryConfig
(Maybe ServiceAccountCredentials)
(Maybe ServiceAccountCredentials)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDirectoryConfig' {Maybe ServiceAccountCredentials
serviceAccountCredentials :: Maybe ServiceAccountCredentials
$sel:serviceAccountCredentials:UpdateDirectoryConfig' :: UpdateDirectoryConfig -> Maybe ServiceAccountCredentials
serviceAccountCredentials} -> Maybe ServiceAccountCredentials
serviceAccountCredentials) (\s :: UpdateDirectoryConfig
s@UpdateDirectoryConfig' {} Maybe ServiceAccountCredentials
a -> UpdateDirectoryConfig
s {$sel:serviceAccountCredentials:UpdateDirectoryConfig' :: Maybe ServiceAccountCredentials
serviceAccountCredentials = Maybe ServiceAccountCredentials
a} :: UpdateDirectoryConfig)
updateDirectoryConfig_organizationalUnitDistinguishedNames :: Lens.Lens' UpdateDirectoryConfig (Prelude.Maybe [Prelude.Text])
updateDirectoryConfig_organizationalUnitDistinguishedNames :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateDirectoryConfig -> f UpdateDirectoryConfig
updateDirectoryConfig_organizationalUnitDistinguishedNames = (UpdateDirectoryConfig -> Maybe [Text])
-> (UpdateDirectoryConfig -> Maybe [Text] -> UpdateDirectoryConfig)
-> Lens
UpdateDirectoryConfig
UpdateDirectoryConfig
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDirectoryConfig' {Maybe [Text]
organizationalUnitDistinguishedNames :: Maybe [Text]
$sel:organizationalUnitDistinguishedNames:UpdateDirectoryConfig' :: UpdateDirectoryConfig -> Maybe [Text]
organizationalUnitDistinguishedNames} -> Maybe [Text]
organizationalUnitDistinguishedNames) (\s :: UpdateDirectoryConfig
s@UpdateDirectoryConfig' {} Maybe [Text]
a -> UpdateDirectoryConfig
s {$sel:organizationalUnitDistinguishedNames:UpdateDirectoryConfig' :: Maybe [Text]
organizationalUnitDistinguishedNames = Maybe [Text]
a} :: UpdateDirectoryConfig) ((Maybe [Text] -> f (Maybe [Text]))
-> UpdateDirectoryConfig -> f UpdateDirectoryConfig)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateDirectoryConfig
-> f UpdateDirectoryConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateDirectoryConfig_directoryName :: Lens.Lens' UpdateDirectoryConfig Prelude.Text
updateDirectoryConfig_directoryName :: (Text -> f Text)
-> UpdateDirectoryConfig -> f UpdateDirectoryConfig
updateDirectoryConfig_directoryName = (UpdateDirectoryConfig -> Text)
-> (UpdateDirectoryConfig -> Text -> UpdateDirectoryConfig)
-> Lens UpdateDirectoryConfig UpdateDirectoryConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDirectoryConfig' {Text
directoryName :: Text
$sel:directoryName:UpdateDirectoryConfig' :: UpdateDirectoryConfig -> Text
directoryName} -> Text
directoryName) (\s :: UpdateDirectoryConfig
s@UpdateDirectoryConfig' {} Text
a -> UpdateDirectoryConfig
s {$sel:directoryName:UpdateDirectoryConfig' :: Text
directoryName = Text
a} :: UpdateDirectoryConfig)
instance Core.AWSRequest UpdateDirectoryConfig where
type
AWSResponse UpdateDirectoryConfig =
UpdateDirectoryConfigResponse
request :: UpdateDirectoryConfig -> Request UpdateDirectoryConfig
request = Service -> UpdateDirectoryConfig -> Request UpdateDirectoryConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateDirectoryConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDirectoryConfig)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateDirectoryConfig))
-> Logger
-> Service
-> Proxy UpdateDirectoryConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateDirectoryConfig)))
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 -> UpdateDirectoryConfigResponse
UpdateDirectoryConfigResponse'
(Maybe DirectoryConfig -> Int -> UpdateDirectoryConfigResponse)
-> Either String (Maybe DirectoryConfig)
-> Either String (Int -> UpdateDirectoryConfigResponse)
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 -> UpdateDirectoryConfigResponse)
-> Either String Int -> Either String UpdateDirectoryConfigResponse
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 UpdateDirectoryConfig
instance Prelude.NFData UpdateDirectoryConfig
instance Core.ToHeaders UpdateDirectoryConfig where
toHeaders :: UpdateDirectoryConfig -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateDirectoryConfig -> 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.UpdateDirectoryConfig" ::
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 UpdateDirectoryConfig where
toJSON :: UpdateDirectoryConfig -> Value
toJSON UpdateDirectoryConfig' {Maybe [Text]
Maybe ServiceAccountCredentials
Text
directoryName :: Text
organizationalUnitDistinguishedNames :: Maybe [Text]
serviceAccountCredentials :: Maybe ServiceAccountCredentials
$sel:directoryName:UpdateDirectoryConfig' :: UpdateDirectoryConfig -> Text
$sel:organizationalUnitDistinguishedNames:UpdateDirectoryConfig' :: UpdateDirectoryConfig -> Maybe [Text]
$sel:serviceAccountCredentials:UpdateDirectoryConfig' :: UpdateDirectoryConfig -> 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,
(Text
"OrganizationalUnitDistinguishedNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
organizationalUnitDistinguishedNames,
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)
]
)
instance Core.ToPath UpdateDirectoryConfig where
toPath :: UpdateDirectoryConfig -> ByteString
toPath = ByteString -> UpdateDirectoryConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateDirectoryConfig where
toQuery :: UpdateDirectoryConfig -> QueryString
toQuery = QueryString -> UpdateDirectoryConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateDirectoryConfigResponse = UpdateDirectoryConfigResponse'
{
UpdateDirectoryConfigResponse -> Maybe DirectoryConfig
directoryConfig :: Prelude.Maybe DirectoryConfig,
UpdateDirectoryConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateDirectoryConfigResponse
-> UpdateDirectoryConfigResponse -> Bool
(UpdateDirectoryConfigResponse
-> UpdateDirectoryConfigResponse -> Bool)
-> (UpdateDirectoryConfigResponse
-> UpdateDirectoryConfigResponse -> Bool)
-> Eq UpdateDirectoryConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDirectoryConfigResponse
-> UpdateDirectoryConfigResponse -> Bool
$c/= :: UpdateDirectoryConfigResponse
-> UpdateDirectoryConfigResponse -> Bool
== :: UpdateDirectoryConfigResponse
-> UpdateDirectoryConfigResponse -> Bool
$c== :: UpdateDirectoryConfigResponse
-> UpdateDirectoryConfigResponse -> Bool
Prelude.Eq, Int -> UpdateDirectoryConfigResponse -> ShowS
[UpdateDirectoryConfigResponse] -> ShowS
UpdateDirectoryConfigResponse -> String
(Int -> UpdateDirectoryConfigResponse -> ShowS)
-> (UpdateDirectoryConfigResponse -> String)
-> ([UpdateDirectoryConfigResponse] -> ShowS)
-> Show UpdateDirectoryConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDirectoryConfigResponse] -> ShowS
$cshowList :: [UpdateDirectoryConfigResponse] -> ShowS
show :: UpdateDirectoryConfigResponse -> String
$cshow :: UpdateDirectoryConfigResponse -> String
showsPrec :: Int -> UpdateDirectoryConfigResponse -> ShowS
$cshowsPrec :: Int -> UpdateDirectoryConfigResponse -> ShowS
Prelude.Show, (forall x.
UpdateDirectoryConfigResponse
-> Rep UpdateDirectoryConfigResponse x)
-> (forall x.
Rep UpdateDirectoryConfigResponse x
-> UpdateDirectoryConfigResponse)
-> Generic UpdateDirectoryConfigResponse
forall x.
Rep UpdateDirectoryConfigResponse x
-> UpdateDirectoryConfigResponse
forall x.
UpdateDirectoryConfigResponse
-> Rep UpdateDirectoryConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateDirectoryConfigResponse x
-> UpdateDirectoryConfigResponse
$cfrom :: forall x.
UpdateDirectoryConfigResponse
-> Rep UpdateDirectoryConfigResponse x
Prelude.Generic)
newUpdateDirectoryConfigResponse ::
Prelude.Int ->
UpdateDirectoryConfigResponse
newUpdateDirectoryConfigResponse :: Int -> UpdateDirectoryConfigResponse
newUpdateDirectoryConfigResponse Int
pHttpStatus_ =
UpdateDirectoryConfigResponse' :: Maybe DirectoryConfig -> Int -> UpdateDirectoryConfigResponse
UpdateDirectoryConfigResponse'
{ $sel:directoryConfig:UpdateDirectoryConfigResponse' :: Maybe DirectoryConfig
directoryConfig =
Maybe DirectoryConfig
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateDirectoryConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateDirectoryConfigResponse_directoryConfig :: Lens.Lens' UpdateDirectoryConfigResponse (Prelude.Maybe DirectoryConfig)
updateDirectoryConfigResponse_directoryConfig :: (Maybe DirectoryConfig -> f (Maybe DirectoryConfig))
-> UpdateDirectoryConfigResponse -> f UpdateDirectoryConfigResponse
updateDirectoryConfigResponse_directoryConfig = (UpdateDirectoryConfigResponse -> Maybe DirectoryConfig)
-> (UpdateDirectoryConfigResponse
-> Maybe DirectoryConfig -> UpdateDirectoryConfigResponse)
-> Lens
UpdateDirectoryConfigResponse
UpdateDirectoryConfigResponse
(Maybe DirectoryConfig)
(Maybe DirectoryConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDirectoryConfigResponse' {Maybe DirectoryConfig
directoryConfig :: Maybe DirectoryConfig
$sel:directoryConfig:UpdateDirectoryConfigResponse' :: UpdateDirectoryConfigResponse -> Maybe DirectoryConfig
directoryConfig} -> Maybe DirectoryConfig
directoryConfig) (\s :: UpdateDirectoryConfigResponse
s@UpdateDirectoryConfigResponse' {} Maybe DirectoryConfig
a -> UpdateDirectoryConfigResponse
s {$sel:directoryConfig:UpdateDirectoryConfigResponse' :: Maybe DirectoryConfig
directoryConfig = Maybe DirectoryConfig
a} :: UpdateDirectoryConfigResponse)
updateDirectoryConfigResponse_httpStatus :: Lens.Lens' UpdateDirectoryConfigResponse Prelude.Int
updateDirectoryConfigResponse_httpStatus :: (Int -> f Int)
-> UpdateDirectoryConfigResponse -> f UpdateDirectoryConfigResponse
updateDirectoryConfigResponse_httpStatus = (UpdateDirectoryConfigResponse -> Int)
-> (UpdateDirectoryConfigResponse
-> Int -> UpdateDirectoryConfigResponse)
-> Lens
UpdateDirectoryConfigResponse UpdateDirectoryConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDirectoryConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDirectoryConfigResponse' :: UpdateDirectoryConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateDirectoryConfigResponse
s@UpdateDirectoryConfigResponse' {} Int
a -> UpdateDirectoryConfigResponse
s {$sel:httpStatus:UpdateDirectoryConfigResponse' :: Int
httpStatus = Int
a} :: UpdateDirectoryConfigResponse)
instance Prelude.NFData UpdateDirectoryConfigResponse