{-# 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.UpdateResolver
-- 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 @Resolver@ object.
module Amazonka.AppSync.UpdateResolver
  ( -- * Creating a Request
    UpdateResolver (..),
    newUpdateResolver,

    -- * Request Lenses
    updateResolver_dataSourceName,
    updateResolver_requestMappingTemplate,
    updateResolver_kind,
    updateResolver_cachingConfig,
    updateResolver_responseMappingTemplate,
    updateResolver_syncConfig,
    updateResolver_pipelineConfig,
    updateResolver_apiId,
    updateResolver_typeName,
    updateResolver_fieldName,

    -- * Destructuring the Response
    UpdateResolverResponse (..),
    newUpdateResolverResponse,

    -- * Response Lenses
    updateResolverResponse_resolver,
    updateResolverResponse_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:/ 'newUpdateResolver' smart constructor.
data UpdateResolver = UpdateResolver'
  { -- | The new data source name.
    UpdateResolver -> Maybe Text
dataSourceName :: Prelude.Maybe Prelude.Text,
    -- | The new request mapping template.
    --
    -- A resolver uses a request mapping template to convert a GraphQL
    -- expression into a format that a data source can understand. Mapping
    -- templates are written in Apache Velocity Template Language (VTL).
    --
    -- VTL request mapping templates are optional when using a Lambda data
    -- source. For all other data sources, VTL request and response mapping
    -- templates are required.
    UpdateResolver -> Maybe Text
requestMappingTemplate :: Prelude.Maybe Prelude.Text,
    -- | The resolver type.
    --
    -- -   __UNIT__: A UNIT resolver type. A UNIT resolver is the default
    --     resolver type. A UNIT resolver enables you to execute a GraphQL
    --     query against a single data source.
    --
    -- -   __PIPELINE__: A PIPELINE resolver type. A PIPELINE resolver enables
    --     you to execute a series of @Function@ in a serial manner. You can
    --     use a pipeline resolver to execute a GraphQL query against multiple
    --     data sources.
    UpdateResolver -> Maybe ResolverKind
kind :: Prelude.Maybe ResolverKind,
    -- | The caching configuration for the resolver.
    UpdateResolver -> Maybe CachingConfig
cachingConfig :: Prelude.Maybe CachingConfig,
    -- | The new response mapping template.
    UpdateResolver -> Maybe Text
responseMappingTemplate :: Prelude.Maybe Prelude.Text,
    -- | The @SyncConfig@ for a resolver attached to a versioned datasource.
    UpdateResolver -> Maybe SyncConfig
syncConfig :: Prelude.Maybe SyncConfig,
    -- | The @PipelineConfig@.
    UpdateResolver -> Maybe PipelineConfig
pipelineConfig :: Prelude.Maybe PipelineConfig,
    -- | The API ID.
    UpdateResolver -> Text
apiId :: Prelude.Text,
    -- | The new type name.
    UpdateResolver -> Text
typeName :: Prelude.Text,
    -- | The new field name.
    UpdateResolver -> Text
fieldName :: Prelude.Text
  }
  deriving (UpdateResolver -> UpdateResolver -> Bool
(UpdateResolver -> UpdateResolver -> Bool)
-> (UpdateResolver -> UpdateResolver -> Bool) -> Eq UpdateResolver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateResolver -> UpdateResolver -> Bool
$c/= :: UpdateResolver -> UpdateResolver -> Bool
== :: UpdateResolver -> UpdateResolver -> Bool
$c== :: UpdateResolver -> UpdateResolver -> Bool
Prelude.Eq, ReadPrec [UpdateResolver]
ReadPrec UpdateResolver
Int -> ReadS UpdateResolver
ReadS [UpdateResolver]
(Int -> ReadS UpdateResolver)
-> ReadS [UpdateResolver]
-> ReadPrec UpdateResolver
-> ReadPrec [UpdateResolver]
-> Read UpdateResolver
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateResolver]
$creadListPrec :: ReadPrec [UpdateResolver]
readPrec :: ReadPrec UpdateResolver
$creadPrec :: ReadPrec UpdateResolver
readList :: ReadS [UpdateResolver]
$creadList :: ReadS [UpdateResolver]
readsPrec :: Int -> ReadS UpdateResolver
$creadsPrec :: Int -> ReadS UpdateResolver
Prelude.Read, Int -> UpdateResolver -> ShowS
[UpdateResolver] -> ShowS
UpdateResolver -> String
(Int -> UpdateResolver -> ShowS)
-> (UpdateResolver -> String)
-> ([UpdateResolver] -> ShowS)
-> Show UpdateResolver
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateResolver] -> ShowS
$cshowList :: [UpdateResolver] -> ShowS
show :: UpdateResolver -> String
$cshow :: UpdateResolver -> String
showsPrec :: Int -> UpdateResolver -> ShowS
$cshowsPrec :: Int -> UpdateResolver -> ShowS
Prelude.Show, (forall x. UpdateResolver -> Rep UpdateResolver x)
-> (forall x. Rep UpdateResolver x -> UpdateResolver)
-> Generic UpdateResolver
forall x. Rep UpdateResolver x -> UpdateResolver
forall x. UpdateResolver -> Rep UpdateResolver x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateResolver x -> UpdateResolver
$cfrom :: forall x. UpdateResolver -> Rep UpdateResolver x
Prelude.Generic)

-- |
-- Create a value of 'UpdateResolver' 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:
--
-- 'dataSourceName', 'updateResolver_dataSourceName' - The new data source name.
--
-- 'requestMappingTemplate', 'updateResolver_requestMappingTemplate' - The new request mapping template.
--
-- A resolver uses a request mapping template to convert a GraphQL
-- expression into a format that a data source can understand. Mapping
-- templates are written in Apache Velocity Template Language (VTL).
--
-- VTL request mapping templates are optional when using a Lambda data
-- source. For all other data sources, VTL request and response mapping
-- templates are required.
--
-- 'kind', 'updateResolver_kind' - The resolver type.
--
-- -   __UNIT__: A UNIT resolver type. A UNIT resolver is the default
--     resolver type. A UNIT resolver enables you to execute a GraphQL
--     query against a single data source.
--
-- -   __PIPELINE__: A PIPELINE resolver type. A PIPELINE resolver enables
--     you to execute a series of @Function@ in a serial manner. You can
--     use a pipeline resolver to execute a GraphQL query against multiple
--     data sources.
--
-- 'cachingConfig', 'updateResolver_cachingConfig' - The caching configuration for the resolver.
--
-- 'responseMappingTemplate', 'updateResolver_responseMappingTemplate' - The new response mapping template.
--
-- 'syncConfig', 'updateResolver_syncConfig' - The @SyncConfig@ for a resolver attached to a versioned datasource.
--
-- 'pipelineConfig', 'updateResolver_pipelineConfig' - The @PipelineConfig@.
--
-- 'apiId', 'updateResolver_apiId' - The API ID.
--
-- 'typeName', 'updateResolver_typeName' - The new type name.
--
-- 'fieldName', 'updateResolver_fieldName' - The new field name.
newUpdateResolver ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'typeName'
  Prelude.Text ->
  -- | 'fieldName'
  Prelude.Text ->
  UpdateResolver
newUpdateResolver :: Text -> Text -> Text -> UpdateResolver
newUpdateResolver Text
pApiId_ Text
pTypeName_ Text
pFieldName_ =
  UpdateResolver' :: Maybe Text
-> Maybe Text
-> Maybe ResolverKind
-> Maybe CachingConfig
-> Maybe Text
-> Maybe SyncConfig
-> Maybe PipelineConfig
-> Text
-> Text
-> Text
-> UpdateResolver
UpdateResolver'
    { $sel:dataSourceName:UpdateResolver' :: Maybe Text
dataSourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:requestMappingTemplate:UpdateResolver' :: Maybe Text
requestMappingTemplate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kind:UpdateResolver' :: Maybe ResolverKind
kind = Maybe ResolverKind
forall a. Maybe a
Prelude.Nothing,
      $sel:cachingConfig:UpdateResolver' :: Maybe CachingConfig
cachingConfig = Maybe CachingConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:responseMappingTemplate:UpdateResolver' :: Maybe Text
responseMappingTemplate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:syncConfig:UpdateResolver' :: Maybe SyncConfig
syncConfig = Maybe SyncConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineConfig:UpdateResolver' :: Maybe PipelineConfig
pipelineConfig = Maybe PipelineConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:apiId:UpdateResolver' :: Text
apiId = Text
pApiId_,
      $sel:typeName:UpdateResolver' :: Text
typeName = Text
pTypeName_,
      $sel:fieldName:UpdateResolver' :: Text
fieldName = Text
pFieldName_
    }

-- | The new data source name.
updateResolver_dataSourceName :: Lens.Lens' UpdateResolver (Prelude.Maybe Prelude.Text)
updateResolver_dataSourceName :: (Maybe Text -> f (Maybe Text))
-> UpdateResolver -> f UpdateResolver
updateResolver_dataSourceName = (UpdateResolver -> Maybe Text)
-> (UpdateResolver -> Maybe Text -> UpdateResolver)
-> Lens UpdateResolver UpdateResolver (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Maybe Text
dataSourceName :: Maybe Text
$sel:dataSourceName:UpdateResolver' :: UpdateResolver -> Maybe Text
dataSourceName} -> Maybe Text
dataSourceName) (\s :: UpdateResolver
s@UpdateResolver' {} Maybe Text
a -> UpdateResolver
s {$sel:dataSourceName:UpdateResolver' :: Maybe Text
dataSourceName = Maybe Text
a} :: UpdateResolver)

-- | The new request mapping template.
--
-- A resolver uses a request mapping template to convert a GraphQL
-- expression into a format that a data source can understand. Mapping
-- templates are written in Apache Velocity Template Language (VTL).
--
-- VTL request mapping templates are optional when using a Lambda data
-- source. For all other data sources, VTL request and response mapping
-- templates are required.
updateResolver_requestMappingTemplate :: Lens.Lens' UpdateResolver (Prelude.Maybe Prelude.Text)
updateResolver_requestMappingTemplate :: (Maybe Text -> f (Maybe Text))
-> UpdateResolver -> f UpdateResolver
updateResolver_requestMappingTemplate = (UpdateResolver -> Maybe Text)
-> (UpdateResolver -> Maybe Text -> UpdateResolver)
-> Lens UpdateResolver UpdateResolver (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Maybe Text
requestMappingTemplate :: Maybe Text
$sel:requestMappingTemplate:UpdateResolver' :: UpdateResolver -> Maybe Text
requestMappingTemplate} -> Maybe Text
requestMappingTemplate) (\s :: UpdateResolver
s@UpdateResolver' {} Maybe Text
a -> UpdateResolver
s {$sel:requestMappingTemplate:UpdateResolver' :: Maybe Text
requestMappingTemplate = Maybe Text
a} :: UpdateResolver)

-- | The resolver type.
--
-- -   __UNIT__: A UNIT resolver type. A UNIT resolver is the default
--     resolver type. A UNIT resolver enables you to execute a GraphQL
--     query against a single data source.
--
-- -   __PIPELINE__: A PIPELINE resolver type. A PIPELINE resolver enables
--     you to execute a series of @Function@ in a serial manner. You can
--     use a pipeline resolver to execute a GraphQL query against multiple
--     data sources.
updateResolver_kind :: Lens.Lens' UpdateResolver (Prelude.Maybe ResolverKind)
updateResolver_kind :: (Maybe ResolverKind -> f (Maybe ResolverKind))
-> UpdateResolver -> f UpdateResolver
updateResolver_kind = (UpdateResolver -> Maybe ResolverKind)
-> (UpdateResolver -> Maybe ResolverKind -> UpdateResolver)
-> Lens
     UpdateResolver
     UpdateResolver
     (Maybe ResolverKind)
     (Maybe ResolverKind)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Maybe ResolverKind
kind :: Maybe ResolverKind
$sel:kind:UpdateResolver' :: UpdateResolver -> Maybe ResolverKind
kind} -> Maybe ResolverKind
kind) (\s :: UpdateResolver
s@UpdateResolver' {} Maybe ResolverKind
a -> UpdateResolver
s {$sel:kind:UpdateResolver' :: Maybe ResolverKind
kind = Maybe ResolverKind
a} :: UpdateResolver)

-- | The caching configuration for the resolver.
updateResolver_cachingConfig :: Lens.Lens' UpdateResolver (Prelude.Maybe CachingConfig)
updateResolver_cachingConfig :: (Maybe CachingConfig -> f (Maybe CachingConfig))
-> UpdateResolver -> f UpdateResolver
updateResolver_cachingConfig = (UpdateResolver -> Maybe CachingConfig)
-> (UpdateResolver -> Maybe CachingConfig -> UpdateResolver)
-> Lens
     UpdateResolver
     UpdateResolver
     (Maybe CachingConfig)
     (Maybe CachingConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Maybe CachingConfig
cachingConfig :: Maybe CachingConfig
$sel:cachingConfig:UpdateResolver' :: UpdateResolver -> Maybe CachingConfig
cachingConfig} -> Maybe CachingConfig
cachingConfig) (\s :: UpdateResolver
s@UpdateResolver' {} Maybe CachingConfig
a -> UpdateResolver
s {$sel:cachingConfig:UpdateResolver' :: Maybe CachingConfig
cachingConfig = Maybe CachingConfig
a} :: UpdateResolver)

-- | The new response mapping template.
updateResolver_responseMappingTemplate :: Lens.Lens' UpdateResolver (Prelude.Maybe Prelude.Text)
updateResolver_responseMappingTemplate :: (Maybe Text -> f (Maybe Text))
-> UpdateResolver -> f UpdateResolver
updateResolver_responseMappingTemplate = (UpdateResolver -> Maybe Text)
-> (UpdateResolver -> Maybe Text -> UpdateResolver)
-> Lens UpdateResolver UpdateResolver (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Maybe Text
responseMappingTemplate :: Maybe Text
$sel:responseMappingTemplate:UpdateResolver' :: UpdateResolver -> Maybe Text
responseMappingTemplate} -> Maybe Text
responseMappingTemplate) (\s :: UpdateResolver
s@UpdateResolver' {} Maybe Text
a -> UpdateResolver
s {$sel:responseMappingTemplate:UpdateResolver' :: Maybe Text
responseMappingTemplate = Maybe Text
a} :: UpdateResolver)

-- | The @SyncConfig@ for a resolver attached to a versioned datasource.
updateResolver_syncConfig :: Lens.Lens' UpdateResolver (Prelude.Maybe SyncConfig)
updateResolver_syncConfig :: (Maybe SyncConfig -> f (Maybe SyncConfig))
-> UpdateResolver -> f UpdateResolver
updateResolver_syncConfig = (UpdateResolver -> Maybe SyncConfig)
-> (UpdateResolver -> Maybe SyncConfig -> UpdateResolver)
-> Lens
     UpdateResolver UpdateResolver (Maybe SyncConfig) (Maybe SyncConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Maybe SyncConfig
syncConfig :: Maybe SyncConfig
$sel:syncConfig:UpdateResolver' :: UpdateResolver -> Maybe SyncConfig
syncConfig} -> Maybe SyncConfig
syncConfig) (\s :: UpdateResolver
s@UpdateResolver' {} Maybe SyncConfig
a -> UpdateResolver
s {$sel:syncConfig:UpdateResolver' :: Maybe SyncConfig
syncConfig = Maybe SyncConfig
a} :: UpdateResolver)

-- | The @PipelineConfig@.
updateResolver_pipelineConfig :: Lens.Lens' UpdateResolver (Prelude.Maybe PipelineConfig)
updateResolver_pipelineConfig :: (Maybe PipelineConfig -> f (Maybe PipelineConfig))
-> UpdateResolver -> f UpdateResolver
updateResolver_pipelineConfig = (UpdateResolver -> Maybe PipelineConfig)
-> (UpdateResolver -> Maybe PipelineConfig -> UpdateResolver)
-> Lens
     UpdateResolver
     UpdateResolver
     (Maybe PipelineConfig)
     (Maybe PipelineConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Maybe PipelineConfig
pipelineConfig :: Maybe PipelineConfig
$sel:pipelineConfig:UpdateResolver' :: UpdateResolver -> Maybe PipelineConfig
pipelineConfig} -> Maybe PipelineConfig
pipelineConfig) (\s :: UpdateResolver
s@UpdateResolver' {} Maybe PipelineConfig
a -> UpdateResolver
s {$sel:pipelineConfig:UpdateResolver' :: Maybe PipelineConfig
pipelineConfig = Maybe PipelineConfig
a} :: UpdateResolver)

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

-- | The new type name.
updateResolver_typeName :: Lens.Lens' UpdateResolver Prelude.Text
updateResolver_typeName :: (Text -> f Text) -> UpdateResolver -> f UpdateResolver
updateResolver_typeName = (UpdateResolver -> Text)
-> (UpdateResolver -> Text -> UpdateResolver)
-> Lens UpdateResolver UpdateResolver Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Text
typeName :: Text
$sel:typeName:UpdateResolver' :: UpdateResolver -> Text
typeName} -> Text
typeName) (\s :: UpdateResolver
s@UpdateResolver' {} Text
a -> UpdateResolver
s {$sel:typeName:UpdateResolver' :: Text
typeName = Text
a} :: UpdateResolver)

-- | The new field name.
updateResolver_fieldName :: Lens.Lens' UpdateResolver Prelude.Text
updateResolver_fieldName :: (Text -> f Text) -> UpdateResolver -> f UpdateResolver
updateResolver_fieldName = (UpdateResolver -> Text)
-> (UpdateResolver -> Text -> UpdateResolver)
-> Lens UpdateResolver UpdateResolver Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolver' {Text
fieldName :: Text
$sel:fieldName:UpdateResolver' :: UpdateResolver -> Text
fieldName} -> Text
fieldName) (\s :: UpdateResolver
s@UpdateResolver' {} Text
a -> UpdateResolver
s {$sel:fieldName:UpdateResolver' :: Text
fieldName = Text
a} :: UpdateResolver)

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

instance Prelude.NFData UpdateResolver

instance Core.ToHeaders UpdateResolver where
  toHeaders :: UpdateResolver -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateResolver -> 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 UpdateResolver where
  toJSON :: UpdateResolver -> Value
toJSON UpdateResolver' {Maybe Text
Maybe CachingConfig
Maybe PipelineConfig
Maybe ResolverKind
Maybe SyncConfig
Text
fieldName :: Text
typeName :: Text
apiId :: Text
pipelineConfig :: Maybe PipelineConfig
syncConfig :: Maybe SyncConfig
responseMappingTemplate :: Maybe Text
cachingConfig :: Maybe CachingConfig
kind :: Maybe ResolverKind
requestMappingTemplate :: Maybe Text
dataSourceName :: Maybe Text
$sel:fieldName:UpdateResolver' :: UpdateResolver -> Text
$sel:typeName:UpdateResolver' :: UpdateResolver -> Text
$sel:apiId:UpdateResolver' :: UpdateResolver -> Text
$sel:pipelineConfig:UpdateResolver' :: UpdateResolver -> Maybe PipelineConfig
$sel:syncConfig:UpdateResolver' :: UpdateResolver -> Maybe SyncConfig
$sel:responseMappingTemplate:UpdateResolver' :: UpdateResolver -> Maybe Text
$sel:cachingConfig:UpdateResolver' :: UpdateResolver -> Maybe CachingConfig
$sel:kind:UpdateResolver' :: UpdateResolver -> Maybe ResolverKind
$sel:requestMappingTemplate:UpdateResolver' :: UpdateResolver -> Maybe Text
$sel:dataSourceName:UpdateResolver' :: UpdateResolver -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"dataSourceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
dataSourceName,
            (Text
"requestMappingTemplate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
requestMappingTemplate,
            (Text
"kind" Text -> ResolverKind -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ResolverKind -> Pair) -> Maybe ResolverKind -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ResolverKind
kind,
            (Text
"cachingConfig" Text -> CachingConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CachingConfig -> Pair) -> Maybe CachingConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CachingConfig
cachingConfig,
            (Text
"responseMappingTemplate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
responseMappingTemplate,
            (Text
"syncConfig" Text -> SyncConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SyncConfig -> Pair) -> Maybe SyncConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SyncConfig
syncConfig,
            (Text
"pipelineConfig" Text -> PipelineConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PipelineConfig -> Pair) -> Maybe PipelineConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PipelineConfig
pipelineConfig
          ]
      )

instance Core.ToPath UpdateResolver where
  toPath :: UpdateResolver -> ByteString
toPath UpdateResolver' {Maybe Text
Maybe CachingConfig
Maybe PipelineConfig
Maybe ResolverKind
Maybe SyncConfig
Text
fieldName :: Text
typeName :: Text
apiId :: Text
pipelineConfig :: Maybe PipelineConfig
syncConfig :: Maybe SyncConfig
responseMappingTemplate :: Maybe Text
cachingConfig :: Maybe CachingConfig
kind :: Maybe ResolverKind
requestMappingTemplate :: Maybe Text
dataSourceName :: Maybe Text
$sel:fieldName:UpdateResolver' :: UpdateResolver -> Text
$sel:typeName:UpdateResolver' :: UpdateResolver -> Text
$sel:apiId:UpdateResolver' :: UpdateResolver -> Text
$sel:pipelineConfig:UpdateResolver' :: UpdateResolver -> Maybe PipelineConfig
$sel:syncConfig:UpdateResolver' :: UpdateResolver -> Maybe SyncConfig
$sel:responseMappingTemplate:UpdateResolver' :: UpdateResolver -> Maybe Text
$sel:cachingConfig:UpdateResolver' :: UpdateResolver -> Maybe CachingConfig
$sel:kind:UpdateResolver' :: UpdateResolver -> Maybe ResolverKind
$sel:requestMappingTemplate:UpdateResolver' :: UpdateResolver -> Maybe Text
$sel:dataSourceName:UpdateResolver' :: UpdateResolver -> Maybe Text
..} =
    [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,
        ByteString
"/types/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
typeName,
        ByteString
"/resolvers/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
fieldName
      ]

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

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

-- |
-- Create a value of 'UpdateResolverResponse' 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:
--
-- 'resolver', 'updateResolverResponse_resolver' - The updated @Resolver@ object.
--
-- 'httpStatus', 'updateResolverResponse_httpStatus' - The response's http status code.
newUpdateResolverResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateResolverResponse
newUpdateResolverResponse :: Int -> UpdateResolverResponse
newUpdateResolverResponse Int
pHttpStatus_ =
  UpdateResolverResponse' :: Maybe Resolver -> Int -> UpdateResolverResponse
UpdateResolverResponse'
    { $sel:resolver:UpdateResolverResponse' :: Maybe Resolver
resolver = Maybe Resolver
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateResolverResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The updated @Resolver@ object.
updateResolverResponse_resolver :: Lens.Lens' UpdateResolverResponse (Prelude.Maybe Resolver)
updateResolverResponse_resolver :: (Maybe Resolver -> f (Maybe Resolver))
-> UpdateResolverResponse -> f UpdateResolverResponse
updateResolverResponse_resolver = (UpdateResolverResponse -> Maybe Resolver)
-> (UpdateResolverResponse
    -> Maybe Resolver -> UpdateResolverResponse)
-> Lens
     UpdateResolverResponse
     UpdateResolverResponse
     (Maybe Resolver)
     (Maybe Resolver)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateResolverResponse' {Maybe Resolver
resolver :: Maybe Resolver
$sel:resolver:UpdateResolverResponse' :: UpdateResolverResponse -> Maybe Resolver
resolver} -> Maybe Resolver
resolver) (\s :: UpdateResolverResponse
s@UpdateResolverResponse' {} Maybe Resolver
a -> UpdateResolverResponse
s {$sel:resolver:UpdateResolverResponse' :: Maybe Resolver
resolver = Maybe Resolver
a} :: UpdateResolverResponse)

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

instance Prelude.NFData UpdateResolverResponse