{-# 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.IoT.DeleteProvisioningTemplateVersion
-- 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 fleet provisioning template version.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteProvisioningTemplateVersion>
-- action.
module Amazonka.IoT.DeleteProvisioningTemplateVersion
  ( -- * Creating a Request
    DeleteProvisioningTemplateVersion (..),
    newDeleteProvisioningTemplateVersion,

    -- * Request Lenses
    deleteProvisioningTemplateVersion_templateName,
    deleteProvisioningTemplateVersion_versionId,

    -- * Destructuring the Response
    DeleteProvisioningTemplateVersionResponse (..),
    newDeleteProvisioningTemplateVersionResponse,

    -- * Response Lenses
    deleteProvisioningTemplateVersionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.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:/ 'newDeleteProvisioningTemplateVersion' smart constructor.
data DeleteProvisioningTemplateVersion = DeleteProvisioningTemplateVersion'
  { -- | The name of the fleet provisioning template version to delete.
    DeleteProvisioningTemplateVersion -> Text
templateName :: Prelude.Text,
    -- | The fleet provisioning template version ID to delete.
    DeleteProvisioningTemplateVersion -> Int
versionId :: Prelude.Int
  }
  deriving (DeleteProvisioningTemplateVersion
-> DeleteProvisioningTemplateVersion -> Bool
(DeleteProvisioningTemplateVersion
 -> DeleteProvisioningTemplateVersion -> Bool)
-> (DeleteProvisioningTemplateVersion
    -> DeleteProvisioningTemplateVersion -> Bool)
-> Eq DeleteProvisioningTemplateVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteProvisioningTemplateVersion
-> DeleteProvisioningTemplateVersion -> Bool
$c/= :: DeleteProvisioningTemplateVersion
-> DeleteProvisioningTemplateVersion -> Bool
== :: DeleteProvisioningTemplateVersion
-> DeleteProvisioningTemplateVersion -> Bool
$c== :: DeleteProvisioningTemplateVersion
-> DeleteProvisioningTemplateVersion -> Bool
Prelude.Eq, ReadPrec [DeleteProvisioningTemplateVersion]
ReadPrec DeleteProvisioningTemplateVersion
Int -> ReadS DeleteProvisioningTemplateVersion
ReadS [DeleteProvisioningTemplateVersion]
(Int -> ReadS DeleteProvisioningTemplateVersion)
-> ReadS [DeleteProvisioningTemplateVersion]
-> ReadPrec DeleteProvisioningTemplateVersion
-> ReadPrec [DeleteProvisioningTemplateVersion]
-> Read DeleteProvisioningTemplateVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteProvisioningTemplateVersion]
$creadListPrec :: ReadPrec [DeleteProvisioningTemplateVersion]
readPrec :: ReadPrec DeleteProvisioningTemplateVersion
$creadPrec :: ReadPrec DeleteProvisioningTemplateVersion
readList :: ReadS [DeleteProvisioningTemplateVersion]
$creadList :: ReadS [DeleteProvisioningTemplateVersion]
readsPrec :: Int -> ReadS DeleteProvisioningTemplateVersion
$creadsPrec :: Int -> ReadS DeleteProvisioningTemplateVersion
Prelude.Read, Int -> DeleteProvisioningTemplateVersion -> ShowS
[DeleteProvisioningTemplateVersion] -> ShowS
DeleteProvisioningTemplateVersion -> String
(Int -> DeleteProvisioningTemplateVersion -> ShowS)
-> (DeleteProvisioningTemplateVersion -> String)
-> ([DeleteProvisioningTemplateVersion] -> ShowS)
-> Show DeleteProvisioningTemplateVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteProvisioningTemplateVersion] -> ShowS
$cshowList :: [DeleteProvisioningTemplateVersion] -> ShowS
show :: DeleteProvisioningTemplateVersion -> String
$cshow :: DeleteProvisioningTemplateVersion -> String
showsPrec :: Int -> DeleteProvisioningTemplateVersion -> ShowS
$cshowsPrec :: Int -> DeleteProvisioningTemplateVersion -> ShowS
Prelude.Show, (forall x.
 DeleteProvisioningTemplateVersion
 -> Rep DeleteProvisioningTemplateVersion x)
-> (forall x.
    Rep DeleteProvisioningTemplateVersion x
    -> DeleteProvisioningTemplateVersion)
-> Generic DeleteProvisioningTemplateVersion
forall x.
Rep DeleteProvisioningTemplateVersion x
-> DeleteProvisioningTemplateVersion
forall x.
DeleteProvisioningTemplateVersion
-> Rep DeleteProvisioningTemplateVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteProvisioningTemplateVersion x
-> DeleteProvisioningTemplateVersion
$cfrom :: forall x.
DeleteProvisioningTemplateVersion
-> Rep DeleteProvisioningTemplateVersion x
Prelude.Generic)

-- |
-- Create a value of 'DeleteProvisioningTemplateVersion' 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:
--
-- 'templateName', 'deleteProvisioningTemplateVersion_templateName' - The name of the fleet provisioning template version to delete.
--
-- 'versionId', 'deleteProvisioningTemplateVersion_versionId' - The fleet provisioning template version ID to delete.
newDeleteProvisioningTemplateVersion ::
  -- | 'templateName'
  Prelude.Text ->
  -- | 'versionId'
  Prelude.Int ->
  DeleteProvisioningTemplateVersion
newDeleteProvisioningTemplateVersion :: Text -> Int -> DeleteProvisioningTemplateVersion
newDeleteProvisioningTemplateVersion
  Text
pTemplateName_
  Int
pVersionId_ =
    DeleteProvisioningTemplateVersion' :: Text -> Int -> DeleteProvisioningTemplateVersion
DeleteProvisioningTemplateVersion'
      { $sel:templateName:DeleteProvisioningTemplateVersion' :: Text
templateName =
          Text
pTemplateName_,
        $sel:versionId:DeleteProvisioningTemplateVersion' :: Int
versionId = Int
pVersionId_
      }

-- | The name of the fleet provisioning template version to delete.
deleteProvisioningTemplateVersion_templateName :: Lens.Lens' DeleteProvisioningTemplateVersion Prelude.Text
deleteProvisioningTemplateVersion_templateName :: (Text -> f Text)
-> DeleteProvisioningTemplateVersion
-> f DeleteProvisioningTemplateVersion
deleteProvisioningTemplateVersion_templateName = (DeleteProvisioningTemplateVersion -> Text)
-> (DeleteProvisioningTemplateVersion
    -> Text -> DeleteProvisioningTemplateVersion)
-> Lens
     DeleteProvisioningTemplateVersion
     DeleteProvisioningTemplateVersion
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProvisioningTemplateVersion' {Text
templateName :: Text
$sel:templateName:DeleteProvisioningTemplateVersion' :: DeleteProvisioningTemplateVersion -> Text
templateName} -> Text
templateName) (\s :: DeleteProvisioningTemplateVersion
s@DeleteProvisioningTemplateVersion' {} Text
a -> DeleteProvisioningTemplateVersion
s {$sel:templateName:DeleteProvisioningTemplateVersion' :: Text
templateName = Text
a} :: DeleteProvisioningTemplateVersion)

-- | The fleet provisioning template version ID to delete.
deleteProvisioningTemplateVersion_versionId :: Lens.Lens' DeleteProvisioningTemplateVersion Prelude.Int
deleteProvisioningTemplateVersion_versionId :: (Int -> f Int)
-> DeleteProvisioningTemplateVersion
-> f DeleteProvisioningTemplateVersion
deleteProvisioningTemplateVersion_versionId = (DeleteProvisioningTemplateVersion -> Int)
-> (DeleteProvisioningTemplateVersion
    -> Int -> DeleteProvisioningTemplateVersion)
-> Lens
     DeleteProvisioningTemplateVersion
     DeleteProvisioningTemplateVersion
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteProvisioningTemplateVersion' {Int
versionId :: Int
$sel:versionId:DeleteProvisioningTemplateVersion' :: DeleteProvisioningTemplateVersion -> Int
versionId} -> Int
versionId) (\s :: DeleteProvisioningTemplateVersion
s@DeleteProvisioningTemplateVersion' {} Int
a -> DeleteProvisioningTemplateVersion
s {$sel:versionId:DeleteProvisioningTemplateVersion' :: Int
versionId = Int
a} :: DeleteProvisioningTemplateVersion)

instance
  Core.AWSRequest
    DeleteProvisioningTemplateVersion
  where
  type
    AWSResponse DeleteProvisioningTemplateVersion =
      DeleteProvisioningTemplateVersionResponse
  request :: DeleteProvisioningTemplateVersion
-> Request DeleteProvisioningTemplateVersion
request = Service
-> DeleteProvisioningTemplateVersion
-> Request DeleteProvisioningTemplateVersion
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteProvisioningTemplateVersion
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteProvisioningTemplateVersion)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteProvisioningTemplateVersion))
-> Logger
-> Service
-> Proxy DeleteProvisioningTemplateVersion
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteProvisioningTemplateVersion)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteProvisioningTemplateVersionResponse
DeleteProvisioningTemplateVersionResponse'
            (Int -> DeleteProvisioningTemplateVersionResponse)
-> Either String Int
-> Either String DeleteProvisioningTemplateVersionResponse
forall (f :: * -> *) a b. Functor 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
    DeleteProvisioningTemplateVersion

instance
  Prelude.NFData
    DeleteProvisioningTemplateVersion

instance
  Core.ToHeaders
    DeleteProvisioningTemplateVersion
  where
  toHeaders :: DeleteProvisioningTemplateVersion -> ResponseHeaders
toHeaders = ResponseHeaders
-> DeleteProvisioningTemplateVersion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance
  Core.ToPath
    DeleteProvisioningTemplateVersion
  where
  toPath :: DeleteProvisioningTemplateVersion -> ByteString
toPath DeleteProvisioningTemplateVersion' {Int
Text
versionId :: Int
templateName :: Text
$sel:versionId:DeleteProvisioningTemplateVersion' :: DeleteProvisioningTemplateVersion -> Int
$sel:templateName:DeleteProvisioningTemplateVersion' :: DeleteProvisioningTemplateVersion -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/provisioning-templates/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
templateName,
        ByteString
"/versions/",
        Int -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Int
versionId
      ]

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

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

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

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

instance
  Prelude.NFData
    DeleteProvisioningTemplateVersionResponse