{-# 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.DeleteComponent
-- 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 component build version.
module Amazonka.ImageBuilder.DeleteComponent
  ( -- * Creating a Request
    DeleteComponent (..),
    newDeleteComponent,

    -- * Request Lenses
    deleteComponent_componentBuildVersionArn,

    -- * Destructuring the Response
    DeleteComponentResponse (..),
    newDeleteComponentResponse,

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

-- |
-- Create a value of 'DeleteComponent' 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:
--
-- 'componentBuildVersionArn', 'deleteComponent_componentBuildVersionArn' - The Amazon Resource Name (ARN) of the component build version to delete.
newDeleteComponent ::
  -- | 'componentBuildVersionArn'
  Prelude.Text ->
  DeleteComponent
newDeleteComponent :: Text -> DeleteComponent
newDeleteComponent Text
pComponentBuildVersionArn_ =
  DeleteComponent' :: Text -> DeleteComponent
DeleteComponent'
    { $sel:componentBuildVersionArn:DeleteComponent' :: Text
componentBuildVersionArn =
        Text
pComponentBuildVersionArn_
    }

-- | The Amazon Resource Name (ARN) of the component build version to delete.
deleteComponent_componentBuildVersionArn :: Lens.Lens' DeleteComponent Prelude.Text
deleteComponent_componentBuildVersionArn :: (Text -> f Text) -> DeleteComponent -> f DeleteComponent
deleteComponent_componentBuildVersionArn = (DeleteComponent -> Text)
-> (DeleteComponent -> Text -> DeleteComponent)
-> Lens DeleteComponent DeleteComponent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteComponent' {Text
componentBuildVersionArn :: Text
$sel:componentBuildVersionArn:DeleteComponent' :: DeleteComponent -> Text
componentBuildVersionArn} -> Text
componentBuildVersionArn) (\s :: DeleteComponent
s@DeleteComponent' {} Text
a -> DeleteComponent
s {$sel:componentBuildVersionArn:DeleteComponent' :: Text
componentBuildVersionArn = Text
a} :: DeleteComponent)

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

instance Prelude.NFData DeleteComponent

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

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

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

-- |
-- Create a value of 'DeleteComponentResponse' 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', 'deleteComponentResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'componentBuildVersionArn', 'deleteComponentResponse_componentBuildVersionArn' - The Amazon Resource Name (ARN) of the component build version that was
-- deleted.
--
-- 'httpStatus', 'deleteComponentResponse_httpStatus' - The response's http status code.
newDeleteComponentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteComponentResponse
newDeleteComponentResponse :: Int -> DeleteComponentResponse
newDeleteComponentResponse Int
pHttpStatus_ =
  DeleteComponentResponse' :: Maybe Text -> Maybe Text -> Int -> DeleteComponentResponse
DeleteComponentResponse'
    { $sel:requestId:DeleteComponentResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:componentBuildVersionArn:DeleteComponentResponse' :: Maybe Text
componentBuildVersionArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteComponentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The Amazon Resource Name (ARN) of the component build version that was
-- deleted.
deleteComponentResponse_componentBuildVersionArn :: Lens.Lens' DeleteComponentResponse (Prelude.Maybe Prelude.Text)
deleteComponentResponse_componentBuildVersionArn :: (Maybe Text -> f (Maybe Text))
-> DeleteComponentResponse -> f DeleteComponentResponse
deleteComponentResponse_componentBuildVersionArn = (DeleteComponentResponse -> Maybe Text)
-> (DeleteComponentResponse
    -> Maybe Text -> DeleteComponentResponse)
-> Lens
     DeleteComponentResponse
     DeleteComponentResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteComponentResponse' {Maybe Text
componentBuildVersionArn :: Maybe Text
$sel:componentBuildVersionArn:DeleteComponentResponse' :: DeleteComponentResponse -> Maybe Text
componentBuildVersionArn} -> Maybe Text
componentBuildVersionArn) (\s :: DeleteComponentResponse
s@DeleteComponentResponse' {} Maybe Text
a -> DeleteComponentResponse
s {$sel:componentBuildVersionArn:DeleteComponentResponse' :: Maybe Text
componentBuildVersionArn = Maybe Text
a} :: DeleteComponentResponse)

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

instance Prelude.NFData DeleteComponentResponse