{-# 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.SecurityLake.GetDatalakeAutoEnable
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the configuration that will be automatically set up for
-- accounts added to the organization after the organization has onboarded
-- to Amazon Security Lake. This API does not take input parameters.
module Amazonka.SecurityLake.GetDatalakeAutoEnable
  ( -- * Creating a Request
    GetDatalakeAutoEnable (..),
    newGetDatalakeAutoEnable,

    -- * Destructuring the Response
    GetDatalakeAutoEnableResponse (..),
    newGetDatalakeAutoEnableResponse,

    -- * Response Lenses
    getDatalakeAutoEnableResponse_httpStatus,
    getDatalakeAutoEnableResponse_autoEnableNewAccounts,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SecurityLake.Types

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

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

instance Core.AWSRequest GetDatalakeAutoEnable where
  type
    AWSResponse GetDatalakeAutoEnable =
      GetDatalakeAutoEnableResponse
  request :: (Service -> Service)
-> GetDatalakeAutoEnable -> Request GetDatalakeAutoEnable
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDatalakeAutoEnable
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetDatalakeAutoEnable)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int
-> [AutoEnableNewRegionConfiguration]
-> GetDatalakeAutoEnableResponse
GetDatalakeAutoEnableResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"autoEnableNewAccounts"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable GetDatalakeAutoEnable where
  hashWithSalt :: Int -> GetDatalakeAutoEnable -> Int
hashWithSalt Int
_salt GetDatalakeAutoEnable
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData GetDatalakeAutoEnable where
  rnf :: GetDatalakeAutoEnable -> ()
rnf GetDatalakeAutoEnable
_ = ()

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

instance Data.ToPath GetDatalakeAutoEnable where
  toPath :: GetDatalakeAutoEnable -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/datalake/autoenable"

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

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

-- |
-- Create a value of 'GetDatalakeAutoEnableResponse' 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', 'getDatalakeAutoEnableResponse_httpStatus' - The response's http status code.
--
-- 'autoEnableNewAccounts', 'getDatalakeAutoEnableResponse_autoEnableNewAccounts' - The configuration for new accounts.
newGetDatalakeAutoEnableResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDatalakeAutoEnableResponse
newGetDatalakeAutoEnableResponse :: Int -> GetDatalakeAutoEnableResponse
newGetDatalakeAutoEnableResponse Int
pHttpStatus_ =
  GetDatalakeAutoEnableResponse'
    { $sel:httpStatus:GetDatalakeAutoEnableResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:autoEnableNewAccounts:GetDatalakeAutoEnableResponse' :: [AutoEnableNewRegionConfiguration]
autoEnableNewAccounts = forall a. Monoid a => a
Prelude.mempty
    }

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

-- | The configuration for new accounts.
getDatalakeAutoEnableResponse_autoEnableNewAccounts :: Lens.Lens' GetDatalakeAutoEnableResponse [AutoEnableNewRegionConfiguration]
getDatalakeAutoEnableResponse_autoEnableNewAccounts :: Lens'
  GetDatalakeAutoEnableResponse [AutoEnableNewRegionConfiguration]
getDatalakeAutoEnableResponse_autoEnableNewAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDatalakeAutoEnableResponse' {[AutoEnableNewRegionConfiguration]
autoEnableNewAccounts :: [AutoEnableNewRegionConfiguration]
$sel:autoEnableNewAccounts:GetDatalakeAutoEnableResponse' :: GetDatalakeAutoEnableResponse -> [AutoEnableNewRegionConfiguration]
autoEnableNewAccounts} -> [AutoEnableNewRegionConfiguration]
autoEnableNewAccounts) (\s :: GetDatalakeAutoEnableResponse
s@GetDatalakeAutoEnableResponse' {} [AutoEnableNewRegionConfiguration]
a -> GetDatalakeAutoEnableResponse
s {$sel:autoEnableNewAccounts:GetDatalakeAutoEnableResponse' :: [AutoEnableNewRegionConfiguration]
autoEnableNewAccounts = [AutoEnableNewRegionConfiguration]
a} :: GetDatalakeAutoEnableResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData GetDatalakeAutoEnableResponse where
  rnf :: GetDatalakeAutoEnableResponse -> ()
rnf GetDatalakeAutoEnableResponse' {Int
[AutoEnableNewRegionConfiguration]
autoEnableNewAccounts :: [AutoEnableNewRegionConfiguration]
httpStatus :: Int
$sel:autoEnableNewAccounts:GetDatalakeAutoEnableResponse' :: GetDatalakeAutoEnableResponse -> [AutoEnableNewRegionConfiguration]
$sel:httpStatus:GetDatalakeAutoEnableResponse' :: GetDatalakeAutoEnableResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [AutoEnableNewRegionConfiguration]
autoEnableNewAccounts