{-# 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.EnableSso
(
EnableSso (..),
newEnableSso,
enableSso_userName,
enableSso_password,
enableSso_directoryId,
EnableSsoResponse (..),
newEnableSsoResponse,
enableSsoResponse_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 EnableSso = EnableSso'
{
EnableSso -> Maybe Text
userName :: Prelude.Maybe Prelude.Text,
EnableSso -> Maybe (Sensitive Text)
password :: Prelude.Maybe (Core.Sensitive Prelude.Text),
EnableSso -> Text
directoryId :: Prelude.Text
}
deriving (EnableSso -> EnableSso -> Bool
(EnableSso -> EnableSso -> Bool)
-> (EnableSso -> EnableSso -> Bool) -> Eq EnableSso
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableSso -> EnableSso -> Bool
$c/= :: EnableSso -> EnableSso -> Bool
== :: EnableSso -> EnableSso -> Bool
$c== :: EnableSso -> EnableSso -> Bool
Prelude.Eq, Int -> EnableSso -> ShowS
[EnableSso] -> ShowS
EnableSso -> String
(Int -> EnableSso -> ShowS)
-> (EnableSso -> String)
-> ([EnableSso] -> ShowS)
-> Show EnableSso
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableSso] -> ShowS
$cshowList :: [EnableSso] -> ShowS
show :: EnableSso -> String
$cshow :: EnableSso -> String
showsPrec :: Int -> EnableSso -> ShowS
$cshowsPrec :: Int -> EnableSso -> ShowS
Prelude.Show, (forall x. EnableSso -> Rep EnableSso x)
-> (forall x. Rep EnableSso x -> EnableSso) -> Generic EnableSso
forall x. Rep EnableSso x -> EnableSso
forall x. EnableSso -> Rep EnableSso x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableSso x -> EnableSso
$cfrom :: forall x. EnableSso -> Rep EnableSso x
Prelude.Generic)
newEnableSso ::
Prelude.Text ->
EnableSso
newEnableSso :: Text -> EnableSso
newEnableSso Text
pDirectoryId_ =
EnableSso' :: Maybe Text -> Maybe (Sensitive Text) -> Text -> EnableSso
EnableSso'
{ $sel:userName:EnableSso' :: Maybe Text
userName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:password:EnableSso' :: Maybe (Sensitive Text)
password = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:directoryId:EnableSso' :: Text
directoryId = Text
pDirectoryId_
}
enableSso_userName :: Lens.Lens' EnableSso (Prelude.Maybe Prelude.Text)
enableSso_userName :: (Maybe Text -> f (Maybe Text)) -> EnableSso -> f EnableSso
enableSso_userName = (EnableSso -> Maybe Text)
-> (EnableSso -> Maybe Text -> EnableSso)
-> Lens EnableSso EnableSso (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableSso' {Maybe Text
userName :: Maybe Text
$sel:userName:EnableSso' :: EnableSso -> Maybe Text
userName} -> Maybe Text
userName) (\s :: EnableSso
s@EnableSso' {} Maybe Text
a -> EnableSso
s {$sel:userName:EnableSso' :: Maybe Text
userName = Maybe Text
a} :: EnableSso)
enableSso_password :: Lens.Lens' EnableSso (Prelude.Maybe Prelude.Text)
enableSso_password :: (Maybe Text -> f (Maybe Text)) -> EnableSso -> f EnableSso
enableSso_password = (EnableSso -> Maybe (Sensitive Text))
-> (EnableSso -> Maybe (Sensitive Text) -> EnableSso)
-> Lens
EnableSso
EnableSso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableSso' {Maybe (Sensitive Text)
password :: Maybe (Sensitive Text)
$sel:password:EnableSso' :: EnableSso -> Maybe (Sensitive Text)
password} -> Maybe (Sensitive Text)
password) (\s :: EnableSso
s@EnableSso' {} Maybe (Sensitive Text)
a -> EnableSso
s {$sel:password:EnableSso' :: Maybe (Sensitive Text)
password = Maybe (Sensitive Text)
a} :: EnableSso) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> EnableSso -> f EnableSso)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> EnableSso
-> f EnableSso
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
enableSso_directoryId :: Lens.Lens' EnableSso Prelude.Text
enableSso_directoryId :: (Text -> f Text) -> EnableSso -> f EnableSso
enableSso_directoryId = (EnableSso -> Text)
-> (EnableSso -> Text -> EnableSso)
-> Lens EnableSso EnableSso Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableSso' {Text
directoryId :: Text
$sel:directoryId:EnableSso' :: EnableSso -> Text
directoryId} -> Text
directoryId) (\s :: EnableSso
s@EnableSso' {} Text
a -> EnableSso
s {$sel:directoryId:EnableSso' :: Text
directoryId = Text
a} :: EnableSso)
instance Core.AWSRequest EnableSso where
type AWSResponse EnableSso = EnableSsoResponse
request :: EnableSso -> Request EnableSso
request = Service -> EnableSso -> Request EnableSso
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy EnableSso
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnableSso)))
response =
(Int
-> ResponseHeaders -> () -> Either String (AWSResponse EnableSso))
-> Logger
-> Service
-> Proxy EnableSso
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse EnableSso)))
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 -> EnableSsoResponse
EnableSsoResponse'
(Int -> EnableSsoResponse)
-> Either String Int -> Either String EnableSsoResponse
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 EnableSso
instance Prelude.NFData EnableSso
instance Core.ToHeaders EnableSso where
toHeaders :: EnableSso -> ResponseHeaders
toHeaders =
ResponseHeaders -> EnableSso -> 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.EnableSso" ::
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 EnableSso where
toJSON :: EnableSso -> Value
toJSON EnableSso' {Maybe Text
Maybe (Sensitive Text)
Text
directoryId :: Text
password :: Maybe (Sensitive Text)
userName :: Maybe Text
$sel:directoryId:EnableSso' :: EnableSso -> Text
$sel:password:EnableSso' :: EnableSso -> Maybe (Sensitive Text)
$sel:userName:EnableSso' :: EnableSso -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"UserName" 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
userName,
(Text
"Password" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
password,
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)
]
)
instance Core.ToPath EnableSso where
toPath :: EnableSso -> ByteString
toPath = ByteString -> EnableSso -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery EnableSso where
toQuery :: EnableSso -> QueryString
toQuery = QueryString -> EnableSso -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data EnableSsoResponse = EnableSsoResponse'
{
EnableSsoResponse -> Int
httpStatus :: Prelude.Int
}
deriving (EnableSsoResponse -> EnableSsoResponse -> Bool
(EnableSsoResponse -> EnableSsoResponse -> Bool)
-> (EnableSsoResponse -> EnableSsoResponse -> Bool)
-> Eq EnableSsoResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableSsoResponse -> EnableSsoResponse -> Bool
$c/= :: EnableSsoResponse -> EnableSsoResponse -> Bool
== :: EnableSsoResponse -> EnableSsoResponse -> Bool
$c== :: EnableSsoResponse -> EnableSsoResponse -> Bool
Prelude.Eq, ReadPrec [EnableSsoResponse]
ReadPrec EnableSsoResponse
Int -> ReadS EnableSsoResponse
ReadS [EnableSsoResponse]
(Int -> ReadS EnableSsoResponse)
-> ReadS [EnableSsoResponse]
-> ReadPrec EnableSsoResponse
-> ReadPrec [EnableSsoResponse]
-> Read EnableSsoResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableSsoResponse]
$creadListPrec :: ReadPrec [EnableSsoResponse]
readPrec :: ReadPrec EnableSsoResponse
$creadPrec :: ReadPrec EnableSsoResponse
readList :: ReadS [EnableSsoResponse]
$creadList :: ReadS [EnableSsoResponse]
readsPrec :: Int -> ReadS EnableSsoResponse
$creadsPrec :: Int -> ReadS EnableSsoResponse
Prelude.Read, Int -> EnableSsoResponse -> ShowS
[EnableSsoResponse] -> ShowS
EnableSsoResponse -> String
(Int -> EnableSsoResponse -> ShowS)
-> (EnableSsoResponse -> String)
-> ([EnableSsoResponse] -> ShowS)
-> Show EnableSsoResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableSsoResponse] -> ShowS
$cshowList :: [EnableSsoResponse] -> ShowS
show :: EnableSsoResponse -> String
$cshow :: EnableSsoResponse -> String
showsPrec :: Int -> EnableSsoResponse -> ShowS
$cshowsPrec :: Int -> EnableSsoResponse -> ShowS
Prelude.Show, (forall x. EnableSsoResponse -> Rep EnableSsoResponse x)
-> (forall x. Rep EnableSsoResponse x -> EnableSsoResponse)
-> Generic EnableSsoResponse
forall x. Rep EnableSsoResponse x -> EnableSsoResponse
forall x. EnableSsoResponse -> Rep EnableSsoResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnableSsoResponse x -> EnableSsoResponse
$cfrom :: forall x. EnableSsoResponse -> Rep EnableSsoResponse x
Prelude.Generic)
newEnableSsoResponse ::
Prelude.Int ->
EnableSsoResponse
newEnableSsoResponse :: Int -> EnableSsoResponse
newEnableSsoResponse Int
pHttpStatus_ =
EnableSsoResponse' :: Int -> EnableSsoResponse
EnableSsoResponse' {$sel:httpStatus:EnableSsoResponse' :: Int
httpStatus = Int
pHttpStatus_}
enableSsoResponse_httpStatus :: Lens.Lens' EnableSsoResponse Prelude.Int
enableSsoResponse_httpStatus :: (Int -> f Int) -> EnableSsoResponse -> f EnableSsoResponse
enableSsoResponse_httpStatus = (EnableSsoResponse -> Int)
-> (EnableSsoResponse -> Int -> EnableSsoResponse)
-> Lens EnableSsoResponse EnableSsoResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableSsoResponse' {Int
httpStatus :: Int
$sel:httpStatus:EnableSsoResponse' :: EnableSsoResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: EnableSsoResponse
s@EnableSsoResponse' {} Int
a -> EnableSsoResponse
s {$sel:httpStatus:EnableSsoResponse' :: Int
httpStatus = Int
a} :: EnableSsoResponse)
instance Prelude.NFData EnableSsoResponse