{-# 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.ServiceCatalog.DeleteProvisioningArtifact
-- 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 the specified provisioning artifact (also known as a version)
-- for the specified product.
--
-- You cannot delete a provisioning artifact associated with a product that
-- was shared with you. You cannot delete the last provisioning artifact
-- for a product, because a product must have at least one provisioning
-- artifact.
module Amazonka.ServiceCatalog.DeleteProvisioningArtifact
  ( -- * Creating a Request
    DeleteProvisioningArtifact (..),
    newDeleteProvisioningArtifact,

    -- * Request Lenses
    deleteProvisioningArtifact_acceptLanguage,
    deleteProvisioningArtifact_productId,
    deleteProvisioningArtifact_provisioningArtifactId,

    -- * Destructuring the Response
    DeleteProvisioningArtifactResponse (..),
    newDeleteProvisioningArtifactResponse,

    -- * Response Lenses
    deleteProvisioningArtifactResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteProvisioningArtifact' smart constructor.
data DeleteProvisioningArtifact = DeleteProvisioningArtifact'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    DeleteProvisioningArtifact -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The product identifier.
    DeleteProvisioningArtifact -> Text
productId :: Prelude.Text,
    -- | The identifier of the provisioning artifact.
    DeleteProvisioningArtifact -> Text
provisioningArtifactId :: Prelude.Text
  }
  deriving (DeleteProvisioningArtifact -> DeleteProvisioningArtifact -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteProvisioningArtifact -> DeleteProvisioningArtifact -> Bool
$c/= :: DeleteProvisioningArtifact -> DeleteProvisioningArtifact -> Bool
== :: DeleteProvisioningArtifact -> DeleteProvisioningArtifact -> Bool
$c== :: DeleteProvisioningArtifact -> DeleteProvisioningArtifact -> Bool
Prelude.Eq, ReadPrec [DeleteProvisioningArtifact]
ReadPrec DeleteProvisioningArtifact
Int -> ReadS DeleteProvisioningArtifact
ReadS [DeleteProvisioningArtifact]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteProvisioningArtifact]
$creadListPrec :: ReadPrec [DeleteProvisioningArtifact]
readPrec :: ReadPrec DeleteProvisioningArtifact
$creadPrec :: ReadPrec DeleteProvisioningArtifact
readList :: ReadS [DeleteProvisioningArtifact]
$creadList :: ReadS [DeleteProvisioningArtifact]
readsPrec :: Int -> ReadS DeleteProvisioningArtifact
$creadsPrec :: Int -> ReadS DeleteProvisioningArtifact
Prelude.Read, Int -> DeleteProvisioningArtifact -> ShowS
[DeleteProvisioningArtifact] -> ShowS
DeleteProvisioningArtifact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteProvisioningArtifact] -> ShowS
$cshowList :: [DeleteProvisioningArtifact] -> ShowS
show :: DeleteProvisioningArtifact -> String
$cshow :: DeleteProvisioningArtifact -> String
showsPrec :: Int -> DeleteProvisioningArtifact -> ShowS
$cshowsPrec :: Int -> DeleteProvisioningArtifact -> ShowS
Prelude.Show, forall x.
Rep DeleteProvisioningArtifact x -> DeleteProvisioningArtifact
forall x.
DeleteProvisioningArtifact -> Rep DeleteProvisioningArtifact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteProvisioningArtifact x -> DeleteProvisioningArtifact
$cfrom :: forall x.
DeleteProvisioningArtifact -> Rep DeleteProvisioningArtifact x
Prelude.Generic)

-- |
-- Create a value of 'DeleteProvisioningArtifact' 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:
--
-- 'acceptLanguage', 'deleteProvisioningArtifact_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'productId', 'deleteProvisioningArtifact_productId' - The product identifier.
--
-- 'provisioningArtifactId', 'deleteProvisioningArtifact_provisioningArtifactId' - The identifier of the provisioning artifact.
newDeleteProvisioningArtifact ::
  -- | 'productId'
  Prelude.Text ->
  -- | 'provisioningArtifactId'
  Prelude.Text ->
  DeleteProvisioningArtifact
newDeleteProvisioningArtifact :: Text -> Text -> DeleteProvisioningArtifact
newDeleteProvisioningArtifact
  Text
pProductId_
  Text
pProvisioningArtifactId_ =
    DeleteProvisioningArtifact'
      { $sel:acceptLanguage:DeleteProvisioningArtifact' :: Maybe Text
acceptLanguage =
          forall a. Maybe a
Prelude.Nothing,
        $sel:productId:DeleteProvisioningArtifact' :: Text
productId = Text
pProductId_,
        $sel:provisioningArtifactId:DeleteProvisioningArtifact' :: Text
provisioningArtifactId =
          Text
pProvisioningArtifactId_
      }

-- | The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
deleteProvisioningArtifact_acceptLanguage :: Lens.Lens' DeleteProvisioningArtifact (Prelude.Maybe Prelude.Text)
deleteProvisioningArtifact_acceptLanguage :: Lens' DeleteProvisioningArtifact (Maybe Text)
deleteProvisioningArtifact_acceptLanguage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProvisioningArtifact' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: DeleteProvisioningArtifact
s@DeleteProvisioningArtifact' {} Maybe Text
a -> DeleteProvisioningArtifact
s {$sel:acceptLanguage:DeleteProvisioningArtifact' :: Maybe Text
acceptLanguage = Maybe Text
a} :: DeleteProvisioningArtifact)

-- | The product identifier.
deleteProvisioningArtifact_productId :: Lens.Lens' DeleteProvisioningArtifact Prelude.Text
deleteProvisioningArtifact_productId :: Lens' DeleteProvisioningArtifact Text
deleteProvisioningArtifact_productId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProvisioningArtifact' {Text
productId :: Text
$sel:productId:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Text
productId} -> Text
productId) (\s :: DeleteProvisioningArtifact
s@DeleteProvisioningArtifact' {} Text
a -> DeleteProvisioningArtifact
s {$sel:productId:DeleteProvisioningArtifact' :: Text
productId = Text
a} :: DeleteProvisioningArtifact)

-- | The identifier of the provisioning artifact.
deleteProvisioningArtifact_provisioningArtifactId :: Lens.Lens' DeleteProvisioningArtifact Prelude.Text
deleteProvisioningArtifact_provisioningArtifactId :: Lens' DeleteProvisioningArtifact Text
deleteProvisioningArtifact_provisioningArtifactId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProvisioningArtifact' {Text
provisioningArtifactId :: Text
$sel:provisioningArtifactId:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Text
provisioningArtifactId} -> Text
provisioningArtifactId) (\s :: DeleteProvisioningArtifact
s@DeleteProvisioningArtifact' {} Text
a -> DeleteProvisioningArtifact
s {$sel:provisioningArtifactId:DeleteProvisioningArtifact' :: Text
provisioningArtifactId = Text
a} :: DeleteProvisioningArtifact)

instance Core.AWSRequest DeleteProvisioningArtifact where
  type
    AWSResponse DeleteProvisioningArtifact =
      DeleteProvisioningArtifactResponse
  request :: (Service -> Service)
-> DeleteProvisioningArtifact -> Request DeleteProvisioningArtifact
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteProvisioningArtifact
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteProvisioningArtifact)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteProvisioningArtifactResponse
DeleteProvisioningArtifactResponse'
            forall (f :: * -> *) a b. Functor 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 DeleteProvisioningArtifact where
  hashWithSalt :: Int -> DeleteProvisioningArtifact -> Int
hashWithSalt Int
_salt DeleteProvisioningArtifact' {Maybe Text
Text
provisioningArtifactId :: Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:provisioningArtifactId:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Text
$sel:productId:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Text
$sel:acceptLanguage:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
productId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
provisioningArtifactId

instance Prelude.NFData DeleteProvisioningArtifact where
  rnf :: DeleteProvisioningArtifact -> ()
rnf DeleteProvisioningArtifact' {Maybe Text
Text
provisioningArtifactId :: Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:provisioningArtifactId:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Text
$sel:productId:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Text
$sel:acceptLanguage:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
productId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
provisioningArtifactId

instance Data.ToHeaders DeleteProvisioningArtifact where
  toHeaders :: DeleteProvisioningArtifact -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWS242ServiceCatalogService.DeleteProvisioningArtifact" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteProvisioningArtifact where
  toJSON :: DeleteProvisioningArtifact -> Value
toJSON DeleteProvisioningArtifact' {Maybe Text
Text
provisioningArtifactId :: Text
productId :: Text
acceptLanguage :: Maybe Text
$sel:provisioningArtifactId:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Text
$sel:productId:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Text
$sel:acceptLanguage:DeleteProvisioningArtifact' :: DeleteProvisioningArtifact -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
            forall a. a -> Maybe a
Prelude.Just (Key
"ProductId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
productId),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ProvisioningArtifactId"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
provisioningArtifactId
              )
          ]
      )

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

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

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

-- |
-- Create a value of 'DeleteProvisioningArtifactResponse' 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', 'deleteProvisioningArtifactResponse_httpStatus' - The response's http status code.
newDeleteProvisioningArtifactResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteProvisioningArtifactResponse
newDeleteProvisioningArtifactResponse :: Int -> DeleteProvisioningArtifactResponse
newDeleteProvisioningArtifactResponse Int
pHttpStatus_ =
  DeleteProvisioningArtifactResponse'
    { $sel:httpStatus:DeleteProvisioningArtifactResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DeleteProvisioningArtifactResponse
  where
  rnf :: DeleteProvisioningArtifactResponse -> ()
rnf DeleteProvisioningArtifactResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteProvisioningArtifactResponse' :: DeleteProvisioningArtifactResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus