{-# 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.AmplifyUiBuilder.DeleteForm
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a form from an Amplify app.
module Amazonka.AmplifyUiBuilder.DeleteForm
  ( -- * Creating a Request
    DeleteForm (..),
    newDeleteForm,

    -- * Request Lenses
    deleteForm_appId,
    deleteForm_environmentName,
    deleteForm_id,

    -- * Destructuring the Response
    DeleteFormResponse (..),
    newDeleteFormResponse,
  )
where

import Amazonka.AmplifyUiBuilder.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteForm' smart constructor.
data DeleteForm = DeleteForm'
  { -- | The unique ID of the Amplify app associated with the form to delete.
    DeleteForm -> Text
appId :: Prelude.Text,
    -- | The name of the backend environment that is a part of the Amplify app.
    DeleteForm -> Text
environmentName :: Prelude.Text,
    -- | The unique ID of the form to delete.
    DeleteForm -> Text
id :: Prelude.Text
  }
  deriving (DeleteForm -> DeleteForm -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteForm -> DeleteForm -> Bool
$c/= :: DeleteForm -> DeleteForm -> Bool
== :: DeleteForm -> DeleteForm -> Bool
$c== :: DeleteForm -> DeleteForm -> Bool
Prelude.Eq, ReadPrec [DeleteForm]
ReadPrec DeleteForm
Int -> ReadS DeleteForm
ReadS [DeleteForm]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteForm]
$creadListPrec :: ReadPrec [DeleteForm]
readPrec :: ReadPrec DeleteForm
$creadPrec :: ReadPrec DeleteForm
readList :: ReadS [DeleteForm]
$creadList :: ReadS [DeleteForm]
readsPrec :: Int -> ReadS DeleteForm
$creadsPrec :: Int -> ReadS DeleteForm
Prelude.Read, Int -> DeleteForm -> ShowS
[DeleteForm] -> ShowS
DeleteForm -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteForm] -> ShowS
$cshowList :: [DeleteForm] -> ShowS
show :: DeleteForm -> String
$cshow :: DeleteForm -> String
showsPrec :: Int -> DeleteForm -> ShowS
$cshowsPrec :: Int -> DeleteForm -> ShowS
Prelude.Show, forall x. Rep DeleteForm x -> DeleteForm
forall x. DeleteForm -> Rep DeleteForm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteForm x -> DeleteForm
$cfrom :: forall x. DeleteForm -> Rep DeleteForm x
Prelude.Generic)

-- |
-- Create a value of 'DeleteForm' 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:
--
-- 'appId', 'deleteForm_appId' - The unique ID of the Amplify app associated with the form to delete.
--
-- 'environmentName', 'deleteForm_environmentName' - The name of the backend environment that is a part of the Amplify app.
--
-- 'id', 'deleteForm_id' - The unique ID of the form to delete.
newDeleteForm ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'environmentName'
  Prelude.Text ->
  -- | 'id'
  Prelude.Text ->
  DeleteForm
newDeleteForm :: Text -> Text -> Text -> DeleteForm
newDeleteForm Text
pAppId_ Text
pEnvironmentName_ Text
pId_ =
  DeleteForm'
    { $sel:appId:DeleteForm' :: Text
appId = Text
pAppId_,
      $sel:environmentName:DeleteForm' :: Text
environmentName = Text
pEnvironmentName_,
      $sel:id:DeleteForm' :: Text
id = Text
pId_
    }

-- | The unique ID of the Amplify app associated with the form to delete.
deleteForm_appId :: Lens.Lens' DeleteForm Prelude.Text
deleteForm_appId :: Lens' DeleteForm Text
deleteForm_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteForm' {Text
appId :: Text
$sel:appId:DeleteForm' :: DeleteForm -> Text
appId} -> Text
appId) (\s :: DeleteForm
s@DeleteForm' {} Text
a -> DeleteForm
s {$sel:appId:DeleteForm' :: Text
appId = Text
a} :: DeleteForm)

-- | The name of the backend environment that is a part of the Amplify app.
deleteForm_environmentName :: Lens.Lens' DeleteForm Prelude.Text
deleteForm_environmentName :: Lens' DeleteForm Text
deleteForm_environmentName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteForm' {Text
environmentName :: Text
$sel:environmentName:DeleteForm' :: DeleteForm -> Text
environmentName} -> Text
environmentName) (\s :: DeleteForm
s@DeleteForm' {} Text
a -> DeleteForm
s {$sel:environmentName:DeleteForm' :: Text
environmentName = Text
a} :: DeleteForm)

-- | The unique ID of the form to delete.
deleteForm_id :: Lens.Lens' DeleteForm Prelude.Text
deleteForm_id :: Lens' DeleteForm Text
deleteForm_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteForm' {Text
id :: Text
$sel:id:DeleteForm' :: DeleteForm -> Text
id} -> Text
id) (\s :: DeleteForm
s@DeleteForm' {} Text
a -> DeleteForm
s {$sel:id:DeleteForm' :: Text
id = Text
a} :: DeleteForm)

instance Core.AWSRequest DeleteForm where
  type AWSResponse DeleteForm = DeleteFormResponse
  request :: (Service -> Service) -> DeleteForm -> Request DeleteForm
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteForm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteForm)))
response = forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteFormResponse
DeleteFormResponse'

instance Prelude.Hashable DeleteForm where
  hashWithSalt :: Int -> DeleteForm -> Int
hashWithSalt Int
_salt DeleteForm' {Text
id :: Text
environmentName :: Text
appId :: Text
$sel:id:DeleteForm' :: DeleteForm -> Text
$sel:environmentName:DeleteForm' :: DeleteForm -> Text
$sel:appId:DeleteForm' :: DeleteForm -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
environmentName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData DeleteForm where
  rnf :: DeleteForm -> ()
rnf DeleteForm' {Text
id :: Text
environmentName :: Text
appId :: Text
$sel:id:DeleteForm' :: DeleteForm -> Text
$sel:environmentName:DeleteForm' :: DeleteForm -> Text
$sel:appId:DeleteForm' :: DeleteForm -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
appId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
environmentName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id

instance Data.ToHeaders DeleteForm where
  toHeaders :: DeleteForm -> [Header]
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath DeleteForm where
  toPath :: DeleteForm -> ByteString
toPath DeleteForm' {Text
id :: Text
environmentName :: Text
appId :: Text
$sel:id:DeleteForm' :: DeleteForm -> Text
$sel:environmentName:DeleteForm' :: DeleteForm -> Text
$sel:appId:DeleteForm' :: DeleteForm -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/app/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
appId,
        ByteString
"/environment/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
environmentName,
        ByteString
"/forms/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
id
      ]

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

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

-- |
-- Create a value of 'DeleteFormResponse' 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.
newDeleteFormResponse ::
  DeleteFormResponse
newDeleteFormResponse :: DeleteFormResponse
newDeleteFormResponse = DeleteFormResponse
DeleteFormResponse'

instance Prelude.NFData DeleteFormResponse where
  rnf :: DeleteFormResponse -> ()
rnf DeleteFormResponse
_ = ()