{-# 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.SecurityHub.DisableSecurityHub
-- 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)
--
-- Disables Security Hub in your account only in the current Region. To
-- disable Security Hub in all Regions, you must submit one request per
-- Region where you have enabled Security Hub.
--
-- When you disable Security Hub for an administrator account, it doesn\'t
-- disable Security Hub for any associated member accounts.
--
-- When you disable Security Hub, your existing findings and insights and
-- any Security Hub configuration settings are deleted after 90 days and
-- cannot be recovered. Any standards that were enabled are disabled, and
-- your administrator and member account associations are removed.
--
-- If you want to save your existing findings, you must export them before
-- you disable Security Hub.
module Amazonka.SecurityHub.DisableSecurityHub
  ( -- * Creating a Request
    DisableSecurityHub (..),
    newDisableSecurityHub,

    -- * Destructuring the Response
    DisableSecurityHubResponse (..),
    newDisableSecurityHubResponse,

    -- * Response Lenses
    disableSecurityHubResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecurityHub.Types

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

-- |
-- Create a value of 'DisableSecurityHub' 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.
newDisableSecurityHub ::
  DisableSecurityHub
newDisableSecurityHub :: DisableSecurityHub
newDisableSecurityHub = DisableSecurityHub
DisableSecurityHub'

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

instance Prelude.NFData DisableSecurityHub

instance Core.ToHeaders DisableSecurityHub where
  toHeaders :: DisableSecurityHub -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisableSecurityHub -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DisableSecurityHub where
  toPath :: DisableSecurityHub -> ByteString
toPath = ByteString -> DisableSecurityHub -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/accounts"

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

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

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

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

instance Prelude.NFData DisableSecurityHubResponse