{-# 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.ImageBuilder.DeleteImageRecipe
-- 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 image recipe.
module Amazonka.ImageBuilder.DeleteImageRecipe
  ( -- * Creating a Request
    DeleteImageRecipe (..),
    newDeleteImageRecipe,

    -- * Request Lenses
    deleteImageRecipe_imageRecipeArn,

    -- * Destructuring the Response
    DeleteImageRecipeResponse (..),
    newDeleteImageRecipeResponse,

    -- * Response Lenses
    deleteImageRecipeResponse_imageRecipeArn,
    deleteImageRecipeResponse_requestId,
    deleteImageRecipeResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteImageRecipe' smart constructor.
data DeleteImageRecipe = DeleteImageRecipe'
  { -- | The Amazon Resource Name (ARN) of the image recipe to delete.
    DeleteImageRecipe -> Text
imageRecipeArn :: Prelude.Text
  }
  deriving (DeleteImageRecipe -> DeleteImageRecipe -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteImageRecipe -> DeleteImageRecipe -> Bool
$c/= :: DeleteImageRecipe -> DeleteImageRecipe -> Bool
== :: DeleteImageRecipe -> DeleteImageRecipe -> Bool
$c== :: DeleteImageRecipe -> DeleteImageRecipe -> Bool
Prelude.Eq, ReadPrec [DeleteImageRecipe]
ReadPrec DeleteImageRecipe
Int -> ReadS DeleteImageRecipe
ReadS [DeleteImageRecipe]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteImageRecipe]
$creadListPrec :: ReadPrec [DeleteImageRecipe]
readPrec :: ReadPrec DeleteImageRecipe
$creadPrec :: ReadPrec DeleteImageRecipe
readList :: ReadS [DeleteImageRecipe]
$creadList :: ReadS [DeleteImageRecipe]
readsPrec :: Int -> ReadS DeleteImageRecipe
$creadsPrec :: Int -> ReadS DeleteImageRecipe
Prelude.Read, Int -> DeleteImageRecipe -> ShowS
[DeleteImageRecipe] -> ShowS
DeleteImageRecipe -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteImageRecipe] -> ShowS
$cshowList :: [DeleteImageRecipe] -> ShowS
show :: DeleteImageRecipe -> String
$cshow :: DeleteImageRecipe -> String
showsPrec :: Int -> DeleteImageRecipe -> ShowS
$cshowsPrec :: Int -> DeleteImageRecipe -> ShowS
Prelude.Show, forall x. Rep DeleteImageRecipe x -> DeleteImageRecipe
forall x. DeleteImageRecipe -> Rep DeleteImageRecipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteImageRecipe x -> DeleteImageRecipe
$cfrom :: forall x. DeleteImageRecipe -> Rep DeleteImageRecipe x
Prelude.Generic)

-- |
-- Create a value of 'DeleteImageRecipe' 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:
--
-- 'imageRecipeArn', 'deleteImageRecipe_imageRecipeArn' - The Amazon Resource Name (ARN) of the image recipe to delete.
newDeleteImageRecipe ::
  -- | 'imageRecipeArn'
  Prelude.Text ->
  DeleteImageRecipe
newDeleteImageRecipe :: Text -> DeleteImageRecipe
newDeleteImageRecipe Text
pImageRecipeArn_ =
  DeleteImageRecipe'
    { $sel:imageRecipeArn:DeleteImageRecipe' :: Text
imageRecipeArn =
        Text
pImageRecipeArn_
    }

-- | The Amazon Resource Name (ARN) of the image recipe to delete.
deleteImageRecipe_imageRecipeArn :: Lens.Lens' DeleteImageRecipe Prelude.Text
deleteImageRecipe_imageRecipeArn :: Lens' DeleteImageRecipe Text
deleteImageRecipe_imageRecipeArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteImageRecipe' {Text
imageRecipeArn :: Text
$sel:imageRecipeArn:DeleteImageRecipe' :: DeleteImageRecipe -> Text
imageRecipeArn} -> Text
imageRecipeArn) (\s :: DeleteImageRecipe
s@DeleteImageRecipe' {} Text
a -> DeleteImageRecipe
s {$sel:imageRecipeArn:DeleteImageRecipe' :: Text
imageRecipeArn = Text
a} :: DeleteImageRecipe)

instance Core.AWSRequest DeleteImageRecipe where
  type
    AWSResponse DeleteImageRecipe =
      DeleteImageRecipeResponse
  request :: (Service -> Service)
-> DeleteImageRecipe -> Request DeleteImageRecipe
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 DeleteImageRecipe
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteImageRecipe)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> DeleteImageRecipeResponse
DeleteImageRecipeResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"imageRecipeArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"requestId")
            forall (f :: * -> *) a b. Applicative f => 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 DeleteImageRecipe where
  hashWithSalt :: Int -> DeleteImageRecipe -> Int
hashWithSalt Int
_salt DeleteImageRecipe' {Text
imageRecipeArn :: Text
$sel:imageRecipeArn:DeleteImageRecipe' :: DeleteImageRecipe -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
imageRecipeArn

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

instance Data.ToHeaders DeleteImageRecipe where
  toHeaders :: DeleteImageRecipe -> ResponseHeaders
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 -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Data.ToQuery DeleteImageRecipe where
  toQuery :: DeleteImageRecipe -> QueryString
toQuery DeleteImageRecipe' {Text
imageRecipeArn :: Text
$sel:imageRecipeArn:DeleteImageRecipe' :: DeleteImageRecipe -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"imageRecipeArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
imageRecipeArn]

-- | /See:/ 'newDeleteImageRecipeResponse' smart constructor.
data DeleteImageRecipeResponse = DeleteImageRecipeResponse'
  { -- | The Amazon Resource Name (ARN) of the image recipe that was deleted.
    DeleteImageRecipeResponse -> Maybe Text
imageRecipeArn :: Prelude.Maybe Prelude.Text,
    -- | The request ID that uniquely identifies this request.
    DeleteImageRecipeResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteImageRecipeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteImageRecipeResponse -> DeleteImageRecipeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteImageRecipeResponse -> DeleteImageRecipeResponse -> Bool
$c/= :: DeleteImageRecipeResponse -> DeleteImageRecipeResponse -> Bool
== :: DeleteImageRecipeResponse -> DeleteImageRecipeResponse -> Bool
$c== :: DeleteImageRecipeResponse -> DeleteImageRecipeResponse -> Bool
Prelude.Eq, ReadPrec [DeleteImageRecipeResponse]
ReadPrec DeleteImageRecipeResponse
Int -> ReadS DeleteImageRecipeResponse
ReadS [DeleteImageRecipeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteImageRecipeResponse]
$creadListPrec :: ReadPrec [DeleteImageRecipeResponse]
readPrec :: ReadPrec DeleteImageRecipeResponse
$creadPrec :: ReadPrec DeleteImageRecipeResponse
readList :: ReadS [DeleteImageRecipeResponse]
$creadList :: ReadS [DeleteImageRecipeResponse]
readsPrec :: Int -> ReadS DeleteImageRecipeResponse
$creadsPrec :: Int -> ReadS DeleteImageRecipeResponse
Prelude.Read, Int -> DeleteImageRecipeResponse -> ShowS
[DeleteImageRecipeResponse] -> ShowS
DeleteImageRecipeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteImageRecipeResponse] -> ShowS
$cshowList :: [DeleteImageRecipeResponse] -> ShowS
show :: DeleteImageRecipeResponse -> String
$cshow :: DeleteImageRecipeResponse -> String
showsPrec :: Int -> DeleteImageRecipeResponse -> ShowS
$cshowsPrec :: Int -> DeleteImageRecipeResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteImageRecipeResponse x -> DeleteImageRecipeResponse
forall x.
DeleteImageRecipeResponse -> Rep DeleteImageRecipeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteImageRecipeResponse x -> DeleteImageRecipeResponse
$cfrom :: forall x.
DeleteImageRecipeResponse -> Rep DeleteImageRecipeResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteImageRecipeResponse' 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:
--
-- 'imageRecipeArn', 'deleteImageRecipeResponse_imageRecipeArn' - The Amazon Resource Name (ARN) of the image recipe that was deleted.
--
-- 'requestId', 'deleteImageRecipeResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'httpStatus', 'deleteImageRecipeResponse_httpStatus' - The response's http status code.
newDeleteImageRecipeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteImageRecipeResponse
newDeleteImageRecipeResponse :: Int -> DeleteImageRecipeResponse
newDeleteImageRecipeResponse Int
pHttpStatus_ =
  DeleteImageRecipeResponse'
    { $sel:imageRecipeArn:DeleteImageRecipeResponse' :: Maybe Text
imageRecipeArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:DeleteImageRecipeResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteImageRecipeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the image recipe that was deleted.
deleteImageRecipeResponse_imageRecipeArn :: Lens.Lens' DeleteImageRecipeResponse (Prelude.Maybe Prelude.Text)
deleteImageRecipeResponse_imageRecipeArn :: Lens' DeleteImageRecipeResponse (Maybe Text)
deleteImageRecipeResponse_imageRecipeArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteImageRecipeResponse' {Maybe Text
imageRecipeArn :: Maybe Text
$sel:imageRecipeArn:DeleteImageRecipeResponse' :: DeleteImageRecipeResponse -> Maybe Text
imageRecipeArn} -> Maybe Text
imageRecipeArn) (\s :: DeleteImageRecipeResponse
s@DeleteImageRecipeResponse' {} Maybe Text
a -> DeleteImageRecipeResponse
s {$sel:imageRecipeArn:DeleteImageRecipeResponse' :: Maybe Text
imageRecipeArn = Maybe Text
a} :: DeleteImageRecipeResponse)

-- | The request ID that uniquely identifies this request.
deleteImageRecipeResponse_requestId :: Lens.Lens' DeleteImageRecipeResponse (Prelude.Maybe Prelude.Text)
deleteImageRecipeResponse_requestId :: Lens' DeleteImageRecipeResponse (Maybe Text)
deleteImageRecipeResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteImageRecipeResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DeleteImageRecipeResponse' :: DeleteImageRecipeResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DeleteImageRecipeResponse
s@DeleteImageRecipeResponse' {} Maybe Text
a -> DeleteImageRecipeResponse
s {$sel:requestId:DeleteImageRecipeResponse' :: Maybe Text
requestId = Maybe Text
a} :: DeleteImageRecipeResponse)

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

instance Prelude.NFData DeleteImageRecipeResponse where
  rnf :: DeleteImageRecipeResponse -> ()
rnf DeleteImageRecipeResponse' {Int
Maybe Text
httpStatus :: Int
requestId :: Maybe Text
imageRecipeArn :: Maybe Text
$sel:httpStatus:DeleteImageRecipeResponse' :: DeleteImageRecipeResponse -> Int
$sel:requestId:DeleteImageRecipeResponse' :: DeleteImageRecipeResponse -> Maybe Text
$sel:imageRecipeArn:DeleteImageRecipeResponse' :: DeleteImageRecipeResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
imageRecipeArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus