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

    -- * Request Lenses
    deleteImageRecipe_imageRecipeArn,

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

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

import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.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:/ '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
(DeleteImageRecipe -> DeleteImageRecipe -> Bool)
-> (DeleteImageRecipe -> DeleteImageRecipe -> Bool)
-> Eq DeleteImageRecipe
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]
(Int -> ReadS DeleteImageRecipe)
-> ReadS [DeleteImageRecipe]
-> ReadPrec DeleteImageRecipe
-> ReadPrec [DeleteImageRecipe]
-> Read 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
(Int -> DeleteImageRecipe -> ShowS)
-> (DeleteImageRecipe -> String)
-> ([DeleteImageRecipe] -> ShowS)
-> Show DeleteImageRecipe
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. DeleteImageRecipe -> Rep DeleteImageRecipe x)
-> (forall x. Rep DeleteImageRecipe x -> DeleteImageRecipe)
-> Generic DeleteImageRecipe
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' :: Text -> DeleteImageRecipe
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 :: (Text -> f Text) -> DeleteImageRecipe -> f DeleteImageRecipe
deleteImageRecipe_imageRecipeArn = (DeleteImageRecipe -> Text)
-> (DeleteImageRecipe -> Text -> DeleteImageRecipe)
-> Lens DeleteImageRecipe DeleteImageRecipe Text Text
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 :: DeleteImageRecipe -> Request DeleteImageRecipe
request = Service -> DeleteImageRecipe -> Request DeleteImageRecipe
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteImageRecipe
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteImageRecipe)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteImageRecipe))
-> Logger
-> Service
-> Proxy DeleteImageRecipe
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteImageRecipe)))
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 -> Maybe Text -> Int -> DeleteImageRecipeResponse
DeleteImageRecipeResponse'
            (Maybe Text -> Maybe Text -> Int -> DeleteImageRecipeResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DeleteImageRecipeResponse)
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
"requestId")
            Either String (Maybe Text -> Int -> DeleteImageRecipeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteImageRecipeResponse)
forall (f :: * -> *) a b. Applicative f => 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
"imageRecipeArn")
            Either String (Int -> DeleteImageRecipeResponse)
-> Either String Int -> Either String DeleteImageRecipeResponse
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 DeleteImageRecipe

instance Prelude.NFData DeleteImageRecipe

instance Core.ToHeaders DeleteImageRecipe where
  toHeaders :: DeleteImageRecipe -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteImageRecipe -> 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 DeleteImageRecipe where
  toPath :: DeleteImageRecipe -> ByteString
toPath = ByteString -> DeleteImageRecipe -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/DeleteImageRecipe"

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

-- | /See:/ 'newDeleteImageRecipeResponse' smart constructor.
data DeleteImageRecipeResponse = DeleteImageRecipeResponse'
  { -- | The request ID that uniquely identifies this request.
    DeleteImageRecipeResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the image recipe that was deleted.
    DeleteImageRecipeResponse -> Maybe Text
imageRecipeArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteImageRecipeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteImageRecipeResponse -> DeleteImageRecipeResponse -> Bool
(DeleteImageRecipeResponse -> DeleteImageRecipeResponse -> Bool)
-> (DeleteImageRecipeResponse -> DeleteImageRecipeResponse -> Bool)
-> Eq DeleteImageRecipeResponse
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]
(Int -> ReadS DeleteImageRecipeResponse)
-> ReadS [DeleteImageRecipeResponse]
-> ReadPrec DeleteImageRecipeResponse
-> ReadPrec [DeleteImageRecipeResponse]
-> Read 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
(Int -> DeleteImageRecipeResponse -> ShowS)
-> (DeleteImageRecipeResponse -> String)
-> ([DeleteImageRecipeResponse] -> ShowS)
-> Show DeleteImageRecipeResponse
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.
 DeleteImageRecipeResponse -> Rep DeleteImageRecipeResponse x)
-> (forall x.
    Rep DeleteImageRecipeResponse x -> DeleteImageRecipeResponse)
-> Generic DeleteImageRecipeResponse
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:
--
-- 'requestId', 'deleteImageRecipeResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'imageRecipeArn', 'deleteImageRecipeResponse_imageRecipeArn' - The Amazon Resource Name (ARN) of the image recipe that was deleted.
--
-- 'httpStatus', 'deleteImageRecipeResponse_httpStatus' - The response's http status code.
newDeleteImageRecipeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteImageRecipeResponse
newDeleteImageRecipeResponse :: Int -> DeleteImageRecipeResponse
newDeleteImageRecipeResponse Int
pHttpStatus_ =
  DeleteImageRecipeResponse' :: Maybe Text -> Maybe Text -> Int -> DeleteImageRecipeResponse
DeleteImageRecipeResponse'
    { $sel:requestId:DeleteImageRecipeResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageRecipeArn:DeleteImageRecipeResponse' :: Maybe Text
imageRecipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteImageRecipeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The request ID that uniquely identifies this request.
deleteImageRecipeResponse_requestId :: Lens.Lens' DeleteImageRecipeResponse (Prelude.Maybe Prelude.Text)
deleteImageRecipeResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DeleteImageRecipeResponse -> f DeleteImageRecipeResponse
deleteImageRecipeResponse_requestId = (DeleteImageRecipeResponse -> Maybe Text)
-> (DeleteImageRecipeResponse
    -> Maybe Text -> DeleteImageRecipeResponse)
-> Lens
     DeleteImageRecipeResponse
     DeleteImageRecipeResponse
     (Maybe Text)
     (Maybe Text)
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 Amazon Resource Name (ARN) of the image recipe that was deleted.
deleteImageRecipeResponse_imageRecipeArn :: Lens.Lens' DeleteImageRecipeResponse (Prelude.Maybe Prelude.Text)
deleteImageRecipeResponse_imageRecipeArn :: (Maybe Text -> f (Maybe Text))
-> DeleteImageRecipeResponse -> f DeleteImageRecipeResponse
deleteImageRecipeResponse_imageRecipeArn = (DeleteImageRecipeResponse -> Maybe Text)
-> (DeleteImageRecipeResponse
    -> Maybe Text -> DeleteImageRecipeResponse)
-> Lens
     DeleteImageRecipeResponse
     DeleteImageRecipeResponse
     (Maybe Text)
     (Maybe Text)
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 response's http status code.
deleteImageRecipeResponse_httpStatus :: Lens.Lens' DeleteImageRecipeResponse Prelude.Int
deleteImageRecipeResponse_httpStatus :: (Int -> f Int)
-> DeleteImageRecipeResponse -> f DeleteImageRecipeResponse
deleteImageRecipeResponse_httpStatus = (DeleteImageRecipeResponse -> Int)
-> (DeleteImageRecipeResponse -> Int -> DeleteImageRecipeResponse)
-> Lens DeleteImageRecipeResponse DeleteImageRecipeResponse Int Int
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