{-# 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.UpdateDatalake
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Specifies where to store your security data and for how long. You can
-- add a rollup Region to consolidate data from multiple Amazon Web
-- Services Regions.
module Amazonka.SecurityLake.UpdateDatalake
  ( -- * Creating a Request
    UpdateDatalake (..),
    newUpdateDatalake,

    -- * Request Lenses
    updateDatalake_configurations,

    -- * Destructuring the Response
    UpdateDatalakeResponse (..),
    newUpdateDatalakeResponse,

    -- * Response Lenses
    updateDatalakeResponse_httpStatus,
  )
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:/ 'newUpdateDatalake' smart constructor.
data UpdateDatalake = UpdateDatalake'
  { -- | Specify the Region or Regions that will contribute data to the rollup
    -- region.
    UpdateDatalake -> HashMap Region LakeConfigurationRequest
configurations :: Prelude.HashMap Region LakeConfigurationRequest
  }
  deriving (UpdateDatalake -> UpdateDatalake -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDatalake -> UpdateDatalake -> Bool
$c/= :: UpdateDatalake -> UpdateDatalake -> Bool
== :: UpdateDatalake -> UpdateDatalake -> Bool
$c== :: UpdateDatalake -> UpdateDatalake -> Bool
Prelude.Eq, ReadPrec [UpdateDatalake]
ReadPrec UpdateDatalake
Int -> ReadS UpdateDatalake
ReadS [UpdateDatalake]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateDatalake]
$creadListPrec :: ReadPrec [UpdateDatalake]
readPrec :: ReadPrec UpdateDatalake
$creadPrec :: ReadPrec UpdateDatalake
readList :: ReadS [UpdateDatalake]
$creadList :: ReadS [UpdateDatalake]
readsPrec :: Int -> ReadS UpdateDatalake
$creadsPrec :: Int -> ReadS UpdateDatalake
Prelude.Read, Int -> UpdateDatalake -> ShowS
[UpdateDatalake] -> ShowS
UpdateDatalake -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDatalake] -> ShowS
$cshowList :: [UpdateDatalake] -> ShowS
show :: UpdateDatalake -> String
$cshow :: UpdateDatalake -> String
showsPrec :: Int -> UpdateDatalake -> ShowS
$cshowsPrec :: Int -> UpdateDatalake -> ShowS
Prelude.Show, forall x. Rep UpdateDatalake x -> UpdateDatalake
forall x. UpdateDatalake -> Rep UpdateDatalake x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDatalake x -> UpdateDatalake
$cfrom :: forall x. UpdateDatalake -> Rep UpdateDatalake x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDatalake' 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:
--
-- 'configurations', 'updateDatalake_configurations' - Specify the Region or Regions that will contribute data to the rollup
-- region.
newUpdateDatalake ::
  UpdateDatalake
newUpdateDatalake :: UpdateDatalake
newUpdateDatalake =
  UpdateDatalake' {$sel:configurations:UpdateDatalake' :: HashMap Region LakeConfigurationRequest
configurations = forall a. Monoid a => a
Prelude.mempty}

-- | Specify the Region or Regions that will contribute data to the rollup
-- region.
updateDatalake_configurations :: Lens.Lens' UpdateDatalake (Prelude.HashMap Region LakeConfigurationRequest)
updateDatalake_configurations :: Lens' UpdateDatalake (HashMap Region LakeConfigurationRequest)
updateDatalake_configurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDatalake' {HashMap Region LakeConfigurationRequest
configurations :: HashMap Region LakeConfigurationRequest
$sel:configurations:UpdateDatalake' :: UpdateDatalake -> HashMap Region LakeConfigurationRequest
configurations} -> HashMap Region LakeConfigurationRequest
configurations) (\s :: UpdateDatalake
s@UpdateDatalake' {} HashMap Region LakeConfigurationRequest
a -> UpdateDatalake
s {$sel:configurations:UpdateDatalake' :: HashMap Region LakeConfigurationRequest
configurations = HashMap Region LakeConfigurationRequest
a} :: UpdateDatalake) 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 Core.AWSRequest UpdateDatalake where
  type
    AWSResponse UpdateDatalake =
      UpdateDatalakeResponse
  request :: (Service -> Service) -> UpdateDatalake -> Request UpdateDatalake
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateDatalake
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateDatalake)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateDatalakeResponse
UpdateDatalakeResponse'
            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))
      )

instance Prelude.Hashable UpdateDatalake where
  hashWithSalt :: Int -> UpdateDatalake -> Int
hashWithSalt Int
_salt UpdateDatalake' {HashMap Region LakeConfigurationRequest
configurations :: HashMap Region LakeConfigurationRequest
$sel:configurations:UpdateDatalake' :: UpdateDatalake -> HashMap Region LakeConfigurationRequest
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` HashMap Region LakeConfigurationRequest
configurations

instance Prelude.NFData UpdateDatalake where
  rnf :: UpdateDatalake -> ()
rnf UpdateDatalake' {HashMap Region LakeConfigurationRequest
configurations :: HashMap Region LakeConfigurationRequest
$sel:configurations:UpdateDatalake' :: UpdateDatalake -> HashMap Region LakeConfigurationRequest
..} = forall a. NFData a => a -> ()
Prelude.rnf HashMap Region LakeConfigurationRequest
configurations

instance Data.ToHeaders UpdateDatalake where
  toHeaders :: UpdateDatalake -> 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.ToJSON UpdateDatalake where
  toJSON :: UpdateDatalake -> Value
toJSON UpdateDatalake' {HashMap Region LakeConfigurationRequest
configurations :: HashMap Region LakeConfigurationRequest
$sel:configurations:UpdateDatalake' :: UpdateDatalake -> HashMap Region LakeConfigurationRequest
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"configurations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= HashMap Region LakeConfigurationRequest
configurations)
          ]
      )

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

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

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

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

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

instance Prelude.NFData UpdateDatalakeResponse where
  rnf :: UpdateDatalakeResponse -> ()
rnf UpdateDatalakeResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateDatalakeResponse' :: UpdateDatalakeResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus