{-# 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.DescribeOrganizationConfiguration
-- 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 Amazon Macie configuration settings for an Amazon Web
-- Services organization.
module Amazonka.MacieV2.DescribeOrganizationConfiguration
  ( -- * Creating a Request
    DescribeOrganizationConfiguration (..),
    newDescribeOrganizationConfiguration,

    -- * Destructuring the Response
    DescribeOrganizationConfigurationResponse (..),
    newDescribeOrganizationConfigurationResponse,

    -- * Response Lenses
    describeOrganizationConfigurationResponse_maxAccountLimitReached,
    describeOrganizationConfigurationResponse_autoEnable,
    describeOrganizationConfigurationResponse_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:/ 'newDescribeOrganizationConfiguration' smart constructor.
data DescribeOrganizationConfiguration = DescribeOrganizationConfiguration'
  {
  }
  deriving (DescribeOrganizationConfiguration
-> DescribeOrganizationConfiguration -> Bool
(DescribeOrganizationConfiguration
 -> DescribeOrganizationConfiguration -> Bool)
-> (DescribeOrganizationConfiguration
    -> DescribeOrganizationConfiguration -> Bool)
-> Eq DescribeOrganizationConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeOrganizationConfiguration
-> DescribeOrganizationConfiguration -> Bool
$c/= :: DescribeOrganizationConfiguration
-> DescribeOrganizationConfiguration -> Bool
== :: DescribeOrganizationConfiguration
-> DescribeOrganizationConfiguration -> Bool
$c== :: DescribeOrganizationConfiguration
-> DescribeOrganizationConfiguration -> Bool
Prelude.Eq, ReadPrec [DescribeOrganizationConfiguration]
ReadPrec DescribeOrganizationConfiguration
Int -> ReadS DescribeOrganizationConfiguration
ReadS [DescribeOrganizationConfiguration]
(Int -> ReadS DescribeOrganizationConfiguration)
-> ReadS [DescribeOrganizationConfiguration]
-> ReadPrec DescribeOrganizationConfiguration
-> ReadPrec [DescribeOrganizationConfiguration]
-> Read DescribeOrganizationConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeOrganizationConfiguration]
$creadListPrec :: ReadPrec [DescribeOrganizationConfiguration]
readPrec :: ReadPrec DescribeOrganizationConfiguration
$creadPrec :: ReadPrec DescribeOrganizationConfiguration
readList :: ReadS [DescribeOrganizationConfiguration]
$creadList :: ReadS [DescribeOrganizationConfiguration]
readsPrec :: Int -> ReadS DescribeOrganizationConfiguration
$creadsPrec :: Int -> ReadS DescribeOrganizationConfiguration
Prelude.Read, Int -> DescribeOrganizationConfiguration -> ShowS
[DescribeOrganizationConfiguration] -> ShowS
DescribeOrganizationConfiguration -> String
(Int -> DescribeOrganizationConfiguration -> ShowS)
-> (DescribeOrganizationConfiguration -> String)
-> ([DescribeOrganizationConfiguration] -> ShowS)
-> Show DescribeOrganizationConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeOrganizationConfiguration] -> ShowS
$cshowList :: [DescribeOrganizationConfiguration] -> ShowS
show :: DescribeOrganizationConfiguration -> String
$cshow :: DescribeOrganizationConfiguration -> String
showsPrec :: Int -> DescribeOrganizationConfiguration -> ShowS
$cshowsPrec :: Int -> DescribeOrganizationConfiguration -> ShowS
Prelude.Show, (forall x.
 DescribeOrganizationConfiguration
 -> Rep DescribeOrganizationConfiguration x)
-> (forall x.
    Rep DescribeOrganizationConfiguration x
    -> DescribeOrganizationConfiguration)
-> Generic DescribeOrganizationConfiguration
forall x.
Rep DescribeOrganizationConfiguration x
-> DescribeOrganizationConfiguration
forall x.
DescribeOrganizationConfiguration
-> Rep DescribeOrganizationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeOrganizationConfiguration x
-> DescribeOrganizationConfiguration
$cfrom :: forall x.
DescribeOrganizationConfiguration
-> Rep DescribeOrganizationConfiguration x
Prelude.Generic)

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

instance
  Core.AWSRequest
    DescribeOrganizationConfiguration
  where
  type
    AWSResponse DescribeOrganizationConfiguration =
      DescribeOrganizationConfigurationResponse
  request :: DescribeOrganizationConfiguration
-> Request DescribeOrganizationConfiguration
request = Service
-> DescribeOrganizationConfiguration
-> Request DescribeOrganizationConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeOrganizationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeOrganizationConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeOrganizationConfiguration))
-> Logger
-> Service
-> Proxy DescribeOrganizationConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeOrganizationConfiguration)))
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 Bool
-> Maybe Bool -> Int -> DescribeOrganizationConfigurationResponse
DescribeOrganizationConfigurationResponse'
            (Maybe Bool
 -> Maybe Bool -> Int -> DescribeOrganizationConfigurationResponse)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Bool -> Int -> DescribeOrganizationConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"maxAccountLimitReached")
              Either
  String
  (Maybe Bool -> Int -> DescribeOrganizationConfigurationResponse)
-> Either String (Maybe Bool)
-> Either String (Int -> DescribeOrganizationConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Key -> Either String (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"autoEnable")
              Either String (Int -> DescribeOrganizationConfigurationResponse)
-> Either String Int
-> Either String DescribeOrganizationConfigurationResponse
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
    DescribeOrganizationConfiguration

instance
  Prelude.NFData
    DescribeOrganizationConfiguration

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

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

-- | /See:/ 'newDescribeOrganizationConfigurationResponse' smart constructor.
data DescribeOrganizationConfigurationResponse = DescribeOrganizationConfigurationResponse'
  { -- | Specifies whether the maximum number of Amazon Macie member accounts are
    -- part of the Amazon Web Services organization.
    DescribeOrganizationConfigurationResponse -> Maybe Bool
maxAccountLimitReached :: Prelude.Maybe Prelude.Bool,
    -- | Specifies whether Amazon Macie is enabled automatically for accounts
    -- that are added to the Amazon Web Services organization.
    DescribeOrganizationConfigurationResponse -> Maybe Bool
autoEnable :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    DescribeOrganizationConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeOrganizationConfigurationResponse
-> DescribeOrganizationConfigurationResponse -> Bool
(DescribeOrganizationConfigurationResponse
 -> DescribeOrganizationConfigurationResponse -> Bool)
-> (DescribeOrganizationConfigurationResponse
    -> DescribeOrganizationConfigurationResponse -> Bool)
-> Eq DescribeOrganizationConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeOrganizationConfigurationResponse
-> DescribeOrganizationConfigurationResponse -> Bool
$c/= :: DescribeOrganizationConfigurationResponse
-> DescribeOrganizationConfigurationResponse -> Bool
== :: DescribeOrganizationConfigurationResponse
-> DescribeOrganizationConfigurationResponse -> Bool
$c== :: DescribeOrganizationConfigurationResponse
-> DescribeOrganizationConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [DescribeOrganizationConfigurationResponse]
ReadPrec DescribeOrganizationConfigurationResponse
Int -> ReadS DescribeOrganizationConfigurationResponse
ReadS [DescribeOrganizationConfigurationResponse]
(Int -> ReadS DescribeOrganizationConfigurationResponse)
-> ReadS [DescribeOrganizationConfigurationResponse]
-> ReadPrec DescribeOrganizationConfigurationResponse
-> ReadPrec [DescribeOrganizationConfigurationResponse]
-> Read DescribeOrganizationConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeOrganizationConfigurationResponse]
$creadListPrec :: ReadPrec [DescribeOrganizationConfigurationResponse]
readPrec :: ReadPrec DescribeOrganizationConfigurationResponse
$creadPrec :: ReadPrec DescribeOrganizationConfigurationResponse
readList :: ReadS [DescribeOrganizationConfigurationResponse]
$creadList :: ReadS [DescribeOrganizationConfigurationResponse]
readsPrec :: Int -> ReadS DescribeOrganizationConfigurationResponse
$creadsPrec :: Int -> ReadS DescribeOrganizationConfigurationResponse
Prelude.Read, Int -> DescribeOrganizationConfigurationResponse -> ShowS
[DescribeOrganizationConfigurationResponse] -> ShowS
DescribeOrganizationConfigurationResponse -> String
(Int -> DescribeOrganizationConfigurationResponse -> ShowS)
-> (DescribeOrganizationConfigurationResponse -> String)
-> ([DescribeOrganizationConfigurationResponse] -> ShowS)
-> Show DescribeOrganizationConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeOrganizationConfigurationResponse] -> ShowS
$cshowList :: [DescribeOrganizationConfigurationResponse] -> ShowS
show :: DescribeOrganizationConfigurationResponse -> String
$cshow :: DescribeOrganizationConfigurationResponse -> String
showsPrec :: Int -> DescribeOrganizationConfigurationResponse -> ShowS
$cshowsPrec :: Int -> DescribeOrganizationConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 DescribeOrganizationConfigurationResponse
 -> Rep DescribeOrganizationConfigurationResponse x)
-> (forall x.
    Rep DescribeOrganizationConfigurationResponse x
    -> DescribeOrganizationConfigurationResponse)
-> Generic DescribeOrganizationConfigurationResponse
forall x.
Rep DescribeOrganizationConfigurationResponse x
-> DescribeOrganizationConfigurationResponse
forall x.
DescribeOrganizationConfigurationResponse
-> Rep DescribeOrganizationConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeOrganizationConfigurationResponse x
-> DescribeOrganizationConfigurationResponse
$cfrom :: forall x.
DescribeOrganizationConfigurationResponse
-> Rep DescribeOrganizationConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeOrganizationConfigurationResponse' 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:
--
-- 'maxAccountLimitReached', 'describeOrganizationConfigurationResponse_maxAccountLimitReached' - Specifies whether the maximum number of Amazon Macie member accounts are
-- part of the Amazon Web Services organization.
--
-- 'autoEnable', 'describeOrganizationConfigurationResponse_autoEnable' - Specifies whether Amazon Macie is enabled automatically for accounts
-- that are added to the Amazon Web Services organization.
--
-- 'httpStatus', 'describeOrganizationConfigurationResponse_httpStatus' - The response's http status code.
newDescribeOrganizationConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeOrganizationConfigurationResponse
newDescribeOrganizationConfigurationResponse :: Int -> DescribeOrganizationConfigurationResponse
newDescribeOrganizationConfigurationResponse
  Int
pHttpStatus_ =
    DescribeOrganizationConfigurationResponse' :: Maybe Bool
-> Maybe Bool -> Int -> DescribeOrganizationConfigurationResponse
DescribeOrganizationConfigurationResponse'
      { $sel:maxAccountLimitReached:DescribeOrganizationConfigurationResponse' :: Maybe Bool
maxAccountLimitReached =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:autoEnable:DescribeOrganizationConfigurationResponse' :: Maybe Bool
autoEnable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeOrganizationConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Specifies whether the maximum number of Amazon Macie member accounts are
-- part of the Amazon Web Services organization.
describeOrganizationConfigurationResponse_maxAccountLimitReached :: Lens.Lens' DescribeOrganizationConfigurationResponse (Prelude.Maybe Prelude.Bool)
describeOrganizationConfigurationResponse_maxAccountLimitReached :: (Maybe Bool -> f (Maybe Bool))
-> DescribeOrganizationConfigurationResponse
-> f DescribeOrganizationConfigurationResponse
describeOrganizationConfigurationResponse_maxAccountLimitReached = (DescribeOrganizationConfigurationResponse -> Maybe Bool)
-> (DescribeOrganizationConfigurationResponse
    -> Maybe Bool -> DescribeOrganizationConfigurationResponse)
-> Lens
     DescribeOrganizationConfigurationResponse
     DescribeOrganizationConfigurationResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationConfigurationResponse' {Maybe Bool
maxAccountLimitReached :: Maybe Bool
$sel:maxAccountLimitReached:DescribeOrganizationConfigurationResponse' :: DescribeOrganizationConfigurationResponse -> Maybe Bool
maxAccountLimitReached} -> Maybe Bool
maxAccountLimitReached) (\s :: DescribeOrganizationConfigurationResponse
s@DescribeOrganizationConfigurationResponse' {} Maybe Bool
a -> DescribeOrganizationConfigurationResponse
s {$sel:maxAccountLimitReached:DescribeOrganizationConfigurationResponse' :: Maybe Bool
maxAccountLimitReached = Maybe Bool
a} :: DescribeOrganizationConfigurationResponse)

-- | Specifies whether Amazon Macie is enabled automatically for accounts
-- that are added to the Amazon Web Services organization.
describeOrganizationConfigurationResponse_autoEnable :: Lens.Lens' DescribeOrganizationConfigurationResponse (Prelude.Maybe Prelude.Bool)
describeOrganizationConfigurationResponse_autoEnable :: (Maybe Bool -> f (Maybe Bool))
-> DescribeOrganizationConfigurationResponse
-> f DescribeOrganizationConfigurationResponse
describeOrganizationConfigurationResponse_autoEnable = (DescribeOrganizationConfigurationResponse -> Maybe Bool)
-> (DescribeOrganizationConfigurationResponse
    -> Maybe Bool -> DescribeOrganizationConfigurationResponse)
-> Lens
     DescribeOrganizationConfigurationResponse
     DescribeOrganizationConfigurationResponse
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeOrganizationConfigurationResponse' {Maybe Bool
autoEnable :: Maybe Bool
$sel:autoEnable:DescribeOrganizationConfigurationResponse' :: DescribeOrganizationConfigurationResponse -> Maybe Bool
autoEnable} -> Maybe Bool
autoEnable) (\s :: DescribeOrganizationConfigurationResponse
s@DescribeOrganizationConfigurationResponse' {} Maybe Bool
a -> DescribeOrganizationConfigurationResponse
s {$sel:autoEnable:DescribeOrganizationConfigurationResponse' :: Maybe Bool
autoEnable = Maybe Bool
a} :: DescribeOrganizationConfigurationResponse)

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

instance
  Prelude.NFData
    DescribeOrganizationConfigurationResponse