{-# 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.DisableImportFindingsForProduct
-- 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 the integration of the specified product with Security Hub.
-- After the integration is disabled, findings from that product are no
-- longer sent to Security Hub.
module Amazonka.SecurityHub.DisableImportFindingsForProduct
  ( -- * Creating a Request
    DisableImportFindingsForProduct (..),
    newDisableImportFindingsForProduct,

    -- * Request Lenses
    disableImportFindingsForProduct_productSubscriptionArn,

    -- * Destructuring the Response
    DisableImportFindingsForProductResponse (..),
    newDisableImportFindingsForProductResponse,

    -- * Response Lenses
    disableImportFindingsForProductResponse_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:/ 'newDisableImportFindingsForProduct' smart constructor.
data DisableImportFindingsForProduct = DisableImportFindingsForProduct'
  { -- | The ARN of the integrated product to disable the integration for.
    DisableImportFindingsForProduct -> Text
productSubscriptionArn :: Prelude.Text
  }
  deriving (DisableImportFindingsForProduct
-> DisableImportFindingsForProduct -> Bool
(DisableImportFindingsForProduct
 -> DisableImportFindingsForProduct -> Bool)
-> (DisableImportFindingsForProduct
    -> DisableImportFindingsForProduct -> Bool)
-> Eq DisableImportFindingsForProduct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableImportFindingsForProduct
-> DisableImportFindingsForProduct -> Bool
$c/= :: DisableImportFindingsForProduct
-> DisableImportFindingsForProduct -> Bool
== :: DisableImportFindingsForProduct
-> DisableImportFindingsForProduct -> Bool
$c== :: DisableImportFindingsForProduct
-> DisableImportFindingsForProduct -> Bool
Prelude.Eq, ReadPrec [DisableImportFindingsForProduct]
ReadPrec DisableImportFindingsForProduct
Int -> ReadS DisableImportFindingsForProduct
ReadS [DisableImportFindingsForProduct]
(Int -> ReadS DisableImportFindingsForProduct)
-> ReadS [DisableImportFindingsForProduct]
-> ReadPrec DisableImportFindingsForProduct
-> ReadPrec [DisableImportFindingsForProduct]
-> Read DisableImportFindingsForProduct
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableImportFindingsForProduct]
$creadListPrec :: ReadPrec [DisableImportFindingsForProduct]
readPrec :: ReadPrec DisableImportFindingsForProduct
$creadPrec :: ReadPrec DisableImportFindingsForProduct
readList :: ReadS [DisableImportFindingsForProduct]
$creadList :: ReadS [DisableImportFindingsForProduct]
readsPrec :: Int -> ReadS DisableImportFindingsForProduct
$creadsPrec :: Int -> ReadS DisableImportFindingsForProduct
Prelude.Read, Int -> DisableImportFindingsForProduct -> ShowS
[DisableImportFindingsForProduct] -> ShowS
DisableImportFindingsForProduct -> String
(Int -> DisableImportFindingsForProduct -> ShowS)
-> (DisableImportFindingsForProduct -> String)
-> ([DisableImportFindingsForProduct] -> ShowS)
-> Show DisableImportFindingsForProduct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableImportFindingsForProduct] -> ShowS
$cshowList :: [DisableImportFindingsForProduct] -> ShowS
show :: DisableImportFindingsForProduct -> String
$cshow :: DisableImportFindingsForProduct -> String
showsPrec :: Int -> DisableImportFindingsForProduct -> ShowS
$cshowsPrec :: Int -> DisableImportFindingsForProduct -> ShowS
Prelude.Show, (forall x.
 DisableImportFindingsForProduct
 -> Rep DisableImportFindingsForProduct x)
-> (forall x.
    Rep DisableImportFindingsForProduct x
    -> DisableImportFindingsForProduct)
-> Generic DisableImportFindingsForProduct
forall x.
Rep DisableImportFindingsForProduct x
-> DisableImportFindingsForProduct
forall x.
DisableImportFindingsForProduct
-> Rep DisableImportFindingsForProduct x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisableImportFindingsForProduct x
-> DisableImportFindingsForProduct
$cfrom :: forall x.
DisableImportFindingsForProduct
-> Rep DisableImportFindingsForProduct x
Prelude.Generic)

-- |
-- Create a value of 'DisableImportFindingsForProduct' 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:
--
-- 'productSubscriptionArn', 'disableImportFindingsForProduct_productSubscriptionArn' - The ARN of the integrated product to disable the integration for.
newDisableImportFindingsForProduct ::
  -- | 'productSubscriptionArn'
  Prelude.Text ->
  DisableImportFindingsForProduct
newDisableImportFindingsForProduct :: Text -> DisableImportFindingsForProduct
newDisableImportFindingsForProduct
  Text
pProductSubscriptionArn_ =
    DisableImportFindingsForProduct' :: Text -> DisableImportFindingsForProduct
DisableImportFindingsForProduct'
      { $sel:productSubscriptionArn:DisableImportFindingsForProduct' :: Text
productSubscriptionArn =
          Text
pProductSubscriptionArn_
      }

-- | The ARN of the integrated product to disable the integration for.
disableImportFindingsForProduct_productSubscriptionArn :: Lens.Lens' DisableImportFindingsForProduct Prelude.Text
disableImportFindingsForProduct_productSubscriptionArn :: (Text -> f Text)
-> DisableImportFindingsForProduct
-> f DisableImportFindingsForProduct
disableImportFindingsForProduct_productSubscriptionArn = (DisableImportFindingsForProduct -> Text)
-> (DisableImportFindingsForProduct
    -> Text -> DisableImportFindingsForProduct)
-> Lens
     DisableImportFindingsForProduct
     DisableImportFindingsForProduct
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableImportFindingsForProduct' {Text
productSubscriptionArn :: Text
$sel:productSubscriptionArn:DisableImportFindingsForProduct' :: DisableImportFindingsForProduct -> Text
productSubscriptionArn} -> Text
productSubscriptionArn) (\s :: DisableImportFindingsForProduct
s@DisableImportFindingsForProduct' {} Text
a -> DisableImportFindingsForProduct
s {$sel:productSubscriptionArn:DisableImportFindingsForProduct' :: Text
productSubscriptionArn = Text
a} :: DisableImportFindingsForProduct)

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

instance
  Prelude.NFData
    DisableImportFindingsForProduct

instance
  Core.ToHeaders
    DisableImportFindingsForProduct
  where
  toHeaders :: DisableImportFindingsForProduct -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DisableImportFindingsForProduct -> 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 DisableImportFindingsForProduct where
  toPath :: DisableImportFindingsForProduct -> ByteString
toPath DisableImportFindingsForProduct' {Text
productSubscriptionArn :: Text
$sel:productSubscriptionArn:DisableImportFindingsForProduct' :: DisableImportFindingsForProduct -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/productSubscriptions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
productSubscriptionArn
      ]

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

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

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

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

instance
  Prelude.NFData
    DisableImportFindingsForProductResponse