{-# 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.DeleteAccountAuditConfiguration
-- 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)
--
-- Restores the default settings for Device Defender audits for this
-- account. Any configuration data you entered is deleted and all audit
-- checks are reset to disabled.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions DeleteAccountAuditConfiguration>
-- action.
module Amazonka.IoT.DeleteAccountAuditConfiguration
  ( -- * Creating a Request
    DeleteAccountAuditConfiguration (..),
    newDeleteAccountAuditConfiguration,

    -- * Request Lenses
    deleteAccountAuditConfiguration_deleteScheduledAudits,

    -- * Destructuring the Response
    DeleteAccountAuditConfigurationResponse (..),
    newDeleteAccountAuditConfigurationResponse,

    -- * Response Lenses
    deleteAccountAuditConfigurationResponse_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:/ 'newDeleteAccountAuditConfiguration' smart constructor.
data DeleteAccountAuditConfiguration = DeleteAccountAuditConfiguration'
  { -- | If true, all scheduled audits are deleted.
    DeleteAccountAuditConfiguration -> Maybe Bool
deleteScheduledAudits :: Prelude.Maybe Prelude.Bool
  }
  deriving (DeleteAccountAuditConfiguration
-> DeleteAccountAuditConfiguration -> Bool
(DeleteAccountAuditConfiguration
 -> DeleteAccountAuditConfiguration -> Bool)
-> (DeleteAccountAuditConfiguration
    -> DeleteAccountAuditConfiguration -> Bool)
-> Eq DeleteAccountAuditConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteAccountAuditConfiguration
-> DeleteAccountAuditConfiguration -> Bool
$c/= :: DeleteAccountAuditConfiguration
-> DeleteAccountAuditConfiguration -> Bool
== :: DeleteAccountAuditConfiguration
-> DeleteAccountAuditConfiguration -> Bool
$c== :: DeleteAccountAuditConfiguration
-> DeleteAccountAuditConfiguration -> Bool
Prelude.Eq, ReadPrec [DeleteAccountAuditConfiguration]
ReadPrec DeleteAccountAuditConfiguration
Int -> ReadS DeleteAccountAuditConfiguration
ReadS [DeleteAccountAuditConfiguration]
(Int -> ReadS DeleteAccountAuditConfiguration)
-> ReadS [DeleteAccountAuditConfiguration]
-> ReadPrec DeleteAccountAuditConfiguration
-> ReadPrec [DeleteAccountAuditConfiguration]
-> Read DeleteAccountAuditConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteAccountAuditConfiguration]
$creadListPrec :: ReadPrec [DeleteAccountAuditConfiguration]
readPrec :: ReadPrec DeleteAccountAuditConfiguration
$creadPrec :: ReadPrec DeleteAccountAuditConfiguration
readList :: ReadS [DeleteAccountAuditConfiguration]
$creadList :: ReadS [DeleteAccountAuditConfiguration]
readsPrec :: Int -> ReadS DeleteAccountAuditConfiguration
$creadsPrec :: Int -> ReadS DeleteAccountAuditConfiguration
Prelude.Read, Int -> DeleteAccountAuditConfiguration -> ShowS
[DeleteAccountAuditConfiguration] -> ShowS
DeleteAccountAuditConfiguration -> String
(Int -> DeleteAccountAuditConfiguration -> ShowS)
-> (DeleteAccountAuditConfiguration -> String)
-> ([DeleteAccountAuditConfiguration] -> ShowS)
-> Show DeleteAccountAuditConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteAccountAuditConfiguration] -> ShowS
$cshowList :: [DeleteAccountAuditConfiguration] -> ShowS
show :: DeleteAccountAuditConfiguration -> String
$cshow :: DeleteAccountAuditConfiguration -> String
showsPrec :: Int -> DeleteAccountAuditConfiguration -> ShowS
$cshowsPrec :: Int -> DeleteAccountAuditConfiguration -> ShowS
Prelude.Show, (forall x.
 DeleteAccountAuditConfiguration
 -> Rep DeleteAccountAuditConfiguration x)
-> (forall x.
    Rep DeleteAccountAuditConfiguration x
    -> DeleteAccountAuditConfiguration)
-> Generic DeleteAccountAuditConfiguration
forall x.
Rep DeleteAccountAuditConfiguration x
-> DeleteAccountAuditConfiguration
forall x.
DeleteAccountAuditConfiguration
-> Rep DeleteAccountAuditConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteAccountAuditConfiguration x
-> DeleteAccountAuditConfiguration
$cfrom :: forall x.
DeleteAccountAuditConfiguration
-> Rep DeleteAccountAuditConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteAccountAuditConfiguration' 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:
--
-- 'deleteScheduledAudits', 'deleteAccountAuditConfiguration_deleteScheduledAudits' - If true, all scheduled audits are deleted.
newDeleteAccountAuditConfiguration ::
  DeleteAccountAuditConfiguration
newDeleteAccountAuditConfiguration :: DeleteAccountAuditConfiguration
newDeleteAccountAuditConfiguration =
  DeleteAccountAuditConfiguration' :: Maybe Bool -> DeleteAccountAuditConfiguration
DeleteAccountAuditConfiguration'
    { $sel:deleteScheduledAudits:DeleteAccountAuditConfiguration' :: Maybe Bool
deleteScheduledAudits =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | If true, all scheduled audits are deleted.
deleteAccountAuditConfiguration_deleteScheduledAudits :: Lens.Lens' DeleteAccountAuditConfiguration (Prelude.Maybe Prelude.Bool)
deleteAccountAuditConfiguration_deleteScheduledAudits :: (Maybe Bool -> f (Maybe Bool))
-> DeleteAccountAuditConfiguration
-> f DeleteAccountAuditConfiguration
deleteAccountAuditConfiguration_deleteScheduledAudits = (DeleteAccountAuditConfiguration -> Maybe Bool)
-> (DeleteAccountAuditConfiguration
    -> Maybe Bool -> DeleteAccountAuditConfiguration)
-> Lens
     DeleteAccountAuditConfiguration
     DeleteAccountAuditConfiguration
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteAccountAuditConfiguration' {Maybe Bool
deleteScheduledAudits :: Maybe Bool
$sel:deleteScheduledAudits:DeleteAccountAuditConfiguration' :: DeleteAccountAuditConfiguration -> Maybe Bool
deleteScheduledAudits} -> Maybe Bool
deleteScheduledAudits) (\s :: DeleteAccountAuditConfiguration
s@DeleteAccountAuditConfiguration' {} Maybe Bool
a -> DeleteAccountAuditConfiguration
s {$sel:deleteScheduledAudits:DeleteAccountAuditConfiguration' :: Maybe Bool
deleteScheduledAudits = Maybe Bool
a} :: DeleteAccountAuditConfiguration)

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

instance
  Prelude.NFData
    DeleteAccountAuditConfiguration

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

instance Core.ToPath DeleteAccountAuditConfiguration where
  toPath :: DeleteAccountAuditConfiguration -> ByteString
toPath = ByteString -> DeleteAccountAuditConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/audit/configuration"

instance Core.ToQuery DeleteAccountAuditConfiguration where
  toQuery :: DeleteAccountAuditConfiguration -> QueryString
toQuery DeleteAccountAuditConfiguration' {Maybe Bool
deleteScheduledAudits :: Maybe Bool
$sel:deleteScheduledAudits:DeleteAccountAuditConfiguration' :: DeleteAccountAuditConfiguration -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"deleteScheduledAudits"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
deleteScheduledAudits
      ]

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

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

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

instance
  Prelude.NFData
    DeleteAccountAuditConfigurationResponse