packages feed

amazonka-securitylake-2.0: gen/Amazonka/SecurityLake/CreateDatalake.hs

{-# 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.CreateDatalake
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Initializes an Amazon Security Lake instance with the provided (or
-- default) configuration. You can enable Security Lake in Amazon Web
-- Services Regions with customized settings before enabling log collection
-- in Regions. You can either use the @enableAll@ parameter to specify all
-- Regions or specify the Regions where you want to enable Security Lake.
-- To specify particular Regions, use the @Regions@ parameter and then
-- configure these Regions using the @configurations@ parameter. If you
-- have already enabled Security Lake in a Region when you call this
-- command, the command will update the Region if you provide new
-- configuration parameters. If you have not already enabled Security Lake
-- in the Region when you call this API, it will set up the data lake in
-- the Region with the specified configurations.
--
-- When you enable Security Lake, it starts ingesting security data after
-- the @CreateAwsLogSource@ call. This includes ingesting security data
-- from sources, storing data, and making data accessible to subscribers.
-- Security Lake also enables all the existing settings and resources that
-- it stores or maintains for your Amazon Web Services account in the
-- current Region, including security log and event data. For more
-- information, see the
-- <https://docs.aws.amazon.com/security-lake/latest/userguide/what-is-security-lake.html Amazon Security Lake User Guide>.
module Amazonka.SecurityLake.CreateDatalake
  ( -- * Creating a Request
    CreateDatalake (..),
    newCreateDatalake,

    -- * Request Lenses
    createDatalake_configurations,
    createDatalake_enableAll,
    createDatalake_metaStoreManagerRoleArn,
    createDatalake_regions,

    -- * Destructuring the Response
    CreateDatalakeResponse (..),
    newCreateDatalakeResponse,

    -- * Response Lenses
    createDatalakeResponse_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:/ 'newCreateDatalake' smart constructor.
data CreateDatalake = CreateDatalake'
  { -- | Specify the Region or Regions that will contribute data to the rollup
    -- region.
    configurations :: Prelude.Maybe (Prelude.HashMap Region LakeConfigurationRequest),
    -- | Enable Security Lake in all Regions.
    enableAll :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) used to create and update the Glue table.
    -- This table contains partitions generated by the ingestion and
    -- normalization of Amazon Web Services log sources and custom sources.
    metaStoreManagerRoleArn :: Prelude.Maybe Prelude.Text,
    -- | Enable Security Lake in the specified Regions. To enable Security Lake
    -- in specific Amazon Web Services Regions, such as us-east-1 or
    -- ap-northeast-3, provide the Region codes. For a list of Region codes,
    -- see
    -- <https://docs.aws.amazon.com/general/latest/gr/securitylake.html Amazon Security Lake endpoints>
    -- in the Amazon Web Services General Reference.
    regions :: Prelude.Maybe [Region]
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'CreateDatalake' 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', 'createDatalake_configurations' - Specify the Region or Regions that will contribute data to the rollup
-- region.
--
-- 'enableAll', 'createDatalake_enableAll' - Enable Security Lake in all Regions.
--
-- 'metaStoreManagerRoleArn', 'createDatalake_metaStoreManagerRoleArn' - The Amazon Resource Name (ARN) used to create and update the Glue table.
-- This table contains partitions generated by the ingestion and
-- normalization of Amazon Web Services log sources and custom sources.
--
-- 'regions', 'createDatalake_regions' - Enable Security Lake in the specified Regions. To enable Security Lake
-- in specific Amazon Web Services Regions, such as us-east-1 or
-- ap-northeast-3, provide the Region codes. For a list of Region codes,
-- see
-- <https://docs.aws.amazon.com/general/latest/gr/securitylake.html Amazon Security Lake endpoints>
-- in the Amazon Web Services General Reference.
newCreateDatalake ::
  CreateDatalake
newCreateDatalake =
  CreateDatalake'
    { configurations = Prelude.Nothing,
      enableAll = Prelude.Nothing,
      metaStoreManagerRoleArn = Prelude.Nothing,
      regions = Prelude.Nothing
    }

-- | Specify the Region or Regions that will contribute data to the rollup
-- region.
createDatalake_configurations :: Lens.Lens' CreateDatalake (Prelude.Maybe (Prelude.HashMap Region LakeConfigurationRequest))
createDatalake_configurations = Lens.lens (\CreateDatalake' {configurations} -> configurations) (\s@CreateDatalake' {} a -> s {configurations = a} :: CreateDatalake) Prelude.. Lens.mapping Lens.coerced

-- | Enable Security Lake in all Regions.
createDatalake_enableAll :: Lens.Lens' CreateDatalake (Prelude.Maybe Prelude.Bool)
createDatalake_enableAll = Lens.lens (\CreateDatalake' {enableAll} -> enableAll) (\s@CreateDatalake' {} a -> s {enableAll = a} :: CreateDatalake)

-- | The Amazon Resource Name (ARN) used to create and update the Glue table.
-- This table contains partitions generated by the ingestion and
-- normalization of Amazon Web Services log sources and custom sources.
createDatalake_metaStoreManagerRoleArn :: Lens.Lens' CreateDatalake (Prelude.Maybe Prelude.Text)
createDatalake_metaStoreManagerRoleArn = Lens.lens (\CreateDatalake' {metaStoreManagerRoleArn} -> metaStoreManagerRoleArn) (\s@CreateDatalake' {} a -> s {metaStoreManagerRoleArn = a} :: CreateDatalake)

-- | Enable Security Lake in the specified Regions. To enable Security Lake
-- in specific Amazon Web Services Regions, such as us-east-1 or
-- ap-northeast-3, provide the Region codes. For a list of Region codes,
-- see
-- <https://docs.aws.amazon.com/general/latest/gr/securitylake.html Amazon Security Lake endpoints>
-- in the Amazon Web Services General Reference.
createDatalake_regions :: Lens.Lens' CreateDatalake (Prelude.Maybe [Region])
createDatalake_regions = Lens.lens (\CreateDatalake' {regions} -> regions) (\s@CreateDatalake' {} a -> s {regions = a} :: CreateDatalake) Prelude.. Lens.mapping Lens.coerced

instance Core.AWSRequest CreateDatalake where
  type
    AWSResponse CreateDatalake =
      CreateDatalakeResponse
  request overrides =
    Request.postJSON (overrides defaultService)
  response =
    Response.receiveEmpty
      ( \s h x ->
          CreateDatalakeResponse'
            Prelude.<$> (Prelude.pure (Prelude.fromEnum s))
      )

instance Prelude.Hashable CreateDatalake where
  hashWithSalt _salt CreateDatalake' {..} =
    _salt
      `Prelude.hashWithSalt` configurations
      `Prelude.hashWithSalt` enableAll
      `Prelude.hashWithSalt` metaStoreManagerRoleArn
      `Prelude.hashWithSalt` regions

instance Prelude.NFData CreateDatalake where
  rnf CreateDatalake' {..} =
    Prelude.rnf configurations
      `Prelude.seq` Prelude.rnf enableAll
      `Prelude.seq` Prelude.rnf metaStoreManagerRoleArn
      `Prelude.seq` Prelude.rnf regions

instance Data.ToHeaders CreateDatalake where
  toHeaders =
    Prelude.const
      ( Prelude.mconcat
          [ "Content-Type"
              Data.=# ( "application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateDatalake where
  toJSON CreateDatalake' {..} =
    Data.object
      ( Prelude.catMaybes
          [ ("configurations" Data..=)
              Prelude.<$> configurations,
            ("enableAll" Data..=) Prelude.<$> enableAll,
            ("metaStoreManagerRoleArn" Data..=)
              Prelude.<$> metaStoreManagerRoleArn,
            ("regions" Data..=) Prelude.<$> regions
          ]
      )

instance Data.ToPath CreateDatalake where
  toPath = Prelude.const "/v1/datalake"

instance Data.ToQuery CreateDatalake where
  toQuery = Prelude.const Prelude.mempty

-- | /See:/ 'newCreateDatalakeResponse' smart constructor.
data CreateDatalakeResponse = CreateDatalakeResponse'
  { -- | The response's http status code.
    httpStatus :: Prelude.Int
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'CreateDatalakeResponse' 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', 'createDatalakeResponse_httpStatus' - The response's http status code.
newCreateDatalakeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDatalakeResponse
newCreateDatalakeResponse pHttpStatus_ =
  CreateDatalakeResponse' {httpStatus = pHttpStatus_}

-- | The response's http status code.
createDatalakeResponse_httpStatus :: Lens.Lens' CreateDatalakeResponse Prelude.Int
createDatalakeResponse_httpStatus = Lens.lens (\CreateDatalakeResponse' {httpStatus} -> httpStatus) (\s@CreateDatalakeResponse' {} a -> s {httpStatus = a} :: CreateDatalakeResponse)

instance Prelude.NFData CreateDatalakeResponse where
  rnf CreateDatalakeResponse' {..} =
    Prelude.rnf httpStatus