{-# 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.UpdateGraphqlApi
-- 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)
--
-- Updates a @GraphqlApi@ object.
module Amazonka.AppSync.UpdateGraphqlApi
  ( -- * Creating a Request
    UpdateGraphqlApi (..),
    newUpdateGraphqlApi,

    -- * Request Lenses
    updateGraphqlApi_xrayEnabled,
    updateGraphqlApi_openIDConnectConfig,
    updateGraphqlApi_additionalAuthenticationProviders,
    updateGraphqlApi_lambdaAuthorizerConfig,
    updateGraphqlApi_userPoolConfig,
    updateGraphqlApi_authenticationType,
    updateGraphqlApi_logConfig,
    updateGraphqlApi_apiId,
    updateGraphqlApi_name,

    -- * Destructuring the Response
    UpdateGraphqlApiResponse (..),
    newUpdateGraphqlApiResponse,

    -- * Response Lenses
    updateGraphqlApiResponse_graphqlApi,
    updateGraphqlApiResponse_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:/ 'newUpdateGraphqlApi' smart constructor.
data UpdateGraphqlApi = UpdateGraphqlApi'
  { -- | A flag indicating whether to enable X-Ray tracing for the @GraphqlApi@.
    UpdateGraphqlApi -> Maybe Bool
xrayEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The OpenID Connect configuration for the @GraphqlApi@ object.
    UpdateGraphqlApi -> Maybe OpenIDConnectConfig
openIDConnectConfig :: Prelude.Maybe OpenIDConnectConfig,
    -- | A list of additional authentication providers for the @GraphqlApi@ API.
    UpdateGraphqlApi -> Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders :: Prelude.Maybe [AdditionalAuthenticationProvider],
    -- | Configuration for Amazon Web Services Lambda function authorization.
    UpdateGraphqlApi -> Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig :: Prelude.Maybe LambdaAuthorizerConfig,
    -- | The new Amazon Cognito user pool configuration for the @GraphqlApi@
    -- object.
    UpdateGraphqlApi -> Maybe UserPoolConfig
userPoolConfig :: Prelude.Maybe UserPoolConfig,
    -- | The new authentication type for the @GraphqlApi@ object.
    UpdateGraphqlApi -> Maybe AuthenticationType
authenticationType :: Prelude.Maybe AuthenticationType,
    -- | The Amazon CloudWatch Logs configuration for the @GraphqlApi@ object.
    UpdateGraphqlApi -> Maybe LogConfig
logConfig :: Prelude.Maybe LogConfig,
    -- | The API ID.
    UpdateGraphqlApi -> Text
apiId :: Prelude.Text,
    -- | The new name for the @GraphqlApi@ object.
    UpdateGraphqlApi -> Text
name :: Prelude.Text
  }
  deriving (UpdateGraphqlApi -> UpdateGraphqlApi -> Bool
(UpdateGraphqlApi -> UpdateGraphqlApi -> Bool)
-> (UpdateGraphqlApi -> UpdateGraphqlApi -> Bool)
-> Eq UpdateGraphqlApi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateGraphqlApi -> UpdateGraphqlApi -> Bool
$c/= :: UpdateGraphqlApi -> UpdateGraphqlApi -> Bool
== :: UpdateGraphqlApi -> UpdateGraphqlApi -> Bool
$c== :: UpdateGraphqlApi -> UpdateGraphqlApi -> Bool
Prelude.Eq, ReadPrec [UpdateGraphqlApi]
ReadPrec UpdateGraphqlApi
Int -> ReadS UpdateGraphqlApi
ReadS [UpdateGraphqlApi]
(Int -> ReadS UpdateGraphqlApi)
-> ReadS [UpdateGraphqlApi]
-> ReadPrec UpdateGraphqlApi
-> ReadPrec [UpdateGraphqlApi]
-> Read UpdateGraphqlApi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateGraphqlApi]
$creadListPrec :: ReadPrec [UpdateGraphqlApi]
readPrec :: ReadPrec UpdateGraphqlApi
$creadPrec :: ReadPrec UpdateGraphqlApi
readList :: ReadS [UpdateGraphqlApi]
$creadList :: ReadS [UpdateGraphqlApi]
readsPrec :: Int -> ReadS UpdateGraphqlApi
$creadsPrec :: Int -> ReadS UpdateGraphqlApi
Prelude.Read, Int -> UpdateGraphqlApi -> ShowS
[UpdateGraphqlApi] -> ShowS
UpdateGraphqlApi -> String
(Int -> UpdateGraphqlApi -> ShowS)
-> (UpdateGraphqlApi -> String)
-> ([UpdateGraphqlApi] -> ShowS)
-> Show UpdateGraphqlApi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateGraphqlApi] -> ShowS
$cshowList :: [UpdateGraphqlApi] -> ShowS
show :: UpdateGraphqlApi -> String
$cshow :: UpdateGraphqlApi -> String
showsPrec :: Int -> UpdateGraphqlApi -> ShowS
$cshowsPrec :: Int -> UpdateGraphqlApi -> ShowS
Prelude.Show, (forall x. UpdateGraphqlApi -> Rep UpdateGraphqlApi x)
-> (forall x. Rep UpdateGraphqlApi x -> UpdateGraphqlApi)
-> Generic UpdateGraphqlApi
forall x. Rep UpdateGraphqlApi x -> UpdateGraphqlApi
forall x. UpdateGraphqlApi -> Rep UpdateGraphqlApi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateGraphqlApi x -> UpdateGraphqlApi
$cfrom :: forall x. UpdateGraphqlApi -> Rep UpdateGraphqlApi x
Prelude.Generic)

-- |
-- Create a value of 'UpdateGraphqlApi' 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', 'updateGraphqlApi_xrayEnabled' - A flag indicating whether to enable X-Ray tracing for the @GraphqlApi@.
--
-- 'openIDConnectConfig', 'updateGraphqlApi_openIDConnectConfig' - The OpenID Connect configuration for the @GraphqlApi@ object.
--
-- 'additionalAuthenticationProviders', 'updateGraphqlApi_additionalAuthenticationProviders' - A list of additional authentication providers for the @GraphqlApi@ API.
--
-- 'lambdaAuthorizerConfig', 'updateGraphqlApi_lambdaAuthorizerConfig' - Configuration for Amazon Web Services Lambda function authorization.
--
-- 'userPoolConfig', 'updateGraphqlApi_userPoolConfig' - The new Amazon Cognito user pool configuration for the @GraphqlApi@
-- object.
--
-- 'authenticationType', 'updateGraphqlApi_authenticationType' - The new authentication type for the @GraphqlApi@ object.
--
-- 'logConfig', 'updateGraphqlApi_logConfig' - The Amazon CloudWatch Logs configuration for the @GraphqlApi@ object.
--
-- 'apiId', 'updateGraphqlApi_apiId' - The API ID.
--
-- 'name', 'updateGraphqlApi_name' - The new name for the @GraphqlApi@ object.
newUpdateGraphqlApi ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  UpdateGraphqlApi
newUpdateGraphqlApi :: Text -> Text -> UpdateGraphqlApi
newUpdateGraphqlApi Text
pApiId_ Text
pName_ =
  UpdateGraphqlApi' :: Maybe Bool
-> Maybe OpenIDConnectConfig
-> Maybe [AdditionalAuthenticationProvider]
-> Maybe LambdaAuthorizerConfig
-> Maybe UserPoolConfig
-> Maybe AuthenticationType
-> Maybe LogConfig
-> Text
-> Text
-> UpdateGraphqlApi
UpdateGraphqlApi'
    { $sel:xrayEnabled:UpdateGraphqlApi' :: Maybe Bool
xrayEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:openIDConnectConfig:UpdateGraphqlApi' :: Maybe OpenIDConnectConfig
openIDConnectConfig = Maybe OpenIDConnectConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:additionalAuthenticationProviders:UpdateGraphqlApi' :: Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders = Maybe [AdditionalAuthenticationProvider]
forall a. Maybe a
Prelude.Nothing,
      $sel:lambdaAuthorizerConfig:UpdateGraphqlApi' :: Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig = Maybe LambdaAuthorizerConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:userPoolConfig:UpdateGraphqlApi' :: Maybe UserPoolConfig
userPoolConfig = Maybe UserPoolConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationType:UpdateGraphqlApi' :: Maybe AuthenticationType
authenticationType = Maybe AuthenticationType
forall a. Maybe a
Prelude.Nothing,
      $sel:logConfig:UpdateGraphqlApi' :: Maybe LogConfig
logConfig = Maybe LogConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:apiId:UpdateGraphqlApi' :: Text
apiId = Text
pApiId_,
      $sel:name:UpdateGraphqlApi' :: Text
name = Text
pName_
    }

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

-- | The OpenID Connect configuration for the @GraphqlApi@ object.
updateGraphqlApi_openIDConnectConfig :: Lens.Lens' UpdateGraphqlApi (Prelude.Maybe OpenIDConnectConfig)
updateGraphqlApi_openIDConnectConfig :: (Maybe OpenIDConnectConfig -> f (Maybe OpenIDConnectConfig))
-> UpdateGraphqlApi -> f UpdateGraphqlApi
updateGraphqlApi_openIDConnectConfig = (UpdateGraphqlApi -> Maybe OpenIDConnectConfig)
-> (UpdateGraphqlApi
    -> Maybe OpenIDConnectConfig -> UpdateGraphqlApi)
-> Lens
     UpdateGraphqlApi
     UpdateGraphqlApi
     (Maybe OpenIDConnectConfig)
     (Maybe OpenIDConnectConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGraphqlApi' {Maybe OpenIDConnectConfig
openIDConnectConfig :: Maybe OpenIDConnectConfig
$sel:openIDConnectConfig:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe OpenIDConnectConfig
openIDConnectConfig} -> Maybe OpenIDConnectConfig
openIDConnectConfig) (\s :: UpdateGraphqlApi
s@UpdateGraphqlApi' {} Maybe OpenIDConnectConfig
a -> UpdateGraphqlApi
s {$sel:openIDConnectConfig:UpdateGraphqlApi' :: Maybe OpenIDConnectConfig
openIDConnectConfig = Maybe OpenIDConnectConfig
a} :: UpdateGraphqlApi)

-- | A list of additional authentication providers for the @GraphqlApi@ API.
updateGraphqlApi_additionalAuthenticationProviders :: Lens.Lens' UpdateGraphqlApi (Prelude.Maybe [AdditionalAuthenticationProvider])
updateGraphqlApi_additionalAuthenticationProviders :: (Maybe [AdditionalAuthenticationProvider]
 -> f (Maybe [AdditionalAuthenticationProvider]))
-> UpdateGraphqlApi -> f UpdateGraphqlApi
updateGraphqlApi_additionalAuthenticationProviders = (UpdateGraphqlApi -> Maybe [AdditionalAuthenticationProvider])
-> (UpdateGraphqlApi
    -> Maybe [AdditionalAuthenticationProvider] -> UpdateGraphqlApi)
-> Lens
     UpdateGraphqlApi
     UpdateGraphqlApi
     (Maybe [AdditionalAuthenticationProvider])
     (Maybe [AdditionalAuthenticationProvider])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGraphqlApi' {Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders :: Maybe [AdditionalAuthenticationProvider]
$sel:additionalAuthenticationProviders:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders} -> Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders) (\s :: UpdateGraphqlApi
s@UpdateGraphqlApi' {} Maybe [AdditionalAuthenticationProvider]
a -> UpdateGraphqlApi
s {$sel:additionalAuthenticationProviders:UpdateGraphqlApi' :: Maybe [AdditionalAuthenticationProvider]
additionalAuthenticationProviders = Maybe [AdditionalAuthenticationProvider]
a} :: UpdateGraphqlApi) ((Maybe [AdditionalAuthenticationProvider]
  -> f (Maybe [AdditionalAuthenticationProvider]))
 -> UpdateGraphqlApi -> f UpdateGraphqlApi)
-> ((Maybe [AdditionalAuthenticationProvider]
     -> f (Maybe [AdditionalAuthenticationProvider]))
    -> Maybe [AdditionalAuthenticationProvider]
    -> f (Maybe [AdditionalAuthenticationProvider]))
-> (Maybe [AdditionalAuthenticationProvider]
    -> f (Maybe [AdditionalAuthenticationProvider]))
-> UpdateGraphqlApi
-> f UpdateGraphqlApi
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.
updateGraphqlApi_lambdaAuthorizerConfig :: Lens.Lens' UpdateGraphqlApi (Prelude.Maybe LambdaAuthorizerConfig)
updateGraphqlApi_lambdaAuthorizerConfig :: (Maybe LambdaAuthorizerConfig -> f (Maybe LambdaAuthorizerConfig))
-> UpdateGraphqlApi -> f UpdateGraphqlApi
updateGraphqlApi_lambdaAuthorizerConfig = (UpdateGraphqlApi -> Maybe LambdaAuthorizerConfig)
-> (UpdateGraphqlApi
    -> Maybe LambdaAuthorizerConfig -> UpdateGraphqlApi)
-> Lens
     UpdateGraphqlApi
     UpdateGraphqlApi
     (Maybe LambdaAuthorizerConfig)
     (Maybe LambdaAuthorizerConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGraphqlApi' {Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig :: Maybe LambdaAuthorizerConfig
$sel:lambdaAuthorizerConfig:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig} -> Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig) (\s :: UpdateGraphqlApi
s@UpdateGraphqlApi' {} Maybe LambdaAuthorizerConfig
a -> UpdateGraphqlApi
s {$sel:lambdaAuthorizerConfig:UpdateGraphqlApi' :: Maybe LambdaAuthorizerConfig
lambdaAuthorizerConfig = Maybe LambdaAuthorizerConfig
a} :: UpdateGraphqlApi)

-- | The new Amazon Cognito user pool configuration for the @GraphqlApi@
-- object.
updateGraphqlApi_userPoolConfig :: Lens.Lens' UpdateGraphqlApi (Prelude.Maybe UserPoolConfig)
updateGraphqlApi_userPoolConfig :: (Maybe UserPoolConfig -> f (Maybe UserPoolConfig))
-> UpdateGraphqlApi -> f UpdateGraphqlApi
updateGraphqlApi_userPoolConfig = (UpdateGraphqlApi -> Maybe UserPoolConfig)
-> (UpdateGraphqlApi -> Maybe UserPoolConfig -> UpdateGraphqlApi)
-> Lens
     UpdateGraphqlApi
     UpdateGraphqlApi
     (Maybe UserPoolConfig)
     (Maybe UserPoolConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGraphqlApi' {Maybe UserPoolConfig
userPoolConfig :: Maybe UserPoolConfig
$sel:userPoolConfig:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe UserPoolConfig
userPoolConfig} -> Maybe UserPoolConfig
userPoolConfig) (\s :: UpdateGraphqlApi
s@UpdateGraphqlApi' {} Maybe UserPoolConfig
a -> UpdateGraphqlApi
s {$sel:userPoolConfig:UpdateGraphqlApi' :: Maybe UserPoolConfig
userPoolConfig = Maybe UserPoolConfig
a} :: UpdateGraphqlApi)

-- | The new authentication type for the @GraphqlApi@ object.
updateGraphqlApi_authenticationType :: Lens.Lens' UpdateGraphqlApi (Prelude.Maybe AuthenticationType)
updateGraphqlApi_authenticationType :: (Maybe AuthenticationType -> f (Maybe AuthenticationType))
-> UpdateGraphqlApi -> f UpdateGraphqlApi
updateGraphqlApi_authenticationType = (UpdateGraphqlApi -> Maybe AuthenticationType)
-> (UpdateGraphqlApi
    -> Maybe AuthenticationType -> UpdateGraphqlApi)
-> Lens
     UpdateGraphqlApi
     UpdateGraphqlApi
     (Maybe AuthenticationType)
     (Maybe AuthenticationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGraphqlApi' {Maybe AuthenticationType
authenticationType :: Maybe AuthenticationType
$sel:authenticationType:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe AuthenticationType
authenticationType} -> Maybe AuthenticationType
authenticationType) (\s :: UpdateGraphqlApi
s@UpdateGraphqlApi' {} Maybe AuthenticationType
a -> UpdateGraphqlApi
s {$sel:authenticationType:UpdateGraphqlApi' :: Maybe AuthenticationType
authenticationType = Maybe AuthenticationType
a} :: UpdateGraphqlApi)

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

-- | The API ID.
updateGraphqlApi_apiId :: Lens.Lens' UpdateGraphqlApi Prelude.Text
updateGraphqlApi_apiId :: (Text -> f Text) -> UpdateGraphqlApi -> f UpdateGraphqlApi
updateGraphqlApi_apiId = (UpdateGraphqlApi -> Text)
-> (UpdateGraphqlApi -> Text -> UpdateGraphqlApi)
-> Lens UpdateGraphqlApi UpdateGraphqlApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGraphqlApi' {Text
apiId :: Text
$sel:apiId:UpdateGraphqlApi' :: UpdateGraphqlApi -> Text
apiId} -> Text
apiId) (\s :: UpdateGraphqlApi
s@UpdateGraphqlApi' {} Text
a -> UpdateGraphqlApi
s {$sel:apiId:UpdateGraphqlApi' :: Text
apiId = Text
a} :: UpdateGraphqlApi)

-- | The new name for the @GraphqlApi@ object.
updateGraphqlApi_name :: Lens.Lens' UpdateGraphqlApi Prelude.Text
updateGraphqlApi_name :: (Text -> f Text) -> UpdateGraphqlApi -> f UpdateGraphqlApi
updateGraphqlApi_name = (UpdateGraphqlApi -> Text)
-> (UpdateGraphqlApi -> Text -> UpdateGraphqlApi)
-> Lens UpdateGraphqlApi UpdateGraphqlApi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateGraphqlApi' {Text
name :: Text
$sel:name:UpdateGraphqlApi' :: UpdateGraphqlApi -> Text
name} -> Text
name) (\s :: UpdateGraphqlApi
s@UpdateGraphqlApi' {} Text
a -> UpdateGraphqlApi
s {$sel:name:UpdateGraphqlApi' :: Text
name = Text
a} :: UpdateGraphqlApi)

instance Core.AWSRequest UpdateGraphqlApi where
  type
    AWSResponse UpdateGraphqlApi =
      UpdateGraphqlApiResponse
  request :: UpdateGraphqlApi -> Request UpdateGraphqlApi
request = Service -> UpdateGraphqlApi -> Request UpdateGraphqlApi
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateGraphqlApi)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateGraphqlApi))
-> Logger
-> Service
-> Proxy UpdateGraphqlApi
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateGraphqlApi)))
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 -> UpdateGraphqlApiResponse
UpdateGraphqlApiResponse'
            (Maybe GraphqlApi -> Int -> UpdateGraphqlApiResponse)
-> Either String (Maybe GraphqlApi)
-> Either String (Int -> UpdateGraphqlApiResponse)
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 -> UpdateGraphqlApiResponse)
-> Either String Int -> Either String UpdateGraphqlApiResponse
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 UpdateGraphqlApi

instance Prelude.NFData UpdateGraphqlApi

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

instance Core.ToPath UpdateGraphqlApi where
  toPath :: UpdateGraphqlApi -> ByteString
toPath UpdateGraphqlApi' {Maybe Bool
Maybe [AdditionalAuthenticationProvider]
Maybe AuthenticationType
Maybe LambdaAuthorizerConfig
Maybe LogConfig
Maybe OpenIDConnectConfig
Maybe UserPoolConfig
Text
name :: Text
apiId :: Text
logConfig :: Maybe LogConfig
authenticationType :: Maybe AuthenticationType
userPoolConfig :: Maybe UserPoolConfig
lambdaAuthorizerConfig :: Maybe LambdaAuthorizerConfig
additionalAuthenticationProviders :: Maybe [AdditionalAuthenticationProvider]
openIDConnectConfig :: Maybe OpenIDConnectConfig
xrayEnabled :: Maybe Bool
$sel:name:UpdateGraphqlApi' :: UpdateGraphqlApi -> Text
$sel:apiId:UpdateGraphqlApi' :: UpdateGraphqlApi -> Text
$sel:logConfig:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe LogConfig
$sel:authenticationType:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe AuthenticationType
$sel:userPoolConfig:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe UserPoolConfig
$sel:lambdaAuthorizerConfig:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe LambdaAuthorizerConfig
$sel:additionalAuthenticationProviders:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe [AdditionalAuthenticationProvider]
$sel:openIDConnectConfig:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe OpenIDConnectConfig
$sel:xrayEnabled:UpdateGraphqlApi' :: UpdateGraphqlApi -> Maybe Bool
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/v1/apis/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
apiId]

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

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

-- |
-- Create a value of 'UpdateGraphqlApiResponse' 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', 'updateGraphqlApiResponse_graphqlApi' - The updated @GraphqlApi@ object.
--
-- 'httpStatus', 'updateGraphqlApiResponse_httpStatus' - The response's http status code.
newUpdateGraphqlApiResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateGraphqlApiResponse
newUpdateGraphqlApiResponse :: Int -> UpdateGraphqlApiResponse
newUpdateGraphqlApiResponse Int
pHttpStatus_ =
  UpdateGraphqlApiResponse' :: Maybe GraphqlApi -> Int -> UpdateGraphqlApiResponse
UpdateGraphqlApiResponse'
    { $sel:graphqlApi:UpdateGraphqlApiResponse' :: Maybe GraphqlApi
graphqlApi =
        Maybe GraphqlApi
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateGraphqlApiResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance Prelude.NFData UpdateGraphqlApiResponse