{-# 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.UpdateTrust
(
UpdateTrust (..),
newUpdateTrust,
updateTrust_selectiveAuth,
updateTrust_trustId,
UpdateTrustResponse (..),
newUpdateTrustResponse,
updateTrustResponse_requestId,
updateTrustResponse_trustId,
updateTrustResponse_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 UpdateTrust = UpdateTrust'
{
UpdateTrust -> Maybe SelectiveAuth
selectiveAuth :: Prelude.Maybe SelectiveAuth,
UpdateTrust -> Text
trustId :: Prelude.Text
}
deriving (UpdateTrust -> UpdateTrust -> Bool
(UpdateTrust -> UpdateTrust -> Bool)
-> (UpdateTrust -> UpdateTrust -> Bool) -> Eq UpdateTrust
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTrust -> UpdateTrust -> Bool
$c/= :: UpdateTrust -> UpdateTrust -> Bool
== :: UpdateTrust -> UpdateTrust -> Bool
$c== :: UpdateTrust -> UpdateTrust -> Bool
Prelude.Eq, ReadPrec [UpdateTrust]
ReadPrec UpdateTrust
Int -> ReadS UpdateTrust
ReadS [UpdateTrust]
(Int -> ReadS UpdateTrust)
-> ReadS [UpdateTrust]
-> ReadPrec UpdateTrust
-> ReadPrec [UpdateTrust]
-> Read UpdateTrust
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTrust]
$creadListPrec :: ReadPrec [UpdateTrust]
readPrec :: ReadPrec UpdateTrust
$creadPrec :: ReadPrec UpdateTrust
readList :: ReadS [UpdateTrust]
$creadList :: ReadS [UpdateTrust]
readsPrec :: Int -> ReadS UpdateTrust
$creadsPrec :: Int -> ReadS UpdateTrust
Prelude.Read, Int -> UpdateTrust -> ShowS
[UpdateTrust] -> ShowS
UpdateTrust -> String
(Int -> UpdateTrust -> ShowS)
-> (UpdateTrust -> String)
-> ([UpdateTrust] -> ShowS)
-> Show UpdateTrust
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTrust] -> ShowS
$cshowList :: [UpdateTrust] -> ShowS
show :: UpdateTrust -> String
$cshow :: UpdateTrust -> String
showsPrec :: Int -> UpdateTrust -> ShowS
$cshowsPrec :: Int -> UpdateTrust -> ShowS
Prelude.Show, (forall x. UpdateTrust -> Rep UpdateTrust x)
-> (forall x. Rep UpdateTrust x -> UpdateTrust)
-> Generic UpdateTrust
forall x. Rep UpdateTrust x -> UpdateTrust
forall x. UpdateTrust -> Rep UpdateTrust x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTrust x -> UpdateTrust
$cfrom :: forall x. UpdateTrust -> Rep UpdateTrust x
Prelude.Generic)
newUpdateTrust ::
Prelude.Text ->
UpdateTrust
newUpdateTrust :: Text -> UpdateTrust
newUpdateTrust Text
pTrustId_ =
UpdateTrust' :: Maybe SelectiveAuth -> Text -> UpdateTrust
UpdateTrust'
{ $sel:selectiveAuth:UpdateTrust' :: Maybe SelectiveAuth
selectiveAuth = Maybe SelectiveAuth
forall a. Maybe a
Prelude.Nothing,
$sel:trustId:UpdateTrust' :: Text
trustId = Text
pTrustId_
}
updateTrust_selectiveAuth :: Lens.Lens' UpdateTrust (Prelude.Maybe SelectiveAuth)
updateTrust_selectiveAuth :: (Maybe SelectiveAuth -> f (Maybe SelectiveAuth))
-> UpdateTrust -> f UpdateTrust
updateTrust_selectiveAuth = (UpdateTrust -> Maybe SelectiveAuth)
-> (UpdateTrust -> Maybe SelectiveAuth -> UpdateTrust)
-> Lens
UpdateTrust UpdateTrust (Maybe SelectiveAuth) (Maybe SelectiveAuth)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrust' {Maybe SelectiveAuth
selectiveAuth :: Maybe SelectiveAuth
$sel:selectiveAuth:UpdateTrust' :: UpdateTrust -> Maybe SelectiveAuth
selectiveAuth} -> Maybe SelectiveAuth
selectiveAuth) (\s :: UpdateTrust
s@UpdateTrust' {} Maybe SelectiveAuth
a -> UpdateTrust
s {$sel:selectiveAuth:UpdateTrust' :: Maybe SelectiveAuth
selectiveAuth = Maybe SelectiveAuth
a} :: UpdateTrust)
updateTrust_trustId :: Lens.Lens' UpdateTrust Prelude.Text
updateTrust_trustId :: (Text -> f Text) -> UpdateTrust -> f UpdateTrust
updateTrust_trustId = (UpdateTrust -> Text)
-> (UpdateTrust -> Text -> UpdateTrust)
-> Lens UpdateTrust UpdateTrust Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrust' {Text
trustId :: Text
$sel:trustId:UpdateTrust' :: UpdateTrust -> Text
trustId} -> Text
trustId) (\s :: UpdateTrust
s@UpdateTrust' {} Text
a -> UpdateTrust
s {$sel:trustId:UpdateTrust' :: Text
trustId = Text
a} :: UpdateTrust)
instance Core.AWSRequest UpdateTrust where
type AWSResponse UpdateTrust = UpdateTrustResponse
request :: UpdateTrust -> Request UpdateTrust
request = Service -> UpdateTrust -> Request UpdateTrust
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateTrust
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTrust)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateTrust))
-> Logger
-> Service
-> Proxy UpdateTrust
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateTrust)))
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 -> Maybe Text -> Int -> UpdateTrustResponse
UpdateTrustResponse'
(Maybe Text -> Maybe Text -> Int -> UpdateTrustResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> UpdateTrustResponse)
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
"RequestId")
Either String (Maybe Text -> Int -> UpdateTrustResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateTrustResponse)
forall (f :: * -> *) a b. Applicative f => 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
"TrustId")
Either String (Int -> UpdateTrustResponse)
-> Either String Int -> Either String UpdateTrustResponse
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 UpdateTrust
instance Prelude.NFData UpdateTrust
instance Core.ToHeaders UpdateTrust where
toHeaders :: UpdateTrust -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateTrust -> 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.UpdateTrust" ::
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 UpdateTrust where
toJSON :: UpdateTrust -> Value
toJSON UpdateTrust' {Maybe SelectiveAuth
Text
trustId :: Text
selectiveAuth :: Maybe SelectiveAuth
$sel:trustId:UpdateTrust' :: UpdateTrust -> Text
$sel:selectiveAuth:UpdateTrust' :: UpdateTrust -> Maybe SelectiveAuth
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SelectiveAuth" Text -> SelectiveAuth -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SelectiveAuth -> Pair) -> Maybe SelectiveAuth -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SelectiveAuth
selectiveAuth,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TrustId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
trustId)
]
)
instance Core.ToPath UpdateTrust where
toPath :: UpdateTrust -> ByteString
toPath = ByteString -> UpdateTrust -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateTrust where
toQuery :: UpdateTrust -> QueryString
toQuery = QueryString -> UpdateTrust -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateTrustResponse = UpdateTrustResponse'
{ UpdateTrustResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
UpdateTrustResponse -> Maybe Text
trustId :: Prelude.Maybe Prelude.Text,
UpdateTrustResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateTrustResponse -> UpdateTrustResponse -> Bool
(UpdateTrustResponse -> UpdateTrustResponse -> Bool)
-> (UpdateTrustResponse -> UpdateTrustResponse -> Bool)
-> Eq UpdateTrustResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTrustResponse -> UpdateTrustResponse -> Bool
$c/= :: UpdateTrustResponse -> UpdateTrustResponse -> Bool
== :: UpdateTrustResponse -> UpdateTrustResponse -> Bool
$c== :: UpdateTrustResponse -> UpdateTrustResponse -> Bool
Prelude.Eq, ReadPrec [UpdateTrustResponse]
ReadPrec UpdateTrustResponse
Int -> ReadS UpdateTrustResponse
ReadS [UpdateTrustResponse]
(Int -> ReadS UpdateTrustResponse)
-> ReadS [UpdateTrustResponse]
-> ReadPrec UpdateTrustResponse
-> ReadPrec [UpdateTrustResponse]
-> Read UpdateTrustResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTrustResponse]
$creadListPrec :: ReadPrec [UpdateTrustResponse]
readPrec :: ReadPrec UpdateTrustResponse
$creadPrec :: ReadPrec UpdateTrustResponse
readList :: ReadS [UpdateTrustResponse]
$creadList :: ReadS [UpdateTrustResponse]
readsPrec :: Int -> ReadS UpdateTrustResponse
$creadsPrec :: Int -> ReadS UpdateTrustResponse
Prelude.Read, Int -> UpdateTrustResponse -> ShowS
[UpdateTrustResponse] -> ShowS
UpdateTrustResponse -> String
(Int -> UpdateTrustResponse -> ShowS)
-> (UpdateTrustResponse -> String)
-> ([UpdateTrustResponse] -> ShowS)
-> Show UpdateTrustResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTrustResponse] -> ShowS
$cshowList :: [UpdateTrustResponse] -> ShowS
show :: UpdateTrustResponse -> String
$cshow :: UpdateTrustResponse -> String
showsPrec :: Int -> UpdateTrustResponse -> ShowS
$cshowsPrec :: Int -> UpdateTrustResponse -> ShowS
Prelude.Show, (forall x. UpdateTrustResponse -> Rep UpdateTrustResponse x)
-> (forall x. Rep UpdateTrustResponse x -> UpdateTrustResponse)
-> Generic UpdateTrustResponse
forall x. Rep UpdateTrustResponse x -> UpdateTrustResponse
forall x. UpdateTrustResponse -> Rep UpdateTrustResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTrustResponse x -> UpdateTrustResponse
$cfrom :: forall x. UpdateTrustResponse -> Rep UpdateTrustResponse x
Prelude.Generic)
newUpdateTrustResponse ::
Prelude.Int ->
UpdateTrustResponse
newUpdateTrustResponse :: Int -> UpdateTrustResponse
newUpdateTrustResponse Int
pHttpStatus_ =
UpdateTrustResponse' :: Maybe Text -> Maybe Text -> Int -> UpdateTrustResponse
UpdateTrustResponse'
{ $sel:requestId:UpdateTrustResponse' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:trustId:UpdateTrustResponse' :: Maybe Text
trustId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateTrustResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateTrustResponse_requestId :: Lens.Lens' UpdateTrustResponse (Prelude.Maybe Prelude.Text)
updateTrustResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> UpdateTrustResponse -> f UpdateTrustResponse
updateTrustResponse_requestId = (UpdateTrustResponse -> Maybe Text)
-> (UpdateTrustResponse -> Maybe Text -> UpdateTrustResponse)
-> Lens
UpdateTrustResponse UpdateTrustResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrustResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:UpdateTrustResponse' :: UpdateTrustResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: UpdateTrustResponse
s@UpdateTrustResponse' {} Maybe Text
a -> UpdateTrustResponse
s {$sel:requestId:UpdateTrustResponse' :: Maybe Text
requestId = Maybe Text
a} :: UpdateTrustResponse)
updateTrustResponse_trustId :: Lens.Lens' UpdateTrustResponse (Prelude.Maybe Prelude.Text)
updateTrustResponse_trustId :: (Maybe Text -> f (Maybe Text))
-> UpdateTrustResponse -> f UpdateTrustResponse
updateTrustResponse_trustId = (UpdateTrustResponse -> Maybe Text)
-> (UpdateTrustResponse -> Maybe Text -> UpdateTrustResponse)
-> Lens
UpdateTrustResponse UpdateTrustResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrustResponse' {Maybe Text
trustId :: Maybe Text
$sel:trustId:UpdateTrustResponse' :: UpdateTrustResponse -> Maybe Text
trustId} -> Maybe Text
trustId) (\s :: UpdateTrustResponse
s@UpdateTrustResponse' {} Maybe Text
a -> UpdateTrustResponse
s {$sel:trustId:UpdateTrustResponse' :: Maybe Text
trustId = Maybe Text
a} :: UpdateTrustResponse)
updateTrustResponse_httpStatus :: Lens.Lens' UpdateTrustResponse Prelude.Int
updateTrustResponse_httpStatus :: (Int -> f Int) -> UpdateTrustResponse -> f UpdateTrustResponse
updateTrustResponse_httpStatus = (UpdateTrustResponse -> Int)
-> (UpdateTrustResponse -> Int -> UpdateTrustResponse)
-> Lens UpdateTrustResponse UpdateTrustResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrustResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateTrustResponse' :: UpdateTrustResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateTrustResponse
s@UpdateTrustResponse' {} Int
a -> UpdateTrustResponse
s {$sel:httpStatus:UpdateTrustResponse' :: Int
httpStatus = Int
a} :: UpdateTrustResponse)
instance Prelude.NFData UpdateTrustResponse