{-# 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.APIGateway.CreateApiKey
(
CreateApiKey (..),
newCreateApiKey,
createApiKey_customerId,
createApiKey_description,
createApiKey_enabled,
createApiKey_generateDistinctId,
createApiKey_name,
createApiKey_stageKeys,
createApiKey_tags,
createApiKey_value,
ApiKey (..),
newApiKey,
apiKey_createdDate,
apiKey_customerId,
apiKey_description,
apiKey_enabled,
apiKey_id,
apiKey_lastUpdatedDate,
apiKey_name,
apiKey_stageKeys,
apiKey_tags,
apiKey_value,
)
where
import Amazonka.APIGateway.Types
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
data CreateApiKey = CreateApiKey'
{
CreateApiKey -> Maybe Text
customerId :: Prelude.Maybe Prelude.Text,
CreateApiKey -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateApiKey -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
CreateApiKey -> Maybe Bool
generateDistinctId :: Prelude.Maybe Prelude.Bool,
CreateApiKey -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
CreateApiKey -> Maybe [StageKey]
stageKeys :: Prelude.Maybe [StageKey],
CreateApiKey -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateApiKey -> Maybe Text
value :: Prelude.Maybe Prelude.Text
}
deriving (CreateApiKey -> CreateApiKey -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApiKey -> CreateApiKey -> Bool
$c/= :: CreateApiKey -> CreateApiKey -> Bool
== :: CreateApiKey -> CreateApiKey -> Bool
$c== :: CreateApiKey -> CreateApiKey -> Bool
Prelude.Eq, ReadPrec [CreateApiKey]
ReadPrec CreateApiKey
Int -> ReadS CreateApiKey
ReadS [CreateApiKey]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApiKey]
$creadListPrec :: ReadPrec [CreateApiKey]
readPrec :: ReadPrec CreateApiKey
$creadPrec :: ReadPrec CreateApiKey
readList :: ReadS [CreateApiKey]
$creadList :: ReadS [CreateApiKey]
readsPrec :: Int -> ReadS CreateApiKey
$creadsPrec :: Int -> ReadS CreateApiKey
Prelude.Read, Int -> CreateApiKey -> ShowS
[CreateApiKey] -> ShowS
CreateApiKey -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApiKey] -> ShowS
$cshowList :: [CreateApiKey] -> ShowS
show :: CreateApiKey -> String
$cshow :: CreateApiKey -> String
showsPrec :: Int -> CreateApiKey -> ShowS
$cshowsPrec :: Int -> CreateApiKey -> ShowS
Prelude.Show, forall x. Rep CreateApiKey x -> CreateApiKey
forall x. CreateApiKey -> Rep CreateApiKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateApiKey x -> CreateApiKey
$cfrom :: forall x. CreateApiKey -> Rep CreateApiKey x
Prelude.Generic)
newCreateApiKey ::
CreateApiKey
newCreateApiKey :: CreateApiKey
newCreateApiKey =
CreateApiKey'
{ $sel:customerId:CreateApiKey' :: Maybe Text
customerId = forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateApiKey' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:enabled:CreateApiKey' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
$sel:generateDistinctId:CreateApiKey' :: Maybe Bool
generateDistinctId = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateApiKey' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:stageKeys:CreateApiKey' :: Maybe [StageKey]
stageKeys = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateApiKey' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:value:CreateApiKey' :: Maybe Text
value = forall a. Maybe a
Prelude.Nothing
}
createApiKey_customerId :: Lens.Lens' CreateApiKey (Prelude.Maybe Prelude.Text)
createApiKey_customerId :: Lens' CreateApiKey (Maybe Text)
createApiKey_customerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiKey' {Maybe Text
customerId :: Maybe Text
$sel:customerId:CreateApiKey' :: CreateApiKey -> Maybe Text
customerId} -> Maybe Text
customerId) (\s :: CreateApiKey
s@CreateApiKey' {} Maybe Text
a -> CreateApiKey
s {$sel:customerId:CreateApiKey' :: Maybe Text
customerId = Maybe Text
a} :: CreateApiKey)
createApiKey_description :: Lens.Lens' CreateApiKey (Prelude.Maybe Prelude.Text)
createApiKey_description :: Lens' CreateApiKey (Maybe Text)
createApiKey_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiKey' {Maybe Text
description :: Maybe Text
$sel:description:CreateApiKey' :: CreateApiKey -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateApiKey
s@CreateApiKey' {} Maybe Text
a -> CreateApiKey
s {$sel:description:CreateApiKey' :: Maybe Text
description = Maybe Text
a} :: CreateApiKey)
createApiKey_enabled :: Lens.Lens' CreateApiKey (Prelude.Maybe Prelude.Bool)
createApiKey_enabled :: Lens' CreateApiKey (Maybe Bool)
createApiKey_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiKey' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:CreateApiKey' :: CreateApiKey -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: CreateApiKey
s@CreateApiKey' {} Maybe Bool
a -> CreateApiKey
s {$sel:enabled:CreateApiKey' :: Maybe Bool
enabled = Maybe Bool
a} :: CreateApiKey)
createApiKey_generateDistinctId :: Lens.Lens' CreateApiKey (Prelude.Maybe Prelude.Bool)
createApiKey_generateDistinctId :: Lens' CreateApiKey (Maybe Bool)
createApiKey_generateDistinctId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiKey' {Maybe Bool
generateDistinctId :: Maybe Bool
$sel:generateDistinctId:CreateApiKey' :: CreateApiKey -> Maybe Bool
generateDistinctId} -> Maybe Bool
generateDistinctId) (\s :: CreateApiKey
s@CreateApiKey' {} Maybe Bool
a -> CreateApiKey
s {$sel:generateDistinctId:CreateApiKey' :: Maybe Bool
generateDistinctId = Maybe Bool
a} :: CreateApiKey)
createApiKey_name :: Lens.Lens' CreateApiKey (Prelude.Maybe Prelude.Text)
createApiKey_name :: Lens' CreateApiKey (Maybe Text)
createApiKey_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiKey' {Maybe Text
name :: Maybe Text
$sel:name:CreateApiKey' :: CreateApiKey -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateApiKey
s@CreateApiKey' {} Maybe Text
a -> CreateApiKey
s {$sel:name:CreateApiKey' :: Maybe Text
name = Maybe Text
a} :: CreateApiKey)
createApiKey_stageKeys :: Lens.Lens' CreateApiKey (Prelude.Maybe [StageKey])
createApiKey_stageKeys :: Lens' CreateApiKey (Maybe [StageKey])
createApiKey_stageKeys = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiKey' {Maybe [StageKey]
stageKeys :: Maybe [StageKey]
$sel:stageKeys:CreateApiKey' :: CreateApiKey -> Maybe [StageKey]
stageKeys} -> Maybe [StageKey]
stageKeys) (\s :: CreateApiKey
s@CreateApiKey' {} Maybe [StageKey]
a -> CreateApiKey
s {$sel:stageKeys:CreateApiKey' :: Maybe [StageKey]
stageKeys = Maybe [StageKey]
a} :: CreateApiKey) 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
createApiKey_tags :: Lens.Lens' CreateApiKey (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createApiKey_tags :: Lens' CreateApiKey (Maybe (HashMap Text Text))
createApiKey_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiKey' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateApiKey' :: CreateApiKey -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateApiKey
s@CreateApiKey' {} Maybe (HashMap Text Text)
a -> CreateApiKey
s {$sel:tags:CreateApiKey' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateApiKey) 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
createApiKey_value :: Lens.Lens' CreateApiKey (Prelude.Maybe Prelude.Text)
createApiKey_value :: Lens' CreateApiKey (Maybe Text)
createApiKey_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApiKey' {Maybe Text
value :: Maybe Text
$sel:value:CreateApiKey' :: CreateApiKey -> Maybe Text
value} -> Maybe Text
value) (\s :: CreateApiKey
s@CreateApiKey' {} Maybe Text
a -> CreateApiKey
s {$sel:value:CreateApiKey' :: Maybe Text
value = Maybe Text
a} :: CreateApiKey)
instance Core.AWSRequest CreateApiKey where
type AWSResponse CreateApiKey = ApiKey
request :: (Service -> Service) -> CreateApiKey -> Request CreateApiKey
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 CreateApiKey
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateApiKey)))
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 CreateApiKey where
hashWithSalt :: Int -> CreateApiKey -> Int
hashWithSalt Int
_salt CreateApiKey' {Maybe Bool
Maybe [StageKey]
Maybe Text
Maybe (HashMap Text Text)
value :: Maybe Text
tags :: Maybe (HashMap Text Text)
stageKeys :: Maybe [StageKey]
name :: Maybe Text
generateDistinctId :: Maybe Bool
enabled :: Maybe Bool
description :: Maybe Text
customerId :: Maybe Text
$sel:value:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:tags:CreateApiKey' :: CreateApiKey -> Maybe (HashMap Text Text)
$sel:stageKeys:CreateApiKey' :: CreateApiKey -> Maybe [StageKey]
$sel:name:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:generateDistinctId:CreateApiKey' :: CreateApiKey -> Maybe Bool
$sel:enabled:CreateApiKey' :: CreateApiKey -> Maybe Bool
$sel:description:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:customerId:CreateApiKey' :: CreateApiKey -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customerId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
generateDistinctId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [StageKey]
stageKeys
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
value
instance Prelude.NFData CreateApiKey where
rnf :: CreateApiKey -> ()
rnf CreateApiKey' {Maybe Bool
Maybe [StageKey]
Maybe Text
Maybe (HashMap Text Text)
value :: Maybe Text
tags :: Maybe (HashMap Text Text)
stageKeys :: Maybe [StageKey]
name :: Maybe Text
generateDistinctId :: Maybe Bool
enabled :: Maybe Bool
description :: Maybe Text
customerId :: Maybe Text
$sel:value:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:tags:CreateApiKey' :: CreateApiKey -> Maybe (HashMap Text Text)
$sel:stageKeys:CreateApiKey' :: CreateApiKey -> Maybe [StageKey]
$sel:name:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:generateDistinctId:CreateApiKey' :: CreateApiKey -> Maybe Bool
$sel:enabled:CreateApiKey' :: CreateApiKey -> Maybe Bool
$sel:description:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:customerId:CreateApiKey' :: CreateApiKey -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customerId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Bool
generateDistinctId
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 [StageKey]
stageKeys
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
value
instance Data.ToHeaders CreateApiKey where
toHeaders :: CreateApiKey -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Data.ToJSON CreateApiKey where
toJSON :: CreateApiKey -> Value
toJSON CreateApiKey' {Maybe Bool
Maybe [StageKey]
Maybe Text
Maybe (HashMap Text Text)
value :: Maybe Text
tags :: Maybe (HashMap Text Text)
stageKeys :: Maybe [StageKey]
name :: Maybe Text
generateDistinctId :: Maybe Bool
enabled :: Maybe Bool
description :: Maybe Text
customerId :: Maybe Text
$sel:value:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:tags:CreateApiKey' :: CreateApiKey -> Maybe (HashMap Text Text)
$sel:stageKeys:CreateApiKey' :: CreateApiKey -> Maybe [StageKey]
$sel:name:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:generateDistinctId:CreateApiKey' :: CreateApiKey -> Maybe Bool
$sel:enabled:CreateApiKey' :: CreateApiKey -> Maybe Bool
$sel:description:CreateApiKey' :: CreateApiKey -> Maybe Text
$sel:customerId:CreateApiKey' :: CreateApiKey -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"customerId" 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
customerId,
(Key
"description" 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
description,
(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
"generateDistinctId" 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
generateDistinctId,
(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
"stageKeys" 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 [StageKey]
stageKeys,
(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 (HashMap Text Text)
tags,
(Key
"value" 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
value
]
)
instance Data.ToPath CreateApiKey where
toPath :: CreateApiKey -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/apikeys"
instance Data.ToQuery CreateApiKey where
toQuery :: CreateApiKey -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty