{-# 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.RolesAnywhere.UpdateTrustAnchor
(
UpdateTrustAnchor (..),
newUpdateTrustAnchor,
updateTrustAnchor_name,
updateTrustAnchor_source,
updateTrustAnchor_trustAnchorId,
TrustAnchorDetailResponse (..),
newTrustAnchorDetailResponse,
trustAnchorDetailResponse_trustAnchor,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.RolesAnywhere.Types
data UpdateTrustAnchor = UpdateTrustAnchor'
{
UpdateTrustAnchor -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateTrustAnchor -> Maybe Source
source :: Prelude.Maybe Source,
UpdateTrustAnchor -> Text
trustAnchorId :: Prelude.Text
}
deriving (UpdateTrustAnchor -> UpdateTrustAnchor -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateTrustAnchor -> UpdateTrustAnchor -> Bool
$c/= :: UpdateTrustAnchor -> UpdateTrustAnchor -> Bool
== :: UpdateTrustAnchor -> UpdateTrustAnchor -> Bool
$c== :: UpdateTrustAnchor -> UpdateTrustAnchor -> Bool
Prelude.Eq, ReadPrec [UpdateTrustAnchor]
ReadPrec UpdateTrustAnchor
Int -> ReadS UpdateTrustAnchor
ReadS [UpdateTrustAnchor]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateTrustAnchor]
$creadListPrec :: ReadPrec [UpdateTrustAnchor]
readPrec :: ReadPrec UpdateTrustAnchor
$creadPrec :: ReadPrec UpdateTrustAnchor
readList :: ReadS [UpdateTrustAnchor]
$creadList :: ReadS [UpdateTrustAnchor]
readsPrec :: Int -> ReadS UpdateTrustAnchor
$creadsPrec :: Int -> ReadS UpdateTrustAnchor
Prelude.Read, Int -> UpdateTrustAnchor -> ShowS
[UpdateTrustAnchor] -> ShowS
UpdateTrustAnchor -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateTrustAnchor] -> ShowS
$cshowList :: [UpdateTrustAnchor] -> ShowS
show :: UpdateTrustAnchor -> String
$cshow :: UpdateTrustAnchor -> String
showsPrec :: Int -> UpdateTrustAnchor -> ShowS
$cshowsPrec :: Int -> UpdateTrustAnchor -> ShowS
Prelude.Show, forall x. Rep UpdateTrustAnchor x -> UpdateTrustAnchor
forall x. UpdateTrustAnchor -> Rep UpdateTrustAnchor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateTrustAnchor x -> UpdateTrustAnchor
$cfrom :: forall x. UpdateTrustAnchor -> Rep UpdateTrustAnchor x
Prelude.Generic)
newUpdateTrustAnchor ::
Prelude.Text ->
UpdateTrustAnchor
newUpdateTrustAnchor :: Text -> UpdateTrustAnchor
newUpdateTrustAnchor Text
pTrustAnchorId_ =
UpdateTrustAnchor'
{ $sel:name:UpdateTrustAnchor' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:source:UpdateTrustAnchor' :: Maybe Source
source = forall a. Maybe a
Prelude.Nothing,
$sel:trustAnchorId:UpdateTrustAnchor' :: Text
trustAnchorId = Text
pTrustAnchorId_
}
updateTrustAnchor_name :: Lens.Lens' UpdateTrustAnchor (Prelude.Maybe Prelude.Text)
updateTrustAnchor_name :: Lens' UpdateTrustAnchor (Maybe Text)
updateTrustAnchor_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrustAnchor' {Maybe Text
name :: Maybe Text
$sel:name:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateTrustAnchor
s@UpdateTrustAnchor' {} Maybe Text
a -> UpdateTrustAnchor
s {$sel:name:UpdateTrustAnchor' :: Maybe Text
name = Maybe Text
a} :: UpdateTrustAnchor)
updateTrustAnchor_source :: Lens.Lens' UpdateTrustAnchor (Prelude.Maybe Source)
updateTrustAnchor_source :: Lens' UpdateTrustAnchor (Maybe Source)
updateTrustAnchor_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrustAnchor' {Maybe Source
source :: Maybe Source
$sel:source:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Source
source} -> Maybe Source
source) (\s :: UpdateTrustAnchor
s@UpdateTrustAnchor' {} Maybe Source
a -> UpdateTrustAnchor
s {$sel:source:UpdateTrustAnchor' :: Maybe Source
source = Maybe Source
a} :: UpdateTrustAnchor)
updateTrustAnchor_trustAnchorId :: Lens.Lens' UpdateTrustAnchor Prelude.Text
updateTrustAnchor_trustAnchorId :: Lens' UpdateTrustAnchor Text
updateTrustAnchor_trustAnchorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateTrustAnchor' {Text
trustAnchorId :: Text
$sel:trustAnchorId:UpdateTrustAnchor' :: UpdateTrustAnchor -> Text
trustAnchorId} -> Text
trustAnchorId) (\s :: UpdateTrustAnchor
s@UpdateTrustAnchor' {} Text
a -> UpdateTrustAnchor
s {$sel:trustAnchorId:UpdateTrustAnchor' :: Text
trustAnchorId = Text
a} :: UpdateTrustAnchor)
instance Core.AWSRequest UpdateTrustAnchor where
type
AWSResponse UpdateTrustAnchor =
TrustAnchorDetailResponse
request :: (Service -> Service)
-> UpdateTrustAnchor -> Request UpdateTrustAnchor
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateTrustAnchor
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateTrustAnchor)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateTrustAnchor where
hashWithSalt :: Int -> UpdateTrustAnchor -> Int
hashWithSalt Int
_salt UpdateTrustAnchor' {Maybe Text
Maybe Source
Text
trustAnchorId :: Text
source :: Maybe Source
name :: Maybe Text
$sel:trustAnchorId:UpdateTrustAnchor' :: UpdateTrustAnchor -> Text
$sel:source:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Source
$sel:name:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Source
source
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
trustAnchorId
instance Prelude.NFData UpdateTrustAnchor where
rnf :: UpdateTrustAnchor -> ()
rnf UpdateTrustAnchor' {Maybe Text
Maybe Source
Text
trustAnchorId :: Text
source :: Maybe Source
name :: Maybe Text
$sel:trustAnchorId:UpdateTrustAnchor' :: UpdateTrustAnchor -> Text
$sel:source:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Source
$sel:name:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Source
source
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
trustAnchorId
instance Data.ToHeaders UpdateTrustAnchor where
toHeaders :: UpdateTrustAnchor -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateTrustAnchor where
toJSON :: UpdateTrustAnchor -> Value
toJSON UpdateTrustAnchor' {Maybe Text
Maybe Source
Text
trustAnchorId :: Text
source :: Maybe Source
name :: Maybe Text
$sel:trustAnchorId:UpdateTrustAnchor' :: UpdateTrustAnchor -> Text
$sel:source:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Source
$sel:name:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Key
"source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Source
source
]
)
instance Data.ToPath UpdateTrustAnchor where
toPath :: UpdateTrustAnchor -> ByteString
toPath UpdateTrustAnchor' {Maybe Text
Maybe Source
Text
trustAnchorId :: Text
source :: Maybe Source
name :: Maybe Text
$sel:trustAnchorId:UpdateTrustAnchor' :: UpdateTrustAnchor -> Text
$sel:source:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Source
$sel:name:UpdateTrustAnchor' :: UpdateTrustAnchor -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/trustanchor/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
trustAnchorId]
instance Data.ToQuery UpdateTrustAnchor where
toQuery :: UpdateTrustAnchor -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty