{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AppSync.CreateGraphqlApi
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a @GraphqlApi@ object.
module Amazonka.AppSync.CreateGraphqlApi
  ( -- * Creating a Request
    CreateGraphqlApi (..),
    newCreateGraphqlApi,

    -- * Request Lenses
    createGraphqlApi_xrayEnabled,
    createGraphqlApi_openIDConnectConfig,
    createGraphqlApi_additionalAuthenticationProviders,
    createGraphqlApi_lambdaAuthorizerConfig,
    createGraphqlApi_userPoolConfig,
    createGraphqlApi_logConfig,
    createGraphqlApi_tags,
    createGraphqlApi_name,
    createGraphqlApi_authenticationType,

    -- * Destructuring the Response
    CreateGraphqlApiResponse (..),
    newCreateGraphqlApiResponse,

    -- * Response Lenses
    createGraphqlApiResponse_graphqlApi,
    createGraphqlApiResponse_httpStatus,
  )
where

import Amazonka.AppSync.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateGraphqlApi' smart constructor.
data CreateGraphqlApi = CreateGraphqlApi'
  { -- | A flag indicating whether to enable X-Ray tracing for the @GraphqlApi@.
    CreateGraphqlApi -> Maybe Bool
xrayEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The OpenID Connect configuration.
    CreateGraphqlApi -> Maybe OpenIDConnectConfig
openIDConnectConfig :: Prelude.Maybe OpenIDConnectConfig,
    -- | A list of additional authentication providers for the @GraphqlApi@ API.
    CreateGraphqlApi -> Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders :: Prelude.Maybe [AdditionalAuthenticationProvider],
    -- | Configuration for Amazon Web Services Lambda function authorization.
    CreateGraphqlApi -> Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig :: Prelude.Maybe LambdaAuthorizerConfig,
    -- | The Amazon Cognito user pool configuration.
    CreateGraphqlApi -> Maybe UserPoolConfig
userPoolConfig :: Prelude.Maybe UserPoolConfig,
    -- | The Amazon CloudWatch Logs configuration.
    CreateGraphqlApi -> Maybe LogConfig
logConfig :: Prelude.Maybe LogConfig,
    -- | A @TagMap@ object.
    CreateGraphqlApi -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A user-supplied name for the @GraphqlApi@.
    CreateGraphqlApi -> Text
name :: Prelude.Text,
    -- | The authentication type: API key, Identity and Access Management, OIDC,
    -- Amazon Cognito user pools, or Amazon Web Services Lambda.
    CreateGraphqlApi -> AuthenticationType
authenticationType :: AuthenticationType
  }
  deriving (CreateGraphqlApi -> CreateGraphqlApi -> Bool
(CreateGraphqlApi -> CreateGraphqlApi -> Bool)
-> (CreateGraphqlApi -> CreateGraphqlApi -> Bool)
-> Eq CreateGraphqlApi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGraphqlApi -> CreateGraphqlApi -> Bool
$c/= :: CreateGraphqlApi -> CreateGraphqlApi -> Bool
== :: CreateGraphqlApi -> CreateGraphqlApi -> Bool
$c== :: CreateGraphqlApi -> CreateGraphqlApi -> Bool
Prelude.Eq, ReadPrec [CreateGraphqlApi]
ReadPrec CreateGraphqlApi
Int -> ReadS CreateGraphqlApi
ReadS [CreateGraphqlApi]
(Int -> ReadS CreateGraphqlApi)
-> ReadS [CreateGraphqlApi]
-> ReadPrec CreateGraphqlApi
-> ReadPrec [CreateGraphqlApi]
-> Read CreateGraphqlApi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGraphqlApi]
$creadListPrec :: ReadPrec [CreateGraphqlApi]
readPrec :: ReadPrec CreateGraphqlApi
$creadPrec :: ReadPrec CreateGraphqlApi
readList :: ReadS [CreateGraphqlApi]
$creadList :: ReadS [CreateGraphqlApi]
readsPrec :: Int -> ReadS CreateGraphqlApi
$creadsPrec :: Int -> ReadS CreateGraphqlApi
Prelude.Read, Int -> CreateGraphqlApi -> ShowS
[CreateGraphqlApi] -> ShowS
CreateGraphqlApi -> String
(Int -> CreateGraphqlApi -> ShowS)
-> (CreateGraphqlApi -> String)
-> ([CreateGraphqlApi] -> ShowS)
-> Show CreateGraphqlApi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGraphqlApi] -> ShowS
$cshowList :: [CreateGraphqlApi] -> ShowS
show :: CreateGraphqlApi -> String
$cshow :: CreateGraphqlApi -> String
showsPrec :: Int -> CreateGraphqlApi -> ShowS
$cshowsPrec :: Int -> CreateGraphqlApi -> ShowS
Prelude.Show, (forall x. CreateGraphqlApi -> Rep CreateGraphqlApi x)
-> (forall x. Rep CreateGraphqlApi x -> CreateGraphqlApi)
-> Generic CreateGraphqlApi
forall x. Rep CreateGraphqlApi x -> CreateGraphqlApi
forall x. CreateGraphqlApi -> Rep CreateGraphqlApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGraphqlApi x -> CreateGraphqlApi
$cfrom :: forall x. CreateGraphqlApi -> Rep CreateGraphqlApi x
Prelude.Generic)

-- |
-- Create a value of 'CreateGraphqlApi' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'xrayEnabled', 'createGraphqlApi_xrayEnabled' - A flag indicating whether to enable X-Ray tracing for the @GraphqlApi@.
--
-- 'openIDConnectConfig', 'createGraphqlApi_openIDConnectConfig' - The OpenID Connect configuration.
--
-- 'additionalAuthenticationProviders', 'createGraphqlApi_additionalAuthenticationProviders' - A list of additional authentication providers for the @GraphqlApi@ API.
--
-- 'lambdaAuthorizerConfig', 'createGraphqlApi_lambdaAuthorizerConfig' - Configuration for Amazon Web Services Lambda function authorization.
--
-- 'userPoolConfig', 'createGraphqlApi_userPoolConfig' - The Amazon Cognito user pool configuration.
--
-- 'logConfig', 'createGraphqlApi_logConfig' - The Amazon CloudWatch Logs configuration.
--
-- 'tags', 'createGraphqlApi_tags' - A @TagMap@ object.
--
-- 'name', 'createGraphqlApi_name' - A user-supplied name for the @GraphqlApi@.
--
-- 'authenticationType', 'createGraphqlApi_authenticationType' - The authentication type: API key, Identity and Access Management, OIDC,
-- Amazon Cognito user pools, or Amazon Web Services Lambda.
newCreateGraphqlApi ::
  -- | 'name'
  Prelude.Text ->
  -- | 'authenticationType'
  AuthenticationType ->
  CreateGraphqlApi
newCreateGraphqlApi :: Text -> AuthenticationType -> CreateGraphqlApi
newCreateGraphqlApi Text
pName_ AuthenticationType
pAuthenticationType_ =
  CreateGraphqlApi' :: Maybe Bool
-> Maybe OpenIDConnectConfig
-> Maybe [AdditionalAuthenticationProvider]
-> Maybe LambdaAuthorizerConfig
-> Maybe UserPoolConfig
-> Maybe LogConfig
-> Maybe (HashMap Text Text)
-> Text
-> AuthenticationType
-> CreateGraphqlApi
CreateGraphqlApi'
    { $sel:xrayEnabled:CreateGraphqlApi' :: Maybe Bool
xrayEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:openIDConnectConfig:CreateGraphqlApi' :: Maybe OpenIDConnectConfig
openIDConnectConfig = Maybe OpenIDConnectConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:additionalAuthenticationProviders:CreateGraphqlApi' :: Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders = Maybe [AdditionalAuthenticationProvider]
forall a. Maybe a
Prelude.Nothing,
      $sel:lambdaAuthorizerConfig:CreateGraphqlApi' :: Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig = Maybe LambdaAuthorizerConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:userPoolConfig:CreateGraphqlApi' :: Maybe UserPoolConfig
userPoolConfig = Maybe UserPoolConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:logConfig:CreateGraphqlApi' :: Maybe LogConfig
logConfig = Maybe LogConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateGraphqlApi' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateGraphqlApi' :: Text
name = Text
pName_,
      $sel:authenticationType:CreateGraphqlApi' :: AuthenticationType
authenticationType = AuthenticationType
pAuthenticationType_
    }

-- | A flag indicating whether to enable X-Ray tracing for the @GraphqlApi@.
createGraphqlApi_xrayEnabled :: Lens.Lens' CreateGraphqlApi (Prelude.Maybe Prelude.Bool)
createGraphqlApi_xrayEnabled :: (Maybe Bool -> f (Maybe Bool))
-> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_xrayEnabled = (CreateGraphqlApi -> Maybe Bool)
-> (CreateGraphqlApi -> Maybe Bool -> CreateGraphqlApi)
-> Lens CreateGraphqlApi CreateGraphqlApi (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {Maybe Bool
xrayEnabled :: Maybe Bool
$sel:xrayEnabled:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe Bool
xrayEnabled} -> Maybe Bool
xrayEnabled) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} Maybe Bool
a -> CreateGraphqlApi
s {$sel:xrayEnabled:CreateGraphqlApi' :: Maybe Bool
xrayEnabled = Maybe Bool
a} :: CreateGraphqlApi)

-- | The OpenID Connect configuration.
createGraphqlApi_openIDConnectConfig :: Lens.Lens' CreateGraphqlApi (Prelude.Maybe OpenIDConnectConfig)
createGraphqlApi_openIDConnectConfig :: (Maybe OpenIDConnectConfig -> f (Maybe OpenIDConnectConfig))
-> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_openIDConnectConfig = (CreateGraphqlApi -> Maybe OpenIDConnectConfig)
-> (CreateGraphqlApi
    -> Maybe OpenIDConnectConfig -> CreateGraphqlApi)
-> Lens
     CreateGraphqlApi
     CreateGraphqlApi
     (Maybe OpenIDConnectConfig)
     (Maybe OpenIDConnectConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {Maybe OpenIDConnectConfig
openIDConnectConfig :: Maybe OpenIDConnectConfig
$sel:openIDConnectConfig:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe OpenIDConnectConfig
openIDConnectConfig} -> Maybe OpenIDConnectConfig
openIDConnectConfig) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} Maybe OpenIDConnectConfig
a -> CreateGraphqlApi
s {$sel:openIDConnectConfig:CreateGraphqlApi' :: Maybe OpenIDConnectConfig
openIDConnectConfig = Maybe OpenIDConnectConfig
a} :: CreateGraphqlApi)

-- | A list of additional authentication providers for the @GraphqlApi@ API.
createGraphqlApi_additionalAuthenticationProviders :: Lens.Lens' CreateGraphqlApi (Prelude.Maybe [AdditionalAuthenticationProvider])
createGraphqlApi_additionalAuthenticationProviders :: (Maybe [AdditionalAuthenticationProvider]
 -> f (Maybe [AdditionalAuthenticationProvider]))
-> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_additionalAuthenticationProviders = (CreateGraphqlApi -> Maybe [AdditionalAuthenticationProvider])
-> (CreateGraphqlApi
    -> Maybe [AdditionalAuthenticationProvider] -> CreateGraphqlApi)
-> Lens
     CreateGraphqlApi
     CreateGraphqlApi
     (Maybe [AdditionalAuthenticationProvider])
     (Maybe [AdditionalAuthenticationProvider])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders :: Maybe [AdditionalAuthenticationProvider]
$sel:additionalAuthenticationProviders:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders} -> Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} Maybe [AdditionalAuthenticationProvider]
a -> CreateGraphqlApi
s {$sel:additionalAuthenticationProviders:CreateGraphqlApi' :: Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders = Maybe [AdditionalAuthenticationProvider]
a} :: CreateGraphqlApi) ((Maybe [AdditionalAuthenticationProvider]
  -> f (Maybe [AdditionalAuthenticationProvider]))
 -> CreateGraphqlApi -> f CreateGraphqlApi)
-> ((Maybe [AdditionalAuthenticationProvider]
     -> f (Maybe [AdditionalAuthenticationProvider]))
    -> Maybe [AdditionalAuthenticationProvider]
    -> f (Maybe [AdditionalAuthenticationProvider]))
-> (Maybe [AdditionalAuthenticationProvider]
    -> f (Maybe [AdditionalAuthenticationProvider]))
-> CreateGraphqlApi
-> f CreateGraphqlApi
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AdditionalAuthenticationProvider]
  [AdditionalAuthenticationProvider]
  [AdditionalAuthenticationProvider]
  [AdditionalAuthenticationProvider]
-> Iso
     (Maybe [AdditionalAuthenticationProvider])
     (Maybe [AdditionalAuthenticationProvider])
     (Maybe [AdditionalAuthenticationProvider])
     (Maybe [AdditionalAuthenticationProvider])
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
  [AdditionalAuthenticationProvider]
  [AdditionalAuthenticationProvider]
  [AdditionalAuthenticationProvider]
  [AdditionalAuthenticationProvider]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Configuration for Amazon Web Services Lambda function authorization.
createGraphqlApi_lambdaAuthorizerConfig :: Lens.Lens' CreateGraphqlApi (Prelude.Maybe LambdaAuthorizerConfig)
createGraphqlApi_lambdaAuthorizerConfig :: (Maybe LambdaAuthorizerConfig -> f (Maybe LambdaAuthorizerConfig))
-> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_lambdaAuthorizerConfig = (CreateGraphqlApi -> Maybe LambdaAuthorizerConfig)
-> (CreateGraphqlApi
    -> Maybe LambdaAuthorizerConfig -> CreateGraphqlApi)
-> Lens
     CreateGraphqlApi
     CreateGraphqlApi
     (Maybe LambdaAuthorizerConfig)
     (Maybe LambdaAuthorizerConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig :: Maybe LambdaAuthorizerConfig
$sel:lambdaAuthorizerConfig:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig} -> Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} Maybe LambdaAuthorizerConfig
a -> CreateGraphqlApi
s {$sel:lambdaAuthorizerConfig:CreateGraphqlApi' :: Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig = Maybe LambdaAuthorizerConfig
a} :: CreateGraphqlApi)

-- | The Amazon Cognito user pool configuration.
createGraphqlApi_userPoolConfig :: Lens.Lens' CreateGraphqlApi (Prelude.Maybe UserPoolConfig)
createGraphqlApi_userPoolConfig :: (Maybe UserPoolConfig -> f (Maybe UserPoolConfig))
-> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_userPoolConfig = (CreateGraphqlApi -> Maybe UserPoolConfig)
-> (CreateGraphqlApi -> Maybe UserPoolConfig -> CreateGraphqlApi)
-> Lens
     CreateGraphqlApi
     CreateGraphqlApi
     (Maybe UserPoolConfig)
     (Maybe UserPoolConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {Maybe UserPoolConfig
userPoolConfig :: Maybe UserPoolConfig
$sel:userPoolConfig:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe UserPoolConfig
userPoolConfig} -> Maybe UserPoolConfig
userPoolConfig) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} Maybe UserPoolConfig
a -> CreateGraphqlApi
s {$sel:userPoolConfig:CreateGraphqlApi' :: Maybe UserPoolConfig
userPoolConfig = Maybe UserPoolConfig
a} :: CreateGraphqlApi)

-- | The Amazon CloudWatch Logs configuration.
createGraphqlApi_logConfig :: Lens.Lens' CreateGraphqlApi (Prelude.Maybe LogConfig)
createGraphqlApi_logConfig :: (Maybe LogConfig -> f (Maybe LogConfig))
-> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_logConfig = (CreateGraphqlApi -> Maybe LogConfig)
-> (CreateGraphqlApi -> Maybe LogConfig -> CreateGraphqlApi)
-> Lens
     CreateGraphqlApi
     CreateGraphqlApi
     (Maybe LogConfig)
     (Maybe LogConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {Maybe LogConfig
logConfig :: Maybe LogConfig
$sel:logConfig:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe LogConfig
logConfig} -> Maybe LogConfig
logConfig) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} Maybe LogConfig
a -> CreateGraphqlApi
s {$sel:logConfig:CreateGraphqlApi' :: Maybe LogConfig
logConfig = Maybe LogConfig
a} :: CreateGraphqlApi)

-- | A @TagMap@ object.
createGraphqlApi_tags :: Lens.Lens' CreateGraphqlApi (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createGraphqlApi_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_tags = (CreateGraphqlApi -> Maybe (HashMap Text Text))
-> (CreateGraphqlApi
    -> Maybe (HashMap Text Text) -> CreateGraphqlApi)
-> Lens
     CreateGraphqlApi
     CreateGraphqlApi
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} Maybe (HashMap Text Text)
a -> CreateGraphqlApi
s {$sel:tags:CreateGraphqlApi' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateGraphqlApi) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateGraphqlApi -> f CreateGraphqlApi)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateGraphqlApi
-> f CreateGraphqlApi
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text 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
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A user-supplied name for the @GraphqlApi@.
createGraphqlApi_name :: Lens.Lens' CreateGraphqlApi Prelude.Text
createGraphqlApi_name :: (Text -> f Text) -> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_name = (CreateGraphqlApi -> Text)
-> (CreateGraphqlApi -> Text -> CreateGraphqlApi)
-> Lens CreateGraphqlApi CreateGraphqlApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {Text
name :: Text
$sel:name:CreateGraphqlApi' :: CreateGraphqlApi -> Text
name} -> Text
name) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} Text
a -> CreateGraphqlApi
s {$sel:name:CreateGraphqlApi' :: Text
name = Text
a} :: CreateGraphqlApi)

-- | The authentication type: API key, Identity and Access Management, OIDC,
-- Amazon Cognito user pools, or Amazon Web Services Lambda.
createGraphqlApi_authenticationType :: Lens.Lens' CreateGraphqlApi AuthenticationType
createGraphqlApi_authenticationType :: (AuthenticationType -> f AuthenticationType)
-> CreateGraphqlApi -> f CreateGraphqlApi
createGraphqlApi_authenticationType = (CreateGraphqlApi -> AuthenticationType)
-> (CreateGraphqlApi -> AuthenticationType -> CreateGraphqlApi)
-> Lens
     CreateGraphqlApi
     CreateGraphqlApi
     AuthenticationType
     AuthenticationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApi' {AuthenticationType
authenticationType :: AuthenticationType
$sel:authenticationType:CreateGraphqlApi' :: CreateGraphqlApi -> AuthenticationType
authenticationType} -> AuthenticationType
authenticationType) (\s :: CreateGraphqlApi
s@CreateGraphqlApi' {} AuthenticationType
a -> CreateGraphqlApi
s {$sel:authenticationType:CreateGraphqlApi' :: AuthenticationType
authenticationType = AuthenticationType
a} :: CreateGraphqlApi)

instance Core.AWSRequest CreateGraphqlApi where
  type
    AWSResponse CreateGraphqlApi =
      CreateGraphqlApiResponse
  request :: CreateGraphqlApi -> Request CreateGraphqlApi
request = Service -> CreateGraphqlApi -> Request CreateGraphqlApi
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGraphqlApi)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateGraphqlApi))
-> Logger
-> Service
-> Proxy CreateGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGraphqlApi)))
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 GraphqlApi -> Int -> CreateGraphqlApiResponse
CreateGraphqlApiResponse'
            (Maybe GraphqlApi -> Int -> CreateGraphqlApiResponse)
-> Either String (Maybe GraphqlApi)
-> Either String (Int -> CreateGraphqlApiResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GraphqlApi)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"graphqlApi")
            Either String (Int -> CreateGraphqlApiResponse)
-> Either String Int -> Either String CreateGraphqlApiResponse
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 CreateGraphqlApi

instance Prelude.NFData CreateGraphqlApi

instance Core.ToHeaders CreateGraphqlApi where
  toHeaders :: CreateGraphqlApi -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateGraphqlApi -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 CreateGraphqlApi where
  toJSON :: CreateGraphqlApi -> Value
toJSON CreateGraphqlApi' {Maybe Bool
Maybe [AdditionalAuthenticationProvider]
Maybe (HashMap Text Text)
Maybe LambdaAuthorizerConfig
Maybe LogConfig
Maybe OpenIDConnectConfig
Maybe UserPoolConfig
Text
AuthenticationType
authenticationType :: AuthenticationType
name :: Text
tags :: Maybe (HashMap Text Text)
logConfig :: Maybe LogConfig
userPoolConfig :: Maybe UserPoolConfig
lambdaAuthorizerConfig :: Maybe LambdaAuthorizerConfig
additionalAuthenticationProviders :: Maybe [AdditionalAuthenticationProvider]
openIDConnectConfig :: Maybe OpenIDConnectConfig
xrayEnabled :: Maybe Bool
$sel:authenticationType:CreateGraphqlApi' :: CreateGraphqlApi -> AuthenticationType
$sel:name:CreateGraphqlApi' :: CreateGraphqlApi -> Text
$sel:tags:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe (HashMap Text Text)
$sel:logConfig:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe LogConfig
$sel:userPoolConfig:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe UserPoolConfig
$sel:lambdaAuthorizerConfig:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe LambdaAuthorizerConfig
$sel:additionalAuthenticationProviders:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe [AdditionalAuthenticationProvider]
$sel:openIDConnectConfig:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe OpenIDConnectConfig
$sel:xrayEnabled:CreateGraphqlApi' :: CreateGraphqlApi -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"xrayEnabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
xrayEnabled,
            (Text
"openIDConnectConfig" Text -> OpenIDConnectConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (OpenIDConnectConfig -> Pair)
-> Maybe OpenIDConnectConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OpenIDConnectConfig
openIDConnectConfig,
            (Text
"additionalAuthenticationProviders" Text -> [AdditionalAuthenticationProvider] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AdditionalAuthenticationProvider] -> Pair)
-> Maybe [AdditionalAuthenticationProvider] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders,
            (Text
"lambdaAuthorizerConfig" Text -> LambdaAuthorizerConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LambdaAuthorizerConfig -> Pair)
-> Maybe LambdaAuthorizerConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig,
            (Text
"userPoolConfig" Text -> UserPoolConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (UserPoolConfig -> Pair) -> Maybe UserPoolConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe UserPoolConfig
userPoolConfig,
            (Text
"logConfig" Text -> LogConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LogConfig -> Pair) -> Maybe LogConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LogConfig
logConfig,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"authenticationType" Text -> AuthenticationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AuthenticationType
authenticationType)
          ]
      )

instance Core.ToPath CreateGraphqlApi where
  toPath :: CreateGraphqlApi -> ByteString
toPath = ByteString -> CreateGraphqlApi -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/apis"

instance Core.ToQuery CreateGraphqlApi where
  toQuery :: CreateGraphqlApi -> QueryString
toQuery = QueryString -> CreateGraphqlApi -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateGraphqlApiResponse' smart constructor.
data CreateGraphqlApiResponse = CreateGraphqlApiResponse'
  { -- | The @GraphqlApi@.
    CreateGraphqlApiResponse -> Maybe GraphqlApi
graphqlApi :: Prelude.Maybe GraphqlApi,
    -- | The response's http status code.
    CreateGraphqlApiResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateGraphqlApiResponse -> CreateGraphqlApiResponse -> Bool
(CreateGraphqlApiResponse -> CreateGraphqlApiResponse -> Bool)
-> (CreateGraphqlApiResponse -> CreateGraphqlApiResponse -> Bool)
-> Eq CreateGraphqlApiResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGraphqlApiResponse -> CreateGraphqlApiResponse -> Bool
$c/= :: CreateGraphqlApiResponse -> CreateGraphqlApiResponse -> Bool
== :: CreateGraphqlApiResponse -> CreateGraphqlApiResponse -> Bool
$c== :: CreateGraphqlApiResponse -> CreateGraphqlApiResponse -> Bool
Prelude.Eq, ReadPrec [CreateGraphqlApiResponse]
ReadPrec CreateGraphqlApiResponse
Int -> ReadS CreateGraphqlApiResponse
ReadS [CreateGraphqlApiResponse]
(Int -> ReadS CreateGraphqlApiResponse)
-> ReadS [CreateGraphqlApiResponse]
-> ReadPrec CreateGraphqlApiResponse
-> ReadPrec [CreateGraphqlApiResponse]
-> Read CreateGraphqlApiResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGraphqlApiResponse]
$creadListPrec :: ReadPrec [CreateGraphqlApiResponse]
readPrec :: ReadPrec CreateGraphqlApiResponse
$creadPrec :: ReadPrec CreateGraphqlApiResponse
readList :: ReadS [CreateGraphqlApiResponse]
$creadList :: ReadS [CreateGraphqlApiResponse]
readsPrec :: Int -> ReadS CreateGraphqlApiResponse
$creadsPrec :: Int -> ReadS CreateGraphqlApiResponse
Prelude.Read, Int -> CreateGraphqlApiResponse -> ShowS
[CreateGraphqlApiResponse] -> ShowS
CreateGraphqlApiResponse -> String
(Int -> CreateGraphqlApiResponse -> ShowS)
-> (CreateGraphqlApiResponse -> String)
-> ([CreateGraphqlApiResponse] -> ShowS)
-> Show CreateGraphqlApiResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGraphqlApiResponse] -> ShowS
$cshowList :: [CreateGraphqlApiResponse] -> ShowS
show :: CreateGraphqlApiResponse -> String
$cshow :: CreateGraphqlApiResponse -> String
showsPrec :: Int -> CreateGraphqlApiResponse -> ShowS
$cshowsPrec :: Int -> CreateGraphqlApiResponse -> ShowS
Prelude.Show, (forall x.
 CreateGraphqlApiResponse -> Rep CreateGraphqlApiResponse x)
-> (forall x.
    Rep CreateGraphqlApiResponse x -> CreateGraphqlApiResponse)
-> Generic CreateGraphqlApiResponse
forall x.
Rep CreateGraphqlApiResponse x -> CreateGraphqlApiResponse
forall x.
CreateGraphqlApiResponse -> Rep CreateGraphqlApiResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateGraphqlApiResponse x -> CreateGraphqlApiResponse
$cfrom :: forall x.
CreateGraphqlApiResponse -> Rep CreateGraphqlApiResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateGraphqlApiResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'graphqlApi', 'createGraphqlApiResponse_graphqlApi' - The @GraphqlApi@.
--
-- 'httpStatus', 'createGraphqlApiResponse_httpStatus' - The response's http status code.
newCreateGraphqlApiResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateGraphqlApiResponse
newCreateGraphqlApiResponse :: Int -> CreateGraphqlApiResponse
newCreateGraphqlApiResponse Int
pHttpStatus_ =
  CreateGraphqlApiResponse' :: Maybe GraphqlApi -> Int -> CreateGraphqlApiResponse
CreateGraphqlApiResponse'
    { $sel:graphqlApi:CreateGraphqlApiResponse' :: Maybe GraphqlApi
graphqlApi =
        Maybe GraphqlApi
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateGraphqlApiResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The @GraphqlApi@.
createGraphqlApiResponse_graphqlApi :: Lens.Lens' CreateGraphqlApiResponse (Prelude.Maybe GraphqlApi)
createGraphqlApiResponse_graphqlApi :: (Maybe GraphqlApi -> f (Maybe GraphqlApi))
-> CreateGraphqlApiResponse -> f CreateGraphqlApiResponse
createGraphqlApiResponse_graphqlApi = (CreateGraphqlApiResponse -> Maybe GraphqlApi)
-> (CreateGraphqlApiResponse
    -> Maybe GraphqlApi -> CreateGraphqlApiResponse)
-> Lens
     CreateGraphqlApiResponse
     CreateGraphqlApiResponse
     (Maybe GraphqlApi)
     (Maybe GraphqlApi)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApiResponse' {Maybe GraphqlApi
graphqlApi :: Maybe GraphqlApi
$sel:graphqlApi:CreateGraphqlApiResponse' :: CreateGraphqlApiResponse -> Maybe GraphqlApi
graphqlApi} -> Maybe GraphqlApi
graphqlApi) (\s :: CreateGraphqlApiResponse
s@CreateGraphqlApiResponse' {} Maybe GraphqlApi
a -> CreateGraphqlApiResponse
s {$sel:graphqlApi:CreateGraphqlApiResponse' :: Maybe GraphqlApi
graphqlApi = Maybe GraphqlApi
a} :: CreateGraphqlApiResponse)

-- | The response's http status code.
createGraphqlApiResponse_httpStatus :: Lens.Lens' CreateGraphqlApiResponse Prelude.Int
createGraphqlApiResponse_httpStatus :: (Int -> f Int)
-> CreateGraphqlApiResponse -> f CreateGraphqlApiResponse
createGraphqlApiResponse_httpStatus = (CreateGraphqlApiResponse -> Int)
-> (CreateGraphqlApiResponse -> Int -> CreateGraphqlApiResponse)
-> Lens CreateGraphqlApiResponse CreateGraphqlApiResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGraphqlApiResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateGraphqlApiResponse' :: CreateGraphqlApiResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateGraphqlApiResponse
s@CreateGraphqlApiResponse' {} Int
a -> CreateGraphqlApiResponse
s {$sel:httpStatus:CreateGraphqlApiResponse' :: Int
httpStatus = Int
a} :: CreateGraphqlApiResponse)

instance Prelude.NFData CreateGraphqlApiResponse