{-# 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.DeleteContainerRecipe
-- 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 container recipe.
module Amazonka.ImageBuilder.DeleteContainerRecipe
  ( -- * Creating a Request
    DeleteContainerRecipe (..),
    newDeleteContainerRecipe,

    -- * Request Lenses
    deleteContainerRecipe_containerRecipeArn,

    -- * Destructuring the Response
    DeleteContainerRecipeResponse (..),
    newDeleteContainerRecipeResponse,

    -- * Response Lenses
    deleteContainerRecipeResponse_requestId,
    deleteContainerRecipeResponse_containerRecipeArn,
    deleteContainerRecipeResponse_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:/ 'newDeleteContainerRecipe' smart constructor.
data DeleteContainerRecipe = DeleteContainerRecipe'
  { -- | The Amazon Resource Name (ARN) of the container recipe to delete.
    DeleteContainerRecipe -> Text
containerRecipeArn :: Prelude.Text
  }
  deriving (DeleteContainerRecipe -> DeleteContainerRecipe -> Bool
(DeleteContainerRecipe -> DeleteContainerRecipe -> Bool)
-> (DeleteContainerRecipe -> DeleteContainerRecipe -> Bool)
-> Eq DeleteContainerRecipe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteContainerRecipe -> DeleteContainerRecipe -> Bool
$c/= :: DeleteContainerRecipe -> DeleteContainerRecipe -> Bool
== :: DeleteContainerRecipe -> DeleteContainerRecipe -> Bool
$c== :: DeleteContainerRecipe -> DeleteContainerRecipe -> Bool
Prelude.Eq, ReadPrec [DeleteContainerRecipe]
ReadPrec DeleteContainerRecipe
Int -> ReadS DeleteContainerRecipe
ReadS [DeleteContainerRecipe]
(Int -> ReadS DeleteContainerRecipe)
-> ReadS [DeleteContainerRecipe]
-> ReadPrec DeleteContainerRecipe
-> ReadPrec [DeleteContainerRecipe]
-> Read DeleteContainerRecipe
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteContainerRecipe]
$creadListPrec :: ReadPrec [DeleteContainerRecipe]
readPrec :: ReadPrec DeleteContainerRecipe
$creadPrec :: ReadPrec DeleteContainerRecipe
readList :: ReadS [DeleteContainerRecipe]
$creadList :: ReadS [DeleteContainerRecipe]
readsPrec :: Int -> ReadS DeleteContainerRecipe
$creadsPrec :: Int -> ReadS DeleteContainerRecipe
Prelude.Read, Int -> DeleteContainerRecipe -> ShowS
[DeleteContainerRecipe] -> ShowS
DeleteContainerRecipe -> String
(Int -> DeleteContainerRecipe -> ShowS)
-> (DeleteContainerRecipe -> String)
-> ([DeleteContainerRecipe] -> ShowS)
-> Show DeleteContainerRecipe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteContainerRecipe] -> ShowS
$cshowList :: [DeleteContainerRecipe] -> ShowS
show :: DeleteContainerRecipe -> String
$cshow :: DeleteContainerRecipe -> String
showsPrec :: Int -> DeleteContainerRecipe -> ShowS
$cshowsPrec :: Int -> DeleteContainerRecipe -> ShowS
Prelude.Show, (forall x. DeleteContainerRecipe -> Rep DeleteContainerRecipe x)
-> (forall x. Rep DeleteContainerRecipe x -> DeleteContainerRecipe)
-> Generic DeleteContainerRecipe
forall x. Rep DeleteContainerRecipe x -> DeleteContainerRecipe
forall x. DeleteContainerRecipe -> Rep DeleteContainerRecipe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteContainerRecipe x -> DeleteContainerRecipe
$cfrom :: forall x. DeleteContainerRecipe -> Rep DeleteContainerRecipe x
Prelude.Generic)

-- |
-- Create a value of 'DeleteContainerRecipe' 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:
--
-- 'containerRecipeArn', 'deleteContainerRecipe_containerRecipeArn' - The Amazon Resource Name (ARN) of the container recipe to delete.
newDeleteContainerRecipe ::
  -- | 'containerRecipeArn'
  Prelude.Text ->
  DeleteContainerRecipe
newDeleteContainerRecipe :: Text -> DeleteContainerRecipe
newDeleteContainerRecipe Text
pContainerRecipeArn_ =
  DeleteContainerRecipe' :: Text -> DeleteContainerRecipe
DeleteContainerRecipe'
    { $sel:containerRecipeArn:DeleteContainerRecipe' :: Text
containerRecipeArn =
        Text
pContainerRecipeArn_
    }

-- | The Amazon Resource Name (ARN) of the container recipe to delete.
deleteContainerRecipe_containerRecipeArn :: Lens.Lens' DeleteContainerRecipe Prelude.Text
deleteContainerRecipe_containerRecipeArn :: (Text -> f Text)
-> DeleteContainerRecipe -> f DeleteContainerRecipe
deleteContainerRecipe_containerRecipeArn = (DeleteContainerRecipe -> Text)
-> (DeleteContainerRecipe -> Text -> DeleteContainerRecipe)
-> Lens DeleteContainerRecipe DeleteContainerRecipe Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteContainerRecipe' {Text
containerRecipeArn :: Text
$sel:containerRecipeArn:DeleteContainerRecipe' :: DeleteContainerRecipe -> Text
containerRecipeArn} -> Text
containerRecipeArn) (\s :: DeleteContainerRecipe
s@DeleteContainerRecipe' {} Text
a -> DeleteContainerRecipe
s {$sel:containerRecipeArn:DeleteContainerRecipe' :: Text
containerRecipeArn = Text
a} :: DeleteContainerRecipe)

instance Core.AWSRequest DeleteContainerRecipe where
  type
    AWSResponse DeleteContainerRecipe =
      DeleteContainerRecipeResponse
  request :: DeleteContainerRecipe -> Request DeleteContainerRecipe
request = Service -> DeleteContainerRecipe -> Request DeleteContainerRecipe
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteContainerRecipe
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContainerRecipe)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteContainerRecipe))
-> Logger
-> Service
-> Proxy DeleteContainerRecipe
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteContainerRecipe)))
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 -> DeleteContainerRecipeResponse
DeleteContainerRecipeResponse'
            (Maybe Text -> Maybe Text -> Int -> DeleteContainerRecipeResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> DeleteContainerRecipeResponse)
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 -> DeleteContainerRecipeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteContainerRecipeResponse)
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
"containerRecipeArn")
            Either String (Int -> DeleteContainerRecipeResponse)
-> Either String Int -> Either String DeleteContainerRecipeResponse
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 DeleteContainerRecipe

instance Prelude.NFData DeleteContainerRecipe

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

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

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

-- |
-- Create a value of 'DeleteContainerRecipeResponse' 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', 'deleteContainerRecipeResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'containerRecipeArn', 'deleteContainerRecipeResponse_containerRecipeArn' - The Amazon Resource Name (ARN) of the container recipe that was deleted.
--
-- 'httpStatus', 'deleteContainerRecipeResponse_httpStatus' - The response's http status code.
newDeleteContainerRecipeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteContainerRecipeResponse
newDeleteContainerRecipeResponse :: Int -> DeleteContainerRecipeResponse
newDeleteContainerRecipeResponse Int
pHttpStatus_ =
  DeleteContainerRecipeResponse' :: Maybe Text -> Maybe Text -> Int -> DeleteContainerRecipeResponse
DeleteContainerRecipeResponse'
    { $sel:requestId:DeleteContainerRecipeResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:containerRecipeArn:DeleteContainerRecipeResponse' :: Maybe Text
containerRecipeArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteContainerRecipeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

instance Prelude.NFData DeleteContainerRecipeResponse