{-# 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.Glue.DeleteBlueprint
-- 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 an existing blueprint.
module Amazonka.Glue.DeleteBlueprint
  ( -- * Creating a Request
    DeleteBlueprint (..),
    newDeleteBlueprint,

    -- * Request Lenses
    deleteBlueprint_name,

    -- * Destructuring the Response
    DeleteBlueprintResponse (..),
    newDeleteBlueprintResponse,

    -- * Response Lenses
    deleteBlueprintResponse_name,
    deleteBlueprintResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'DeleteBlueprint' 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', 'deleteBlueprint_name' - The name of the blueprint to delete.
newDeleteBlueprint ::
  -- | 'name'
  Prelude.Text ->
  DeleteBlueprint
newDeleteBlueprint :: Text -> DeleteBlueprint
newDeleteBlueprint Text
pName_ =
  DeleteBlueprint' :: Text -> DeleteBlueprint
DeleteBlueprint' {$sel:name:DeleteBlueprint' :: Text
name = Text
pName_}

-- | The name of the blueprint to delete.
deleteBlueprint_name :: Lens.Lens' DeleteBlueprint Prelude.Text
deleteBlueprint_name :: (Text -> f Text) -> DeleteBlueprint -> f DeleteBlueprint
deleteBlueprint_name = (DeleteBlueprint -> Text)
-> (DeleteBlueprint -> Text -> DeleteBlueprint)
-> Lens DeleteBlueprint DeleteBlueprint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBlueprint' {Text
name :: Text
$sel:name:DeleteBlueprint' :: DeleteBlueprint -> Text
name} -> Text
name) (\s :: DeleteBlueprint
s@DeleteBlueprint' {} Text
a -> DeleteBlueprint
s {$sel:name:DeleteBlueprint' :: Text
name = Text
a} :: DeleteBlueprint)

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

instance Prelude.NFData DeleteBlueprint

instance Core.ToHeaders DeleteBlueprint where
  toHeaders :: DeleteBlueprint -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteBlueprint -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"AWSGlue.DeleteBlueprint" :: Prelude.ByteString),
            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 DeleteBlueprint where
  toJSON :: DeleteBlueprint -> Value
toJSON DeleteBlueprint' {Text
name :: Text
$sel:name:DeleteBlueprint' :: DeleteBlueprint -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )

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

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

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

-- |
-- Create a value of 'DeleteBlueprintResponse' 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', 'deleteBlueprintResponse_name' - Returns the name of the blueprint that was deleted.
--
-- 'httpStatus', 'deleteBlueprintResponse_httpStatus' - The response's http status code.
newDeleteBlueprintResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteBlueprintResponse
newDeleteBlueprintResponse :: Int -> DeleteBlueprintResponse
newDeleteBlueprintResponse Int
pHttpStatus_ =
  DeleteBlueprintResponse' :: Maybe Text -> Int -> DeleteBlueprintResponse
DeleteBlueprintResponse'
    { $sel:name:DeleteBlueprintResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteBlueprintResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Returns the name of the blueprint that was deleted.
deleteBlueprintResponse_name :: Lens.Lens' DeleteBlueprintResponse (Prelude.Maybe Prelude.Text)
deleteBlueprintResponse_name :: (Maybe Text -> f (Maybe Text))
-> DeleteBlueprintResponse -> f DeleteBlueprintResponse
deleteBlueprintResponse_name = (DeleteBlueprintResponse -> Maybe Text)
-> (DeleteBlueprintResponse
    -> Maybe Text -> DeleteBlueprintResponse)
-> Lens
     DeleteBlueprintResponse
     DeleteBlueprintResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBlueprintResponse' {Maybe Text
name :: Maybe Text
$sel:name:DeleteBlueprintResponse' :: DeleteBlueprintResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: DeleteBlueprintResponse
s@DeleteBlueprintResponse' {} Maybe Text
a -> DeleteBlueprintResponse
s {$sel:name:DeleteBlueprintResponse' :: Maybe Text
name = Maybe Text
a} :: DeleteBlueprintResponse)

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

instance Prelude.NFData DeleteBlueprintResponse