{-# 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.DeleteComponent
-- 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 component from an Amplify app.
module Amazonka.AmplifyUiBuilder.DeleteComponent
  ( -- * Creating a Request
    DeleteComponent (..),
    newDeleteComponent,

    -- * Request Lenses
    deleteComponent_appId,
    deleteComponent_environmentName,
    deleteComponent_id,

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

-- |
-- Create a value of 'DeleteComponent' 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', 'deleteComponent_appId' - The unique ID of the Amplify app associated with the component to
-- delete.
--
-- 'environmentName', 'deleteComponent_environmentName' - The name of the backend environment that is a part of the Amplify app.
--
-- 'id', 'deleteComponent_id' - The unique ID of the component to delete.
newDeleteComponent ::
  -- | 'appId'
  Prelude.Text ->
  -- | 'environmentName'
  Prelude.Text ->
  -- | 'id'
  Prelude.Text ->
  DeleteComponent
newDeleteComponent :: Text -> Text -> Text -> DeleteComponent
newDeleteComponent Text
pAppId_ Text
pEnvironmentName_ Text
pId_ =
  DeleteComponent'
    { $sel:appId:DeleteComponent' :: Text
appId = Text
pAppId_,
      $sel:environmentName:DeleteComponent' :: Text
environmentName = Text
pEnvironmentName_,
      $sel:id:DeleteComponent' :: Text
id = Text
pId_
    }

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

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

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

instance Core.AWSRequest DeleteComponent where
  type
    AWSResponse DeleteComponent =
      DeleteComponentResponse
  request :: (Service -> Service) -> DeleteComponent -> Request DeleteComponent
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 DeleteComponent
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteComponent)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteComponentResponse
DeleteComponentResponse'

instance Prelude.Hashable DeleteComponent where
  hashWithSalt :: Int -> DeleteComponent -> Int
hashWithSalt Int
_salt DeleteComponent' {Text
id :: Text
environmentName :: Text
appId :: Text
$sel:id:DeleteComponent' :: DeleteComponent -> Text
$sel:environmentName:DeleteComponent' :: DeleteComponent -> Text
$sel:appId:DeleteComponent' :: DeleteComponent -> 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 DeleteComponent where
  rnf :: DeleteComponent -> ()
rnf DeleteComponent' {Text
id :: Text
environmentName :: Text
appId :: Text
$sel:id:DeleteComponent' :: DeleteComponent -> Text
$sel:environmentName:DeleteComponent' :: DeleteComponent -> Text
$sel:appId:DeleteComponent' :: DeleteComponent -> 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 DeleteComponent where
  toHeaders :: DeleteComponent -> [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 DeleteComponent where
  toPath :: DeleteComponent -> ByteString
toPath DeleteComponent' {Text
id :: Text
environmentName :: Text
appId :: Text
$sel:id:DeleteComponent' :: DeleteComponent -> Text
$sel:environmentName:DeleteComponent' :: DeleteComponent -> Text
$sel:appId:DeleteComponent' :: DeleteComponent -> 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
"/components/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
id
      ]

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

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

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

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