{-# 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.DataBrew.DeleteRecipeVersion
-- 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 single version of a DataBrew recipe.
module Amazonka.DataBrew.DeleteRecipeVersion
  ( -- * Creating a Request
    DeleteRecipeVersion (..),
    newDeleteRecipeVersion,

    -- * Request Lenses
    deleteRecipeVersion_name,
    deleteRecipeVersion_recipeVersion,

    -- * Destructuring the Response
    DeleteRecipeVersionResponse (..),
    newDeleteRecipeVersionResponse,

    -- * Response Lenses
    deleteRecipeVersionResponse_httpStatus,
    deleteRecipeVersionResponse_name,
    deleteRecipeVersionResponse_recipeVersion,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DataBrew.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:/ 'newDeleteRecipeVersion' smart constructor.
data DeleteRecipeVersion = DeleteRecipeVersion'
  { -- | The name of the recipe.
    DeleteRecipeVersion -> Text
name :: Prelude.Text,
    -- | The version of the recipe to be deleted. You can specify a numeric
    -- versions (@X.Y@) or @LATEST_WORKING@. @LATEST_PUBLISHED@ is not
    -- supported.
    DeleteRecipeVersion -> Text
recipeVersion :: Prelude.Text
  }
  deriving (DeleteRecipeVersion -> DeleteRecipeVersion -> Bool
(DeleteRecipeVersion -> DeleteRecipeVersion -> Bool)
-> (DeleteRecipeVersion -> DeleteRecipeVersion -> Bool)
-> Eq DeleteRecipeVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRecipeVersion -> DeleteRecipeVersion -> Bool
$c/= :: DeleteRecipeVersion -> DeleteRecipeVersion -> Bool
== :: DeleteRecipeVersion -> DeleteRecipeVersion -> Bool
$c== :: DeleteRecipeVersion -> DeleteRecipeVersion -> Bool
Prelude.Eq, ReadPrec [DeleteRecipeVersion]
ReadPrec DeleteRecipeVersion
Int -> ReadS DeleteRecipeVersion
ReadS [DeleteRecipeVersion]
(Int -> ReadS DeleteRecipeVersion)
-> ReadS [DeleteRecipeVersion]
-> ReadPrec DeleteRecipeVersion
-> ReadPrec [DeleteRecipeVersion]
-> Read DeleteRecipeVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRecipeVersion]
$creadListPrec :: ReadPrec [DeleteRecipeVersion]
readPrec :: ReadPrec DeleteRecipeVersion
$creadPrec :: ReadPrec DeleteRecipeVersion
readList :: ReadS [DeleteRecipeVersion]
$creadList :: ReadS [DeleteRecipeVersion]
readsPrec :: Int -> ReadS DeleteRecipeVersion
$creadsPrec :: Int -> ReadS DeleteRecipeVersion
Prelude.Read, Int -> DeleteRecipeVersion -> ShowS
[DeleteRecipeVersion] -> ShowS
DeleteRecipeVersion -> String
(Int -> DeleteRecipeVersion -> ShowS)
-> (DeleteRecipeVersion -> String)
-> ([DeleteRecipeVersion] -> ShowS)
-> Show DeleteRecipeVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRecipeVersion] -> ShowS
$cshowList :: [DeleteRecipeVersion] -> ShowS
show :: DeleteRecipeVersion -> String
$cshow :: DeleteRecipeVersion -> String
showsPrec :: Int -> DeleteRecipeVersion -> ShowS
$cshowsPrec :: Int -> DeleteRecipeVersion -> ShowS
Prelude.Show, (forall x. DeleteRecipeVersion -> Rep DeleteRecipeVersion x)
-> (forall x. Rep DeleteRecipeVersion x -> DeleteRecipeVersion)
-> Generic DeleteRecipeVersion
forall x. Rep DeleteRecipeVersion x -> DeleteRecipeVersion
forall x. DeleteRecipeVersion -> Rep DeleteRecipeVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRecipeVersion x -> DeleteRecipeVersion
$cfrom :: forall x. DeleteRecipeVersion -> Rep DeleteRecipeVersion x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRecipeVersion' 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', 'deleteRecipeVersion_name' - The name of the recipe.
--
-- 'recipeVersion', 'deleteRecipeVersion_recipeVersion' - The version of the recipe to be deleted. You can specify a numeric
-- versions (@X.Y@) or @LATEST_WORKING@. @LATEST_PUBLISHED@ is not
-- supported.
newDeleteRecipeVersion ::
  -- | 'name'
  Prelude.Text ->
  -- | 'recipeVersion'
  Prelude.Text ->
  DeleteRecipeVersion
newDeleteRecipeVersion :: Text -> Text -> DeleteRecipeVersion
newDeleteRecipeVersion Text
pName_ Text
pRecipeVersion_ =
  DeleteRecipeVersion' :: Text -> Text -> DeleteRecipeVersion
DeleteRecipeVersion'
    { $sel:name:DeleteRecipeVersion' :: Text
name = Text
pName_,
      $sel:recipeVersion:DeleteRecipeVersion' :: Text
recipeVersion = Text
pRecipeVersion_
    }

-- | The name of the recipe.
deleteRecipeVersion_name :: Lens.Lens' DeleteRecipeVersion Prelude.Text
deleteRecipeVersion_name :: (Text -> f Text) -> DeleteRecipeVersion -> f DeleteRecipeVersion
deleteRecipeVersion_name = (DeleteRecipeVersion -> Text)
-> (DeleteRecipeVersion -> Text -> DeleteRecipeVersion)
-> Lens DeleteRecipeVersion DeleteRecipeVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecipeVersion' {Text
name :: Text
$sel:name:DeleteRecipeVersion' :: DeleteRecipeVersion -> Text
name} -> Text
name) (\s :: DeleteRecipeVersion
s@DeleteRecipeVersion' {} Text
a -> DeleteRecipeVersion
s {$sel:name:DeleteRecipeVersion' :: Text
name = Text
a} :: DeleteRecipeVersion)

-- | The version of the recipe to be deleted. You can specify a numeric
-- versions (@X.Y@) or @LATEST_WORKING@. @LATEST_PUBLISHED@ is not
-- supported.
deleteRecipeVersion_recipeVersion :: Lens.Lens' DeleteRecipeVersion Prelude.Text
deleteRecipeVersion_recipeVersion :: (Text -> f Text) -> DeleteRecipeVersion -> f DeleteRecipeVersion
deleteRecipeVersion_recipeVersion = (DeleteRecipeVersion -> Text)
-> (DeleteRecipeVersion -> Text -> DeleteRecipeVersion)
-> Lens DeleteRecipeVersion DeleteRecipeVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecipeVersion' {Text
recipeVersion :: Text
$sel:recipeVersion:DeleteRecipeVersion' :: DeleteRecipeVersion -> Text
recipeVersion} -> Text
recipeVersion) (\s :: DeleteRecipeVersion
s@DeleteRecipeVersion' {} Text
a -> DeleteRecipeVersion
s {$sel:recipeVersion:DeleteRecipeVersion' :: Text
recipeVersion = Text
a} :: DeleteRecipeVersion)

instance Core.AWSRequest DeleteRecipeVersion where
  type
    AWSResponse DeleteRecipeVersion =
      DeleteRecipeVersionResponse
  request :: DeleteRecipeVersion -> Request DeleteRecipeVersion
request = Service -> DeleteRecipeVersion -> Request DeleteRecipeVersion
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteRecipeVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRecipeVersion)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteRecipeVersion))
-> Logger
-> Service
-> Proxy DeleteRecipeVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteRecipeVersion)))
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 ->
          Int -> Text -> Text -> DeleteRecipeVersionResponse
DeleteRecipeVersionResponse'
            (Int -> Text -> Text -> DeleteRecipeVersionResponse)
-> Either String Int
-> Either String (Text -> Text -> DeleteRecipeVersionResponse)
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))
            Either String (Text -> Text -> DeleteRecipeVersionResponse)
-> Either String Text
-> Either String (Text -> DeleteRecipeVersionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Name")
            Either String (Text -> DeleteRecipeVersionResponse)
-> Either String Text -> Either String DeleteRecipeVersionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"RecipeVersion")
      )

instance Prelude.Hashable DeleteRecipeVersion

instance Prelude.NFData DeleteRecipeVersion

instance Core.ToHeaders DeleteRecipeVersion where
  toHeaders :: DeleteRecipeVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteRecipeVersion -> 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 DeleteRecipeVersion where
  toPath :: DeleteRecipeVersion -> ByteString
toPath DeleteRecipeVersion' {Text
recipeVersion :: Text
name :: Text
$sel:recipeVersion:DeleteRecipeVersion' :: DeleteRecipeVersion -> Text
$sel:name:DeleteRecipeVersion' :: DeleteRecipeVersion -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/recipes/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name,
        ByteString
"/recipeVersion/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
recipeVersion
      ]

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

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

-- |
-- Create a value of 'DeleteRecipeVersionResponse' 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', 'deleteRecipeVersionResponse_httpStatus' - The response's http status code.
--
-- 'name', 'deleteRecipeVersionResponse_name' - The name of the recipe that was deleted.
--
-- 'recipeVersion', 'deleteRecipeVersionResponse_recipeVersion' - The version of the recipe that was deleted.
newDeleteRecipeVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'name'
  Prelude.Text ->
  -- | 'recipeVersion'
  Prelude.Text ->
  DeleteRecipeVersionResponse
newDeleteRecipeVersionResponse :: Int -> Text -> Text -> DeleteRecipeVersionResponse
newDeleteRecipeVersionResponse
  Int
pHttpStatus_
  Text
pName_
  Text
pRecipeVersion_ =
    DeleteRecipeVersionResponse' :: Int -> Text -> Text -> DeleteRecipeVersionResponse
DeleteRecipeVersionResponse'
      { $sel:httpStatus:DeleteRecipeVersionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:name:DeleteRecipeVersionResponse' :: Text
name = Text
pName_,
        $sel:recipeVersion:DeleteRecipeVersionResponse' :: Text
recipeVersion = Text
pRecipeVersion_
      }

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

-- | The name of the recipe that was deleted.
deleteRecipeVersionResponse_name :: Lens.Lens' DeleteRecipeVersionResponse Prelude.Text
deleteRecipeVersionResponse_name :: (Text -> f Text)
-> DeleteRecipeVersionResponse -> f DeleteRecipeVersionResponse
deleteRecipeVersionResponse_name = (DeleteRecipeVersionResponse -> Text)
-> (DeleteRecipeVersionResponse
    -> Text -> DeleteRecipeVersionResponse)
-> Lens
     DeleteRecipeVersionResponse DeleteRecipeVersionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecipeVersionResponse' {Text
name :: Text
$sel:name:DeleteRecipeVersionResponse' :: DeleteRecipeVersionResponse -> Text
name} -> Text
name) (\s :: DeleteRecipeVersionResponse
s@DeleteRecipeVersionResponse' {} Text
a -> DeleteRecipeVersionResponse
s {$sel:name:DeleteRecipeVersionResponse' :: Text
name = Text
a} :: DeleteRecipeVersionResponse)

-- | The version of the recipe that was deleted.
deleteRecipeVersionResponse_recipeVersion :: Lens.Lens' DeleteRecipeVersionResponse Prelude.Text
deleteRecipeVersionResponse_recipeVersion :: (Text -> f Text)
-> DeleteRecipeVersionResponse -> f DeleteRecipeVersionResponse
deleteRecipeVersionResponse_recipeVersion = (DeleteRecipeVersionResponse -> Text)
-> (DeleteRecipeVersionResponse
    -> Text -> DeleteRecipeVersionResponse)
-> Lens
     DeleteRecipeVersionResponse DeleteRecipeVersionResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRecipeVersionResponse' {Text
recipeVersion :: Text
$sel:recipeVersion:DeleteRecipeVersionResponse' :: DeleteRecipeVersionResponse -> Text
recipeVersion} -> Text
recipeVersion) (\s :: DeleteRecipeVersionResponse
s@DeleteRecipeVersionResponse' {} Text
a -> DeleteRecipeVersionResponse
s {$sel:recipeVersion:DeleteRecipeVersionResponse' :: Text
recipeVersion = Text
a} :: DeleteRecipeVersionResponse)

instance Prelude.NFData DeleteRecipeVersionResponse