{-# 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.MacieV2.GetFindingsPublicationConfiguration
-- 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)
--
-- Retrieves the configuration settings for publishing findings to Security
-- Hub.
module Amazonka.MacieV2.GetFindingsPublicationConfiguration
  ( -- * Creating a Request
    GetFindingsPublicationConfiguration (..),
    newGetFindingsPublicationConfiguration,

    -- * Destructuring the Response
    GetFindingsPublicationConfigurationResponse (..),
    newGetFindingsPublicationConfigurationResponse,

    -- * Response Lenses
    getFindingsPublicationConfigurationResponse_securityHubConfiguration,
    getFindingsPublicationConfigurationResponse_httpStatus,
  )
where

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

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

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

instance
  Core.AWSRequest
    GetFindingsPublicationConfiguration
  where
  type
    AWSResponse GetFindingsPublicationConfiguration =
      GetFindingsPublicationConfigurationResponse
  request :: GetFindingsPublicationConfiguration
-> Request GetFindingsPublicationConfiguration
request = Service
-> GetFindingsPublicationConfiguration
-> Request GetFindingsPublicationConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetFindingsPublicationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetFindingsPublicationConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetFindingsPublicationConfiguration))
-> Logger
-> Service
-> Proxy GetFindingsPublicationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetFindingsPublicationConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe SecurityHubConfiguration
-> Int -> GetFindingsPublicationConfigurationResponse
GetFindingsPublicationConfigurationResponse'
            (Maybe SecurityHubConfiguration
 -> Int -> GetFindingsPublicationConfigurationResponse)
-> Either String (Maybe SecurityHubConfiguration)
-> Either
     String (Int -> GetFindingsPublicationConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe SecurityHubConfiguration)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"securityHubConfiguration")
              Either String (Int -> GetFindingsPublicationConfigurationResponse)
-> Either String Int
-> Either String GetFindingsPublicationConfigurationResponse
forall (f :: * -> *) a b. Applicative f => 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
    GetFindingsPublicationConfiguration

instance
  Prelude.NFData
    GetFindingsPublicationConfiguration

instance
  Core.ToHeaders
    GetFindingsPublicationConfiguration
  where
  toHeaders :: GetFindingsPublicationConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetFindingsPublicationConfiguration -> 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
    GetFindingsPublicationConfiguration
  where
  toPath :: GetFindingsPublicationConfiguration -> ByteString
toPath =
    ByteString -> GetFindingsPublicationConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/findings-publication-configuration"

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

-- | /See:/ 'newGetFindingsPublicationConfigurationResponse' smart constructor.
data GetFindingsPublicationConfigurationResponse = GetFindingsPublicationConfigurationResponse'
  { -- | The configuration settings that determine which findings are published
    -- to Security Hub.
    GetFindingsPublicationConfigurationResponse
-> Maybe SecurityHubConfiguration
securityHubConfiguration :: Prelude.Maybe SecurityHubConfiguration,
    -- | The response's http status code.
    GetFindingsPublicationConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetFindingsPublicationConfigurationResponse
-> GetFindingsPublicationConfigurationResponse -> Bool
(GetFindingsPublicationConfigurationResponse
 -> GetFindingsPublicationConfigurationResponse -> Bool)
-> (GetFindingsPublicationConfigurationResponse
    -> GetFindingsPublicationConfigurationResponse -> Bool)
-> Eq GetFindingsPublicationConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFindingsPublicationConfigurationResponse
-> GetFindingsPublicationConfigurationResponse -> Bool
$c/= :: GetFindingsPublicationConfigurationResponse
-> GetFindingsPublicationConfigurationResponse -> Bool
== :: GetFindingsPublicationConfigurationResponse
-> GetFindingsPublicationConfigurationResponse -> Bool
$c== :: GetFindingsPublicationConfigurationResponse
-> GetFindingsPublicationConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [GetFindingsPublicationConfigurationResponse]
ReadPrec GetFindingsPublicationConfigurationResponse
Int -> ReadS GetFindingsPublicationConfigurationResponse
ReadS [GetFindingsPublicationConfigurationResponse]
(Int -> ReadS GetFindingsPublicationConfigurationResponse)
-> ReadS [GetFindingsPublicationConfigurationResponse]
-> ReadPrec GetFindingsPublicationConfigurationResponse
-> ReadPrec [GetFindingsPublicationConfigurationResponse]
-> Read GetFindingsPublicationConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFindingsPublicationConfigurationResponse]
$creadListPrec :: ReadPrec [GetFindingsPublicationConfigurationResponse]
readPrec :: ReadPrec GetFindingsPublicationConfigurationResponse
$creadPrec :: ReadPrec GetFindingsPublicationConfigurationResponse
readList :: ReadS [GetFindingsPublicationConfigurationResponse]
$creadList :: ReadS [GetFindingsPublicationConfigurationResponse]
readsPrec :: Int -> ReadS GetFindingsPublicationConfigurationResponse
$creadsPrec :: Int -> ReadS GetFindingsPublicationConfigurationResponse
Prelude.Read, Int -> GetFindingsPublicationConfigurationResponse -> ShowS
[GetFindingsPublicationConfigurationResponse] -> ShowS
GetFindingsPublicationConfigurationResponse -> String
(Int -> GetFindingsPublicationConfigurationResponse -> ShowS)
-> (GetFindingsPublicationConfigurationResponse -> String)
-> ([GetFindingsPublicationConfigurationResponse] -> ShowS)
-> Show GetFindingsPublicationConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFindingsPublicationConfigurationResponse] -> ShowS
$cshowList :: [GetFindingsPublicationConfigurationResponse] -> ShowS
show :: GetFindingsPublicationConfigurationResponse -> String
$cshow :: GetFindingsPublicationConfigurationResponse -> String
showsPrec :: Int -> GetFindingsPublicationConfigurationResponse -> ShowS
$cshowsPrec :: Int -> GetFindingsPublicationConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 GetFindingsPublicationConfigurationResponse
 -> Rep GetFindingsPublicationConfigurationResponse x)
-> (forall x.
    Rep GetFindingsPublicationConfigurationResponse x
    -> GetFindingsPublicationConfigurationResponse)
-> Generic GetFindingsPublicationConfigurationResponse
forall x.
Rep GetFindingsPublicationConfigurationResponse x
-> GetFindingsPublicationConfigurationResponse
forall x.
GetFindingsPublicationConfigurationResponse
-> Rep GetFindingsPublicationConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetFindingsPublicationConfigurationResponse x
-> GetFindingsPublicationConfigurationResponse
$cfrom :: forall x.
GetFindingsPublicationConfigurationResponse
-> Rep GetFindingsPublicationConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetFindingsPublicationConfigurationResponse' 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:
--
-- 'securityHubConfiguration', 'getFindingsPublicationConfigurationResponse_securityHubConfiguration' - The configuration settings that determine which findings are published
-- to Security Hub.
--
-- 'httpStatus', 'getFindingsPublicationConfigurationResponse_httpStatus' - The response's http status code.
newGetFindingsPublicationConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetFindingsPublicationConfigurationResponse
newGetFindingsPublicationConfigurationResponse :: Int -> GetFindingsPublicationConfigurationResponse
newGetFindingsPublicationConfigurationResponse
  Int
pHttpStatus_ =
    GetFindingsPublicationConfigurationResponse' :: Maybe SecurityHubConfiguration
-> Int -> GetFindingsPublicationConfigurationResponse
GetFindingsPublicationConfigurationResponse'
      { $sel:securityHubConfiguration:GetFindingsPublicationConfigurationResponse' :: Maybe SecurityHubConfiguration
securityHubConfiguration =
          Maybe SecurityHubConfiguration
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetFindingsPublicationConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The configuration settings that determine which findings are published
-- to Security Hub.
getFindingsPublicationConfigurationResponse_securityHubConfiguration :: Lens.Lens' GetFindingsPublicationConfigurationResponse (Prelude.Maybe SecurityHubConfiguration)
getFindingsPublicationConfigurationResponse_securityHubConfiguration :: (Maybe SecurityHubConfiguration
 -> f (Maybe SecurityHubConfiguration))
-> GetFindingsPublicationConfigurationResponse
-> f GetFindingsPublicationConfigurationResponse
getFindingsPublicationConfigurationResponse_securityHubConfiguration = (GetFindingsPublicationConfigurationResponse
 -> Maybe SecurityHubConfiguration)
-> (GetFindingsPublicationConfigurationResponse
    -> Maybe SecurityHubConfiguration
    -> GetFindingsPublicationConfigurationResponse)
-> Lens
     GetFindingsPublicationConfigurationResponse
     GetFindingsPublicationConfigurationResponse
     (Maybe SecurityHubConfiguration)
     (Maybe SecurityHubConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFindingsPublicationConfigurationResponse' {Maybe SecurityHubConfiguration
securityHubConfiguration :: Maybe SecurityHubConfiguration
$sel:securityHubConfiguration:GetFindingsPublicationConfigurationResponse' :: GetFindingsPublicationConfigurationResponse
-> Maybe SecurityHubConfiguration
securityHubConfiguration} -> Maybe SecurityHubConfiguration
securityHubConfiguration) (\s :: GetFindingsPublicationConfigurationResponse
s@GetFindingsPublicationConfigurationResponse' {} Maybe SecurityHubConfiguration
a -> GetFindingsPublicationConfigurationResponse
s {$sel:securityHubConfiguration:GetFindingsPublicationConfigurationResponse' :: Maybe SecurityHubConfiguration
securityHubConfiguration = Maybe SecurityHubConfiguration
a} :: GetFindingsPublicationConfigurationResponse)

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

instance
  Prelude.NFData
    GetFindingsPublicationConfigurationResponse