{-# 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.CreateTrustAnchor
(
CreateTrustAnchor (..),
newCreateTrustAnchor,
createTrustAnchor_enabled,
createTrustAnchor_tags,
createTrustAnchor_name,
createTrustAnchor_source,
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 CreateTrustAnchor = CreateTrustAnchor'
{
CreateTrustAnchor -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
CreateTrustAnchor -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateTrustAnchor -> Text
name :: Prelude.Text,
CreateTrustAnchor -> Source
source :: Source
}
deriving (CreateTrustAnchor -> CreateTrustAnchor -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTrustAnchor -> CreateTrustAnchor -> Bool
$c/= :: CreateTrustAnchor -> CreateTrustAnchor -> Bool
== :: CreateTrustAnchor -> CreateTrustAnchor -> Bool
$c== :: CreateTrustAnchor -> CreateTrustAnchor -> Bool
Prelude.Eq, Int -> CreateTrustAnchor -> ShowS
[CreateTrustAnchor] -> ShowS
CreateTrustAnchor -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTrustAnchor] -> ShowS
$cshowList :: [CreateTrustAnchor] -> ShowS
show :: CreateTrustAnchor -> String
$cshow :: CreateTrustAnchor -> String
showsPrec :: Int -> CreateTrustAnchor -> ShowS
$cshowsPrec :: Int -> CreateTrustAnchor -> ShowS
Prelude.Show, forall x. Rep CreateTrustAnchor x -> CreateTrustAnchor
forall x. CreateTrustAnchor -> Rep CreateTrustAnchor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTrustAnchor x -> CreateTrustAnchor
$cfrom :: forall x. CreateTrustAnchor -> Rep CreateTrustAnchor x
Prelude.Generic)
newCreateTrustAnchor ::
Prelude.Text ->
Source ->
CreateTrustAnchor
newCreateTrustAnchor :: Text -> Source -> CreateTrustAnchor
newCreateTrustAnchor Text
pName_ Source
pSource_ =
CreateTrustAnchor'
{ $sel:enabled:CreateTrustAnchor' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateTrustAnchor' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateTrustAnchor' :: Text
name = Text
pName_,
$sel:source:CreateTrustAnchor' :: Source
source = Source
pSource_
}
createTrustAnchor_enabled :: Lens.Lens' CreateTrustAnchor (Prelude.Maybe Prelude.Bool)
createTrustAnchor_enabled :: Lens' CreateTrustAnchor (Maybe Bool)
createTrustAnchor_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrustAnchor' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:CreateTrustAnchor' :: CreateTrustAnchor -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: CreateTrustAnchor
s@CreateTrustAnchor' {} Maybe Bool
a -> CreateTrustAnchor
s {$sel:enabled:CreateTrustAnchor' :: Maybe Bool
enabled = Maybe Bool
a} :: CreateTrustAnchor)
createTrustAnchor_tags :: Lens.Lens' CreateTrustAnchor (Prelude.Maybe [Tag])
createTrustAnchor_tags :: Lens' CreateTrustAnchor (Maybe [Tag])
createTrustAnchor_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrustAnchor' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateTrustAnchor' :: CreateTrustAnchor -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateTrustAnchor
s@CreateTrustAnchor' {} Maybe [Tag]
a -> CreateTrustAnchor
s {$sel:tags:CreateTrustAnchor' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateTrustAnchor) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createTrustAnchor_name :: Lens.Lens' CreateTrustAnchor Prelude.Text
createTrustAnchor_name :: Lens' CreateTrustAnchor Text
createTrustAnchor_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrustAnchor' {Text
name :: Text
$sel:name:CreateTrustAnchor' :: CreateTrustAnchor -> Text
name} -> Text
name) (\s :: CreateTrustAnchor
s@CreateTrustAnchor' {} Text
a -> CreateTrustAnchor
s {$sel:name:CreateTrustAnchor' :: Text
name = Text
a} :: CreateTrustAnchor)
createTrustAnchor_source :: Lens.Lens' CreateTrustAnchor Source
createTrustAnchor_source :: Lens' CreateTrustAnchor Source
createTrustAnchor_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrustAnchor' {Source
source :: Source
$sel:source:CreateTrustAnchor' :: CreateTrustAnchor -> Source
source} -> Source
source) (\s :: CreateTrustAnchor
s@CreateTrustAnchor' {} Source
a -> CreateTrustAnchor
s {$sel:source:CreateTrustAnchor' :: Source
source = Source
a} :: CreateTrustAnchor)
instance Core.AWSRequest CreateTrustAnchor where
type
AWSResponse CreateTrustAnchor =
TrustAnchorDetailResponse
request :: (Service -> Service)
-> CreateTrustAnchor -> Request CreateTrustAnchor
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateTrustAnchor
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateTrustAnchor)))
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 CreateTrustAnchor where
hashWithSalt :: Int -> CreateTrustAnchor -> Int
hashWithSalt Int
_salt CreateTrustAnchor' {Maybe Bool
Maybe [Tag]
Text
Source
source :: Source
name :: Text
tags :: Maybe [Tag]
enabled :: Maybe Bool
$sel:source:CreateTrustAnchor' :: CreateTrustAnchor -> Source
$sel:name:CreateTrustAnchor' :: CreateTrustAnchor -> Text
$sel:tags:CreateTrustAnchor' :: CreateTrustAnchor -> Maybe [Tag]
$sel:enabled:CreateTrustAnchor' :: CreateTrustAnchor -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Source
source
instance Prelude.NFData CreateTrustAnchor where
rnf :: CreateTrustAnchor -> ()
rnf CreateTrustAnchor' {Maybe Bool
Maybe [Tag]
Text
Source
source :: Source
name :: Text
tags :: Maybe [Tag]
enabled :: Maybe Bool
$sel:source:CreateTrustAnchor' :: CreateTrustAnchor -> Source
$sel:name:CreateTrustAnchor' :: CreateTrustAnchor -> Text
$sel:tags:CreateTrustAnchor' :: CreateTrustAnchor -> Maybe [Tag]
$sel:enabled:CreateTrustAnchor' :: CreateTrustAnchor -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Source
source
instance Data.ToHeaders CreateTrustAnchor where
toHeaders :: CreateTrustAnchor -> 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 CreateTrustAnchor where
toJSON :: CreateTrustAnchor -> Value
toJSON CreateTrustAnchor' {Maybe Bool
Maybe [Tag]
Text
Source
source :: Source
name :: Text
tags :: Maybe [Tag]
enabled :: Maybe Bool
$sel:source:CreateTrustAnchor' :: CreateTrustAnchor -> Source
$sel:name:CreateTrustAnchor' :: CreateTrustAnchor -> Text
$sel:tags:CreateTrustAnchor' :: CreateTrustAnchor -> Maybe [Tag]
$sel:enabled:CreateTrustAnchor' :: CreateTrustAnchor -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"enabled" 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 Bool
enabled,
(Key
"tags" 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 [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
forall a. a -> Maybe a
Prelude.Just (Key
"source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Source
source)
]
)
instance Data.ToPath CreateTrustAnchor where
toPath :: CreateTrustAnchor -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/trustanchors"
instance Data.ToQuery CreateTrustAnchor where
toQuery :: CreateTrustAnchor -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty