{-# 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.AppStream.DeleteAppBlock
-- 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 an app block.
module Amazonka.AppStream.DeleteAppBlock
  ( -- * Creating a Request
    DeleteAppBlock (..),
    newDeleteAppBlock,

    -- * Request Lenses
    deleteAppBlock_name,

    -- * Destructuring the Response
    DeleteAppBlockResponse (..),
    newDeleteAppBlockResponse,

    -- * Response Lenses
    deleteAppBlockResponse_httpStatus,
  )
where

import Amazonka.AppStream.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:/ 'newDeleteAppBlock' smart constructor.
data DeleteAppBlock = DeleteAppBlock'
  { -- | The name of the app block.
    DeleteAppBlock -> Text
name :: Prelude.Text
  }
  deriving (DeleteAppBlock -> DeleteAppBlock -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAppBlock -> DeleteAppBlock -> Bool
$c/= :: DeleteAppBlock -> DeleteAppBlock -> Bool
== :: DeleteAppBlock -> DeleteAppBlock -> Bool
$c== :: DeleteAppBlock -> DeleteAppBlock -> Bool
Prelude.Eq, ReadPrec [DeleteAppBlock]
ReadPrec DeleteAppBlock
Int -> ReadS DeleteAppBlock
ReadS [DeleteAppBlock]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAppBlock]
$creadListPrec :: ReadPrec [DeleteAppBlock]
readPrec :: ReadPrec DeleteAppBlock
$creadPrec :: ReadPrec DeleteAppBlock
readList :: ReadS [DeleteAppBlock]
$creadList :: ReadS [DeleteAppBlock]
readsPrec :: Int -> ReadS DeleteAppBlock
$creadsPrec :: Int -> ReadS DeleteAppBlock
Prelude.Read, Int -> DeleteAppBlock -> ShowS
[DeleteAppBlock] -> ShowS
DeleteAppBlock -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAppBlock] -> ShowS
$cshowList :: [DeleteAppBlock] -> ShowS
show :: DeleteAppBlock -> String
$cshow :: DeleteAppBlock -> String
showsPrec :: Int -> DeleteAppBlock -> ShowS
$cshowsPrec :: Int -> DeleteAppBlock -> ShowS
Prelude.Show, forall x. Rep DeleteAppBlock x -> DeleteAppBlock
forall x. DeleteAppBlock -> Rep DeleteAppBlock x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteAppBlock x -> DeleteAppBlock
$cfrom :: forall x. DeleteAppBlock -> Rep DeleteAppBlock x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAppBlock' 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:
--
-- 'name', 'deleteAppBlock_name' - The name of the app block.
newDeleteAppBlock ::
  -- | 'name'
  Prelude.Text ->
  DeleteAppBlock
newDeleteAppBlock :: Text -> DeleteAppBlock
newDeleteAppBlock Text
pName_ =
  DeleteAppBlock' {$sel:name:DeleteAppBlock' :: Text
name = Text
pName_}

-- | The name of the app block.
deleteAppBlock_name :: Lens.Lens' DeleteAppBlock Prelude.Text
deleteAppBlock_name :: Lens' DeleteAppBlock Text
deleteAppBlock_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAppBlock' {Text
name :: Text
$sel:name:DeleteAppBlock' :: DeleteAppBlock -> Text
name} -> Text
name) (\s :: DeleteAppBlock
s@DeleteAppBlock' {} Text
a -> DeleteAppBlock
s {$sel:name:DeleteAppBlock' :: Text
name = Text
a} :: DeleteAppBlock)

instance Core.AWSRequest DeleteAppBlock where
  type
    AWSResponse DeleteAppBlock =
      DeleteAppBlockResponse
  request :: (Service -> Service) -> DeleteAppBlock -> Request DeleteAppBlock
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteAppBlock
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteAppBlock)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteAppBlockResponse
DeleteAppBlockResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteAppBlock where
  hashWithSalt :: Int -> DeleteAppBlock -> Int
hashWithSalt Int
_salt DeleteAppBlock' {Text
name :: Text
$sel:name:DeleteAppBlock' :: DeleteAppBlock -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData DeleteAppBlock where
  rnf :: DeleteAppBlock -> ()
rnf DeleteAppBlock' {Text
name :: Text
$sel:name:DeleteAppBlock' :: DeleteAppBlock -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders DeleteAppBlock where
  toHeaders :: DeleteAppBlock -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"PhotonAdminProxyService.DeleteAppBlock" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteAppBlock where
  toJSON :: DeleteAppBlock -> Value
toJSON DeleteAppBlock' {Text
name :: Text
$sel:name:DeleteAppBlock' :: DeleteAppBlock -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
      )

instance Data.ToPath DeleteAppBlock where
  toPath :: DeleteAppBlock -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData DeleteAppBlockResponse where
  rnf :: DeleteAppBlockResponse -> ()
rnf DeleteAppBlockResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteAppBlockResponse' :: DeleteAppBlockResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus