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

    -- * Request Lenses
    deleteScheduledAudit_scheduledAuditName,

    -- * Destructuring the Response
    DeleteScheduledAuditResponse (..),
    newDeleteScheduledAuditResponse,

    -- * Response Lenses
    deleteScheduledAuditResponse_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:/ 'newDeleteScheduledAudit' smart constructor.
data DeleteScheduledAudit = DeleteScheduledAudit'
  { -- | The name of the scheduled audit you want to delete.
    DeleteScheduledAudit -> Text
scheduledAuditName :: Prelude.Text
  }
  deriving (DeleteScheduledAudit -> DeleteScheduledAudit -> Bool
(DeleteScheduledAudit -> DeleteScheduledAudit -> Bool)
-> (DeleteScheduledAudit -> DeleteScheduledAudit -> Bool)
-> Eq DeleteScheduledAudit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteScheduledAudit -> DeleteScheduledAudit -> Bool
$c/= :: DeleteScheduledAudit -> DeleteScheduledAudit -> Bool
== :: DeleteScheduledAudit -> DeleteScheduledAudit -> Bool
$c== :: DeleteScheduledAudit -> DeleteScheduledAudit -> Bool
Prelude.Eq, ReadPrec [DeleteScheduledAudit]
ReadPrec DeleteScheduledAudit
Int -> ReadS DeleteScheduledAudit
ReadS [DeleteScheduledAudit]
(Int -> ReadS DeleteScheduledAudit)
-> ReadS [DeleteScheduledAudit]
-> ReadPrec DeleteScheduledAudit
-> ReadPrec [DeleteScheduledAudit]
-> Read DeleteScheduledAudit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteScheduledAudit]
$creadListPrec :: ReadPrec [DeleteScheduledAudit]
readPrec :: ReadPrec DeleteScheduledAudit
$creadPrec :: ReadPrec DeleteScheduledAudit
readList :: ReadS [DeleteScheduledAudit]
$creadList :: ReadS [DeleteScheduledAudit]
readsPrec :: Int -> ReadS DeleteScheduledAudit
$creadsPrec :: Int -> ReadS DeleteScheduledAudit
Prelude.Read, Int -> DeleteScheduledAudit -> ShowS
[DeleteScheduledAudit] -> ShowS
DeleteScheduledAudit -> String
(Int -> DeleteScheduledAudit -> ShowS)
-> (DeleteScheduledAudit -> String)
-> ([DeleteScheduledAudit] -> ShowS)
-> Show DeleteScheduledAudit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteScheduledAudit] -> ShowS
$cshowList :: [DeleteScheduledAudit] -> ShowS
show :: DeleteScheduledAudit -> String
$cshow :: DeleteScheduledAudit -> String
showsPrec :: Int -> DeleteScheduledAudit -> ShowS
$cshowsPrec :: Int -> DeleteScheduledAudit -> ShowS
Prelude.Show, (forall x. DeleteScheduledAudit -> Rep DeleteScheduledAudit x)
-> (forall x. Rep DeleteScheduledAudit x -> DeleteScheduledAudit)
-> Generic DeleteScheduledAudit
forall x. Rep DeleteScheduledAudit x -> DeleteScheduledAudit
forall x. DeleteScheduledAudit -> Rep DeleteScheduledAudit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteScheduledAudit x -> DeleteScheduledAudit
$cfrom :: forall x. DeleteScheduledAudit -> Rep DeleteScheduledAudit x
Prelude.Generic)

-- |
-- Create a value of 'DeleteScheduledAudit' 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:
--
-- 'scheduledAuditName', 'deleteScheduledAudit_scheduledAuditName' - The name of the scheduled audit you want to delete.
newDeleteScheduledAudit ::
  -- | 'scheduledAuditName'
  Prelude.Text ->
  DeleteScheduledAudit
newDeleteScheduledAudit :: Text -> DeleteScheduledAudit
newDeleteScheduledAudit Text
pScheduledAuditName_ =
  DeleteScheduledAudit' :: Text -> DeleteScheduledAudit
DeleteScheduledAudit'
    { $sel:scheduledAuditName:DeleteScheduledAudit' :: Text
scheduledAuditName =
        Text
pScheduledAuditName_
    }

-- | The name of the scheduled audit you want to delete.
deleteScheduledAudit_scheduledAuditName :: Lens.Lens' DeleteScheduledAudit Prelude.Text
deleteScheduledAudit_scheduledAuditName :: (Text -> f Text) -> DeleteScheduledAudit -> f DeleteScheduledAudit
deleteScheduledAudit_scheduledAuditName = (DeleteScheduledAudit -> Text)
-> (DeleteScheduledAudit -> Text -> DeleteScheduledAudit)
-> Lens DeleteScheduledAudit DeleteScheduledAudit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteScheduledAudit' {Text
scheduledAuditName :: Text
$sel:scheduledAuditName:DeleteScheduledAudit' :: DeleteScheduledAudit -> Text
scheduledAuditName} -> Text
scheduledAuditName) (\s :: DeleteScheduledAudit
s@DeleteScheduledAudit' {} Text
a -> DeleteScheduledAudit
s {$sel:scheduledAuditName:DeleteScheduledAudit' :: Text
scheduledAuditName = Text
a} :: DeleteScheduledAudit)

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

instance Prelude.NFData DeleteScheduledAudit

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

instance Core.ToPath DeleteScheduledAudit where
  toPath :: DeleteScheduledAudit -> ByteString
toPath DeleteScheduledAudit' {Text
scheduledAuditName :: Text
$sel:scheduledAuditName:DeleteScheduledAudit' :: DeleteScheduledAudit -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/audit/scheduledaudits/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
scheduledAuditName
      ]

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

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

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

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

instance Prelude.NFData DeleteScheduledAuditResponse