{-# 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.DeleteSecurityProfile
-- 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 a Device Defender security profile.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteSecurityProfile>
-- action.
module Amazonka.IoT.DeleteSecurityProfile
  ( -- * Creating a Request
    DeleteSecurityProfile (..),
    newDeleteSecurityProfile,

    -- * Request Lenses
    deleteSecurityProfile_expectedVersion,
    deleteSecurityProfile_securityProfileName,

    -- * Destructuring the Response
    DeleteSecurityProfileResponse (..),
    newDeleteSecurityProfileResponse,

    -- * Response Lenses
    deleteSecurityProfileResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteSecurityProfile' smart constructor.
data DeleteSecurityProfile = DeleteSecurityProfile'
  { -- | The expected version of the security profile. A new version is generated
    -- whenever the security profile is updated. If you specify a value that is
    -- different from the actual version, a @VersionConflictException@ is
    -- thrown.
    DeleteSecurityProfile -> Maybe Integer
expectedVersion :: Prelude.Maybe Prelude.Integer,
    -- | The name of the security profile to be deleted.
    DeleteSecurityProfile -> Text
securityProfileName :: Prelude.Text
  }
  deriving (DeleteSecurityProfile -> DeleteSecurityProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSecurityProfile -> DeleteSecurityProfile -> Bool
$c/= :: DeleteSecurityProfile -> DeleteSecurityProfile -> Bool
== :: DeleteSecurityProfile -> DeleteSecurityProfile -> Bool
$c== :: DeleteSecurityProfile -> DeleteSecurityProfile -> Bool
Prelude.Eq, ReadPrec [DeleteSecurityProfile]
ReadPrec DeleteSecurityProfile
Int -> ReadS DeleteSecurityProfile
ReadS [DeleteSecurityProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSecurityProfile]
$creadListPrec :: ReadPrec [DeleteSecurityProfile]
readPrec :: ReadPrec DeleteSecurityProfile
$creadPrec :: ReadPrec DeleteSecurityProfile
readList :: ReadS [DeleteSecurityProfile]
$creadList :: ReadS [DeleteSecurityProfile]
readsPrec :: Int -> ReadS DeleteSecurityProfile
$creadsPrec :: Int -> ReadS DeleteSecurityProfile
Prelude.Read, Int -> DeleteSecurityProfile -> ShowS
[DeleteSecurityProfile] -> ShowS
DeleteSecurityProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSecurityProfile] -> ShowS
$cshowList :: [DeleteSecurityProfile] -> ShowS
show :: DeleteSecurityProfile -> String
$cshow :: DeleteSecurityProfile -> String
showsPrec :: Int -> DeleteSecurityProfile -> ShowS
$cshowsPrec :: Int -> DeleteSecurityProfile -> ShowS
Prelude.Show, forall x. Rep DeleteSecurityProfile x -> DeleteSecurityProfile
forall x. DeleteSecurityProfile -> Rep DeleteSecurityProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSecurityProfile x -> DeleteSecurityProfile
$cfrom :: forall x. DeleteSecurityProfile -> Rep DeleteSecurityProfile x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSecurityProfile' 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:
--
-- 'expectedVersion', 'deleteSecurityProfile_expectedVersion' - The expected version of the security profile. A new version is generated
-- whenever the security profile is updated. If you specify a value that is
-- different from the actual version, a @VersionConflictException@ is
-- thrown.
--
-- 'securityProfileName', 'deleteSecurityProfile_securityProfileName' - The name of the security profile to be deleted.
newDeleteSecurityProfile ::
  -- | 'securityProfileName'
  Prelude.Text ->
  DeleteSecurityProfile
newDeleteSecurityProfile :: Text -> DeleteSecurityProfile
newDeleteSecurityProfile Text
pSecurityProfileName_ =
  DeleteSecurityProfile'
    { $sel:expectedVersion:DeleteSecurityProfile' :: Maybe Integer
expectedVersion =
        forall a. Maybe a
Prelude.Nothing,
      $sel:securityProfileName:DeleteSecurityProfile' :: Text
securityProfileName = Text
pSecurityProfileName_
    }

-- | The expected version of the security profile. A new version is generated
-- whenever the security profile is updated. If you specify a value that is
-- different from the actual version, a @VersionConflictException@ is
-- thrown.
deleteSecurityProfile_expectedVersion :: Lens.Lens' DeleteSecurityProfile (Prelude.Maybe Prelude.Integer)
deleteSecurityProfile_expectedVersion :: Lens' DeleteSecurityProfile (Maybe Integer)
deleteSecurityProfile_expectedVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecurityProfile' {Maybe Integer
expectedVersion :: Maybe Integer
$sel:expectedVersion:DeleteSecurityProfile' :: DeleteSecurityProfile -> Maybe Integer
expectedVersion} -> Maybe Integer
expectedVersion) (\s :: DeleteSecurityProfile
s@DeleteSecurityProfile' {} Maybe Integer
a -> DeleteSecurityProfile
s {$sel:expectedVersion:DeleteSecurityProfile' :: Maybe Integer
expectedVersion = Maybe Integer
a} :: DeleteSecurityProfile)

-- | The name of the security profile to be deleted.
deleteSecurityProfile_securityProfileName :: Lens.Lens' DeleteSecurityProfile Prelude.Text
deleteSecurityProfile_securityProfileName :: Lens' DeleteSecurityProfile Text
deleteSecurityProfile_securityProfileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSecurityProfile' {Text
securityProfileName :: Text
$sel:securityProfileName:DeleteSecurityProfile' :: DeleteSecurityProfile -> Text
securityProfileName} -> Text
securityProfileName) (\s :: DeleteSecurityProfile
s@DeleteSecurityProfile' {} Text
a -> DeleteSecurityProfile
s {$sel:securityProfileName:DeleteSecurityProfile' :: Text
securityProfileName = Text
a} :: DeleteSecurityProfile)

instance Core.AWSRequest DeleteSecurityProfile where
  type
    AWSResponse DeleteSecurityProfile =
      DeleteSecurityProfileResponse
  request :: (Service -> Service)
-> DeleteSecurityProfile -> Request DeleteSecurityProfile
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteSecurityProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSecurityProfile)))
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 -> DeleteSecurityProfileResponse
DeleteSecurityProfileResponse'
            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 DeleteSecurityProfile where
  hashWithSalt :: Int -> DeleteSecurityProfile -> Int
hashWithSalt Int
_salt DeleteSecurityProfile' {Maybe Integer
Text
securityProfileName :: Text
expectedVersion :: Maybe Integer
$sel:securityProfileName:DeleteSecurityProfile' :: DeleteSecurityProfile -> Text
$sel:expectedVersion:DeleteSecurityProfile' :: DeleteSecurityProfile -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
expectedVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
securityProfileName

instance Prelude.NFData DeleteSecurityProfile where
  rnf :: DeleteSecurityProfile -> ()
rnf DeleteSecurityProfile' {Maybe Integer
Text
securityProfileName :: Text
expectedVersion :: Maybe Integer
$sel:securityProfileName:DeleteSecurityProfile' :: DeleteSecurityProfile -> Text
$sel:expectedVersion:DeleteSecurityProfile' :: DeleteSecurityProfile -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
expectedVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
securityProfileName

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

instance Data.ToPath DeleteSecurityProfile where
  toPath :: DeleteSecurityProfile -> ByteString
toPath DeleteSecurityProfile' {Maybe Integer
Text
securityProfileName :: Text
expectedVersion :: Maybe Integer
$sel:securityProfileName:DeleteSecurityProfile' :: DeleteSecurityProfile -> Text
$sel:expectedVersion:DeleteSecurityProfile' :: DeleteSecurityProfile -> Maybe Integer
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/security-profiles/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
securityProfileName
      ]

instance Data.ToQuery DeleteSecurityProfile where
  toQuery :: DeleteSecurityProfile -> QueryString
toQuery DeleteSecurityProfile' {Maybe Integer
Text
securityProfileName :: Text
expectedVersion :: Maybe Integer
$sel:securityProfileName:DeleteSecurityProfile' :: DeleteSecurityProfile -> Text
$sel:expectedVersion:DeleteSecurityProfile' :: DeleteSecurityProfile -> Maybe Integer
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"expectedVersion" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Integer
expectedVersion]

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

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

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

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