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

    -- * Request Lenses
    deleteResolver_apiId,
    deleteResolver_typeName,
    deleteResolver_fieldName,

    -- * Destructuring the Response
    DeleteResolverResponse (..),
    newDeleteResolverResponse,

    -- * Response Lenses
    deleteResolverResponse_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:/ 'newDeleteResolver' smart constructor.
data DeleteResolver = DeleteResolver'
  { -- | The API ID.
    DeleteResolver -> Text
apiId :: Prelude.Text,
    -- | The name of the resolver type.
    DeleteResolver -> Text
typeName :: Prelude.Text,
    -- | The resolver field name.
    DeleteResolver -> Text
fieldName :: Prelude.Text
  }
  deriving (DeleteResolver -> DeleteResolver -> Bool
(DeleteResolver -> DeleteResolver -> Bool)
-> (DeleteResolver -> DeleteResolver -> Bool) -> Eq DeleteResolver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResolver -> DeleteResolver -> Bool
$c/= :: DeleteResolver -> DeleteResolver -> Bool
== :: DeleteResolver -> DeleteResolver -> Bool
$c== :: DeleteResolver -> DeleteResolver -> Bool
Prelude.Eq, ReadPrec [DeleteResolver]
ReadPrec DeleteResolver
Int -> ReadS DeleteResolver
ReadS [DeleteResolver]
(Int -> ReadS DeleteResolver)
-> ReadS [DeleteResolver]
-> ReadPrec DeleteResolver
-> ReadPrec [DeleteResolver]
-> Read DeleteResolver
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResolver]
$creadListPrec :: ReadPrec [DeleteResolver]
readPrec :: ReadPrec DeleteResolver
$creadPrec :: ReadPrec DeleteResolver
readList :: ReadS [DeleteResolver]
$creadList :: ReadS [DeleteResolver]
readsPrec :: Int -> ReadS DeleteResolver
$creadsPrec :: Int -> ReadS DeleteResolver
Prelude.Read, Int -> DeleteResolver -> ShowS
[DeleteResolver] -> ShowS
DeleteResolver -> String
(Int -> DeleteResolver -> ShowS)
-> (DeleteResolver -> String)
-> ([DeleteResolver] -> ShowS)
-> Show DeleteResolver
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResolver] -> ShowS
$cshowList :: [DeleteResolver] -> ShowS
show :: DeleteResolver -> String
$cshow :: DeleteResolver -> String
showsPrec :: Int -> DeleteResolver -> ShowS
$cshowsPrec :: Int -> DeleteResolver -> ShowS
Prelude.Show, (forall x. DeleteResolver -> Rep DeleteResolver x)
-> (forall x. Rep DeleteResolver x -> DeleteResolver)
-> Generic DeleteResolver
forall x. Rep DeleteResolver x -> DeleteResolver
forall x. DeleteResolver -> Rep DeleteResolver x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResolver x -> DeleteResolver
$cfrom :: forall x. DeleteResolver -> Rep DeleteResolver x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResolver' 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:
--
-- 'apiId', 'deleteResolver_apiId' - The API ID.
--
-- 'typeName', 'deleteResolver_typeName' - The name of the resolver type.
--
-- 'fieldName', 'deleteResolver_fieldName' - The resolver field name.
newDeleteResolver ::
  -- | 'apiId'
  Prelude.Text ->
  -- | 'typeName'
  Prelude.Text ->
  -- | 'fieldName'
  Prelude.Text ->
  DeleteResolver
newDeleteResolver :: Text -> Text -> Text -> DeleteResolver
newDeleteResolver Text
pApiId_ Text
pTypeName_ Text
pFieldName_ =
  DeleteResolver' :: Text -> Text -> Text -> DeleteResolver
DeleteResolver'
    { $sel:apiId:DeleteResolver' :: Text
apiId = Text
pApiId_,
      $sel:typeName:DeleteResolver' :: Text
typeName = Text
pTypeName_,
      $sel:fieldName:DeleteResolver' :: Text
fieldName = Text
pFieldName_
    }

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

-- | The name of the resolver type.
deleteResolver_typeName :: Lens.Lens' DeleteResolver Prelude.Text
deleteResolver_typeName :: (Text -> f Text) -> DeleteResolver -> f DeleteResolver
deleteResolver_typeName = (DeleteResolver -> Text)
-> (DeleteResolver -> Text -> DeleteResolver)
-> Lens DeleteResolver DeleteResolver Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResolver' {Text
typeName :: Text
$sel:typeName:DeleteResolver' :: DeleteResolver -> Text
typeName} -> Text
typeName) (\s :: DeleteResolver
s@DeleteResolver' {} Text
a -> DeleteResolver
s {$sel:typeName:DeleteResolver' :: Text
typeName = Text
a} :: DeleteResolver)

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

instance Core.AWSRequest DeleteResolver where
  type
    AWSResponse DeleteResolver =
      DeleteResolverResponse
  request :: DeleteResolver -> Request DeleteResolver
request = Service -> DeleteResolver -> Request DeleteResolver
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteResolver
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteResolver)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteResolver))
-> Logger
-> Service
-> Proxy DeleteResolver
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteResolver)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteResolverResponse
DeleteResolverResponse'
            (Int -> DeleteResolverResponse)
-> Either String Int -> Either String DeleteResolverResponse
forall (f :: * -> *) a b. Functor 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 DeleteResolver

instance Prelude.NFData DeleteResolver

instance Core.ToHeaders DeleteResolver where
  toHeaders :: DeleteResolver -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteResolver -> 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.ToPath DeleteResolver where
  toPath :: DeleteResolver -> ByteString
toPath DeleteResolver' {Text
fieldName :: Text
typeName :: Text
apiId :: Text
$sel:fieldName:DeleteResolver' :: DeleteResolver -> Text
$sel:typeName:DeleteResolver' :: DeleteResolver -> Text
$sel:apiId:DeleteResolver' :: DeleteResolver -> 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 DeleteResolver where
  toQuery :: DeleteResolver -> QueryString
toQuery = QueryString -> DeleteResolver -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

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

-- |
-- Create a value of 'DeleteResolverResponse' 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:
--
-- 'httpStatus', 'deleteResolverResponse_httpStatus' - The response's http status code.
newDeleteResolverResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteResolverResponse
newDeleteResolverResponse :: Int -> DeleteResolverResponse
newDeleteResolverResponse Int
pHttpStatus_ =
  DeleteResolverResponse' :: Int -> DeleteResolverResponse
DeleteResolverResponse' {$sel:httpStatus:DeleteResolverResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteResolverResponse