{-# 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.ListLogSources
-- 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 log sources in the current Amazon Web Services Region.
--
-- This operation returns paginated results.
module Amazonka.SecurityLake.ListLogSources
  ( -- * Creating a Request
    ListLogSources (..),
    newListLogSources,

    -- * Request Lenses
    listLogSources_inputOrder,
    listLogSources_listAllDimensions,
    listLogSources_listSingleDimension,
    listLogSources_listTwoDimensions,
    listLogSources_maxResults,
    listLogSources_nextToken,

    -- * Destructuring the Response
    ListLogSourcesResponse (..),
    newListLogSourcesResponse,

    -- * Response Lenses
    listLogSourcesResponse_nextToken,
    listLogSourcesResponse_httpStatus,
    listLogSourcesResponse_regionSourceTypesAccountsList,
  )
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:/ 'newListLogSources' smart constructor.
data ListLogSources = ListLogSources'
  { -- | Lists the log sources in input order, namely Region, source type, and
    -- member account.
    ListLogSources -> Maybe [Dimension]
inputOrder :: Prelude.Maybe [Dimension],
    -- | List the view of log sources for enabled Amazon Security Lake accounts
    -- for specific Amazon Web Services sources from specific accounts and
    -- specific Regions.
    ListLogSources -> Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions :: Prelude.Maybe (Prelude.HashMap Prelude.Text (Prelude.HashMap Prelude.Text [Prelude.Text])),
    -- | List the view of log sources for enabled Security Lake accounts for all
    -- Amazon Web Services sources from specific accounts or specific Regions.
    ListLogSources -> Maybe [Text]
listSingleDimension :: Prelude.Maybe [Prelude.Text],
    -- | Lists the view of log sources for enabled Security Lake accounts for
    -- specific Amazon Web Services sources from specific accounts or specific
    -- Regions.
    ListLogSources -> Maybe (HashMap Text [Text])
listTwoDimensions :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The maximum number of accounts for which the log sources are displayed.
    ListLogSources -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | If nextToken is returned, there are more results available. You can
    -- repeat the call using the returned token to retrieve the next page.
    ListLogSources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListLogSources -> ListLogSources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLogSources -> ListLogSources -> Bool
$c/= :: ListLogSources -> ListLogSources -> Bool
== :: ListLogSources -> ListLogSources -> Bool
$c== :: ListLogSources -> ListLogSources -> Bool
Prelude.Eq, ReadPrec [ListLogSources]
ReadPrec ListLogSources
Int -> ReadS ListLogSources
ReadS [ListLogSources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLogSources]
$creadListPrec :: ReadPrec [ListLogSources]
readPrec :: ReadPrec ListLogSources
$creadPrec :: ReadPrec ListLogSources
readList :: ReadS [ListLogSources]
$creadList :: ReadS [ListLogSources]
readsPrec :: Int -> ReadS ListLogSources
$creadsPrec :: Int -> ReadS ListLogSources
Prelude.Read, Int -> ListLogSources -> ShowS
[ListLogSources] -> ShowS
ListLogSources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLogSources] -> ShowS
$cshowList :: [ListLogSources] -> ShowS
show :: ListLogSources -> String
$cshow :: ListLogSources -> String
showsPrec :: Int -> ListLogSources -> ShowS
$cshowsPrec :: Int -> ListLogSources -> ShowS
Prelude.Show, forall x. Rep ListLogSources x -> ListLogSources
forall x. ListLogSources -> Rep ListLogSources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLogSources x -> ListLogSources
$cfrom :: forall x. ListLogSources -> Rep ListLogSources x
Prelude.Generic)

-- |
-- Create a value of 'ListLogSources' 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:
--
-- 'inputOrder', 'listLogSources_inputOrder' - Lists the log sources in input order, namely Region, source type, and
-- member account.
--
-- 'listAllDimensions', 'listLogSources_listAllDimensions' - List the view of log sources for enabled Amazon Security Lake accounts
-- for specific Amazon Web Services sources from specific accounts and
-- specific Regions.
--
-- 'listSingleDimension', 'listLogSources_listSingleDimension' - List the view of log sources for enabled Security Lake accounts for all
-- Amazon Web Services sources from specific accounts or specific Regions.
--
-- 'listTwoDimensions', 'listLogSources_listTwoDimensions' - Lists the view of log sources for enabled Security Lake accounts for
-- specific Amazon Web Services sources from specific accounts or specific
-- Regions.
--
-- 'maxResults', 'listLogSources_maxResults' - The maximum number of accounts for which the log sources are displayed.
--
-- 'nextToken', 'listLogSources_nextToken' - If nextToken is returned, there are more results available. You can
-- repeat the call using the returned token to retrieve the next page.
newListLogSources ::
  ListLogSources
newListLogSources :: ListLogSources
newListLogSources =
  ListLogSources'
    { $sel:inputOrder:ListLogSources' :: Maybe [Dimension]
inputOrder = forall a. Maybe a
Prelude.Nothing,
      $sel:listAllDimensions:ListLogSources' :: Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions = forall a. Maybe a
Prelude.Nothing,
      $sel:listSingleDimension:ListLogSources' :: Maybe [Text]
listSingleDimension = forall a. Maybe a
Prelude.Nothing,
      $sel:listTwoDimensions:ListLogSources' :: Maybe (HashMap Text [Text])
listTwoDimensions = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListLogSources' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListLogSources' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Lists the log sources in input order, namely Region, source type, and
-- member account.
listLogSources_inputOrder :: Lens.Lens' ListLogSources (Prelude.Maybe [Dimension])
listLogSources_inputOrder :: Lens' ListLogSources (Maybe [Dimension])
listLogSources_inputOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLogSources' {Maybe [Dimension]
inputOrder :: Maybe [Dimension]
$sel:inputOrder:ListLogSources' :: ListLogSources -> Maybe [Dimension]
inputOrder} -> Maybe [Dimension]
inputOrder) (\s :: ListLogSources
s@ListLogSources' {} Maybe [Dimension]
a -> ListLogSources
s {$sel:inputOrder:ListLogSources' :: Maybe [Dimension]
inputOrder = Maybe [Dimension]
a} :: ListLogSources) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | List the view of log sources for enabled Amazon Security Lake accounts
-- for specific Amazon Web Services sources from specific accounts and
-- specific Regions.
listLogSources_listAllDimensions :: Lens.Lens' ListLogSources (Prelude.Maybe (Prelude.HashMap Prelude.Text (Prelude.HashMap Prelude.Text [Prelude.Text])))
listLogSources_listAllDimensions :: Lens' ListLogSources (Maybe (HashMap Text (HashMap Text [Text])))
listLogSources_listAllDimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLogSources' {Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions :: Maybe (HashMap Text (HashMap Text [Text]))
$sel:listAllDimensions:ListLogSources' :: ListLogSources -> Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions} -> Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions) (\s :: ListLogSources
s@ListLogSources' {} Maybe (HashMap Text (HashMap Text [Text]))
a -> ListLogSources
s {$sel:listAllDimensions:ListLogSources' :: Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions = Maybe (HashMap Text (HashMap Text [Text]))
a} :: ListLogSources) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | List the view of log sources for enabled Security Lake accounts for all
-- Amazon Web Services sources from specific accounts or specific Regions.
listLogSources_listSingleDimension :: Lens.Lens' ListLogSources (Prelude.Maybe [Prelude.Text])
listLogSources_listSingleDimension :: Lens' ListLogSources (Maybe [Text])
listLogSources_listSingleDimension = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLogSources' {Maybe [Text]
listSingleDimension :: Maybe [Text]
$sel:listSingleDimension:ListLogSources' :: ListLogSources -> Maybe [Text]
listSingleDimension} -> Maybe [Text]
listSingleDimension) (\s :: ListLogSources
s@ListLogSources' {} Maybe [Text]
a -> ListLogSources
s {$sel:listSingleDimension:ListLogSources' :: Maybe [Text]
listSingleDimension = Maybe [Text]
a} :: ListLogSources) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Lists the view of log sources for enabled Security Lake accounts for
-- specific Amazon Web Services sources from specific accounts or specific
-- Regions.
listLogSources_listTwoDimensions :: Lens.Lens' ListLogSources (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
listLogSources_listTwoDimensions :: Lens' ListLogSources (Maybe (HashMap Text [Text]))
listLogSources_listTwoDimensions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLogSources' {Maybe (HashMap Text [Text])
listTwoDimensions :: Maybe (HashMap Text [Text])
$sel:listTwoDimensions:ListLogSources' :: ListLogSources -> Maybe (HashMap Text [Text])
listTwoDimensions} -> Maybe (HashMap Text [Text])
listTwoDimensions) (\s :: ListLogSources
s@ListLogSources' {} Maybe (HashMap Text [Text])
a -> ListLogSources
s {$sel:listTwoDimensions:ListLogSources' :: Maybe (HashMap Text [Text])
listTwoDimensions = Maybe (HashMap Text [Text])
a} :: ListLogSources) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of accounts for which the log sources are displayed.
listLogSources_maxResults :: Lens.Lens' ListLogSources (Prelude.Maybe Prelude.Int)
listLogSources_maxResults :: Lens' ListLogSources (Maybe Int)
listLogSources_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLogSources' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListLogSources' :: ListLogSources -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListLogSources
s@ListLogSources' {} Maybe Int
a -> ListLogSources
s {$sel:maxResults:ListLogSources' :: Maybe Int
maxResults = Maybe Int
a} :: ListLogSources)

-- | If nextToken is returned, there are more results available. You can
-- repeat the call using the returned token to retrieve the next page.
listLogSources_nextToken :: Lens.Lens' ListLogSources (Prelude.Maybe Prelude.Text)
listLogSources_nextToken :: Lens' ListLogSources (Maybe Text)
listLogSources_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLogSources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLogSources' :: ListLogSources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLogSources
s@ListLogSources' {} Maybe Text
a -> ListLogSources
s {$sel:nextToken:ListLogSources' :: Maybe Text
nextToken = Maybe Text
a} :: ListLogSources)

instance Core.AWSPager ListLogSources where
  page :: ListLogSources
-> AWSResponse ListLogSources -> Maybe ListLogSources
page ListLogSources
rq AWSResponse ListLogSources
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListLogSources
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListLogSourcesResponse (Maybe Text)
listLogSourcesResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListLogSources
rs
            forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListLogSourcesResponse [HashMap Text (HashMap Text [Text])]
listLogSourcesResponse_regionSourceTypesAccountsList
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListLogSources
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListLogSources (Maybe Text)
listLogSources_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListLogSources
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListLogSourcesResponse (Maybe Text)
listLogSourcesResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListLogSources where
  type
    AWSResponse ListLogSources =
      ListLogSourcesResponse
  request :: (Service -> Service) -> ListLogSources -> Request ListLogSources
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListLogSources
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListLogSources)))
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 ->
          Maybe Text
-> Int
-> [HashMap Text (HashMap Text [Text])]
-> ListLogSourcesResponse
ListLogSourcesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            forall (f :: * -> *) a b. Applicative f => 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
"regionSourceTypesAccountsList"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListLogSources where
  hashWithSalt :: Int -> ListLogSources -> Int
hashWithSalt Int
_salt ListLogSources' {Maybe Int
Maybe [Text]
Maybe [Dimension]
Maybe Text
Maybe (HashMap Text [Text])
Maybe (HashMap Text (HashMap Text [Text]))
nextToken :: Maybe Text
maxResults :: Maybe Int
listTwoDimensions :: Maybe (HashMap Text [Text])
listSingleDimension :: Maybe [Text]
listAllDimensions :: Maybe (HashMap Text (HashMap Text [Text]))
inputOrder :: Maybe [Dimension]
$sel:nextToken:ListLogSources' :: ListLogSources -> Maybe Text
$sel:maxResults:ListLogSources' :: ListLogSources -> Maybe Int
$sel:listTwoDimensions:ListLogSources' :: ListLogSources -> Maybe (HashMap Text [Text])
$sel:listSingleDimension:ListLogSources' :: ListLogSources -> Maybe [Text]
$sel:listAllDimensions:ListLogSources' :: ListLogSources -> Maybe (HashMap Text (HashMap Text [Text]))
$sel:inputOrder:ListLogSources' :: ListLogSources -> Maybe [Dimension]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Dimension]
inputOrder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
listSingleDimension
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text [Text])
listTwoDimensions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListLogSources where
  rnf :: ListLogSources -> ()
rnf ListLogSources' {Maybe Int
Maybe [Text]
Maybe [Dimension]
Maybe Text
Maybe (HashMap Text [Text])
Maybe (HashMap Text (HashMap Text [Text]))
nextToken :: Maybe Text
maxResults :: Maybe Int
listTwoDimensions :: Maybe (HashMap Text [Text])
listSingleDimension :: Maybe [Text]
listAllDimensions :: Maybe (HashMap Text (HashMap Text [Text]))
inputOrder :: Maybe [Dimension]
$sel:nextToken:ListLogSources' :: ListLogSources -> Maybe Text
$sel:maxResults:ListLogSources' :: ListLogSources -> Maybe Int
$sel:listTwoDimensions:ListLogSources' :: ListLogSources -> Maybe (HashMap Text [Text])
$sel:listSingleDimension:ListLogSources' :: ListLogSources -> Maybe [Text]
$sel:listAllDimensions:ListLogSources' :: ListLogSources -> Maybe (HashMap Text (HashMap Text [Text]))
$sel:inputOrder:ListLogSources' :: ListLogSources -> Maybe [Dimension]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Dimension]
inputOrder
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
listSingleDimension
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text [Text])
listTwoDimensions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders ListLogSources where
  toHeaders :: ListLogSources -> 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 ListLogSources where
  toJSON :: ListLogSources -> Value
toJSON ListLogSources' {Maybe Int
Maybe [Text]
Maybe [Dimension]
Maybe Text
Maybe (HashMap Text [Text])
Maybe (HashMap Text (HashMap Text [Text]))
nextToken :: Maybe Text
maxResults :: Maybe Int
listTwoDimensions :: Maybe (HashMap Text [Text])
listSingleDimension :: Maybe [Text]
listAllDimensions :: Maybe (HashMap Text (HashMap Text [Text]))
inputOrder :: Maybe [Dimension]
$sel:nextToken:ListLogSources' :: ListLogSources -> Maybe Text
$sel:maxResults:ListLogSources' :: ListLogSources -> Maybe Int
$sel:listTwoDimensions:ListLogSources' :: ListLogSources -> Maybe (HashMap Text [Text])
$sel:listSingleDimension:ListLogSources' :: ListLogSources -> Maybe [Text]
$sel:listAllDimensions:ListLogSources' :: ListLogSources -> Maybe (HashMap Text (HashMap Text [Text]))
$sel:inputOrder:ListLogSources' :: ListLogSources -> Maybe [Dimension]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"inputOrder" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Dimension]
inputOrder,
            (Key
"listAllDimensions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text (HashMap Text [Text]))
listAllDimensions,
            (Key
"listSingleDimension" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
listSingleDimension,
            (Key
"listTwoDimensions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
listTwoDimensions,
            (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
          ]
      )

instance Data.ToPath ListLogSources where
  toPath :: ListLogSources -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/v1/logsources/list"

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

-- | /See:/ 'newListLogSourcesResponse' smart constructor.
data ListLogSourcesResponse = ListLogSourcesResponse'
  { -- | If nextToken is returned, there are more results available. You can
    -- repeat the call using the returned token to retrieve the next page.
    ListLogSourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListLogSourcesResponse -> Int
httpStatus :: Prelude.Int,
    -- | Lists the log sources by Regions for enabled Security Lake accounts.
    ListLogSourcesResponse -> [HashMap Text (HashMap Text [Text])]
regionSourceTypesAccountsList :: [Prelude.HashMap Prelude.Text (Prelude.HashMap Prelude.Text [Prelude.Text])]
  }
  deriving (ListLogSourcesResponse -> ListLogSourcesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLogSourcesResponse -> ListLogSourcesResponse -> Bool
$c/= :: ListLogSourcesResponse -> ListLogSourcesResponse -> Bool
== :: ListLogSourcesResponse -> ListLogSourcesResponse -> Bool
$c== :: ListLogSourcesResponse -> ListLogSourcesResponse -> Bool
Prelude.Eq, ReadPrec [ListLogSourcesResponse]
ReadPrec ListLogSourcesResponse
Int -> ReadS ListLogSourcesResponse
ReadS [ListLogSourcesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLogSourcesResponse]
$creadListPrec :: ReadPrec [ListLogSourcesResponse]
readPrec :: ReadPrec ListLogSourcesResponse
$creadPrec :: ReadPrec ListLogSourcesResponse
readList :: ReadS [ListLogSourcesResponse]
$creadList :: ReadS [ListLogSourcesResponse]
readsPrec :: Int -> ReadS ListLogSourcesResponse
$creadsPrec :: Int -> ReadS ListLogSourcesResponse
Prelude.Read, Int -> ListLogSourcesResponse -> ShowS
[ListLogSourcesResponse] -> ShowS
ListLogSourcesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLogSourcesResponse] -> ShowS
$cshowList :: [ListLogSourcesResponse] -> ShowS
show :: ListLogSourcesResponse -> String
$cshow :: ListLogSourcesResponse -> String
showsPrec :: Int -> ListLogSourcesResponse -> ShowS
$cshowsPrec :: Int -> ListLogSourcesResponse -> ShowS
Prelude.Show, forall x. Rep ListLogSourcesResponse x -> ListLogSourcesResponse
forall x. ListLogSourcesResponse -> Rep ListLogSourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListLogSourcesResponse x -> ListLogSourcesResponse
$cfrom :: forall x. ListLogSourcesResponse -> Rep ListLogSourcesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListLogSourcesResponse' 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:
--
-- 'nextToken', 'listLogSourcesResponse_nextToken' - If nextToken is returned, there are more results available. You can
-- repeat the call using the returned token to retrieve the next page.
--
-- 'httpStatus', 'listLogSourcesResponse_httpStatus' - The response's http status code.
--
-- 'regionSourceTypesAccountsList', 'listLogSourcesResponse_regionSourceTypesAccountsList' - Lists the log sources by Regions for enabled Security Lake accounts.
newListLogSourcesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListLogSourcesResponse
newListLogSourcesResponse :: Int -> ListLogSourcesResponse
newListLogSourcesResponse Int
pHttpStatus_ =
  ListLogSourcesResponse'
    { $sel:nextToken:ListLogSourcesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListLogSourcesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:regionSourceTypesAccountsList:ListLogSourcesResponse' :: [HashMap Text (HashMap Text [Text])]
regionSourceTypesAccountsList = forall a. Monoid a => a
Prelude.mempty
    }

-- | If nextToken is returned, there are more results available. You can
-- repeat the call using the returned token to retrieve the next page.
listLogSourcesResponse_nextToken :: Lens.Lens' ListLogSourcesResponse (Prelude.Maybe Prelude.Text)
listLogSourcesResponse_nextToken :: Lens' ListLogSourcesResponse (Maybe Text)
listLogSourcesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLogSourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLogSourcesResponse' :: ListLogSourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLogSourcesResponse
s@ListLogSourcesResponse' {} Maybe Text
a -> ListLogSourcesResponse
s {$sel:nextToken:ListLogSourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListLogSourcesResponse)

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

-- | Lists the log sources by Regions for enabled Security Lake accounts.
listLogSourcesResponse_regionSourceTypesAccountsList :: Lens.Lens' ListLogSourcesResponse [Prelude.HashMap Prelude.Text (Prelude.HashMap Prelude.Text [Prelude.Text])]
listLogSourcesResponse_regionSourceTypesAccountsList :: Lens' ListLogSourcesResponse [HashMap Text (HashMap Text [Text])]
listLogSourcesResponse_regionSourceTypesAccountsList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLogSourcesResponse' {[HashMap Text (HashMap Text [Text])]
regionSourceTypesAccountsList :: [HashMap Text (HashMap Text [Text])]
$sel:regionSourceTypesAccountsList:ListLogSourcesResponse' :: ListLogSourcesResponse -> [HashMap Text (HashMap Text [Text])]
regionSourceTypesAccountsList} -> [HashMap Text (HashMap Text [Text])]
regionSourceTypesAccountsList) (\s :: ListLogSourcesResponse
s@ListLogSourcesResponse' {} [HashMap Text (HashMap Text [Text])]
a -> ListLogSourcesResponse
s {$sel:regionSourceTypesAccountsList:ListLogSourcesResponse' :: [HashMap Text (HashMap Text [Text])]
regionSourceTypesAccountsList = [HashMap Text (HashMap Text [Text])]
a} :: ListLogSourcesResponse) 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 ListLogSourcesResponse where
  rnf :: ListLogSourcesResponse -> ()
rnf ListLogSourcesResponse' {Int
[HashMap Text (HashMap Text [Text])]
Maybe Text
regionSourceTypesAccountsList :: [HashMap Text (HashMap Text [Text])]
httpStatus :: Int
nextToken :: Maybe Text
$sel:regionSourceTypesAccountsList:ListLogSourcesResponse' :: ListLogSourcesResponse -> [HashMap Text (HashMap Text [Text])]
$sel:httpStatus:ListLogSourcesResponse' :: ListLogSourcesResponse -> Int
$sel:nextToken:ListLogSourcesResponse' :: ListLogSourcesResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 [HashMap Text (HashMap Text [Text])]
regionSourceTypesAccountsList