{-# 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.IVSChat.ListLoggingConfigurations
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets summary information about all your logging configurations in the
-- AWS region where the API request is processed.
module Amazonka.IVSChat.ListLoggingConfigurations
  ( -- * Creating a Request
    ListLoggingConfigurations (..),
    newListLoggingConfigurations,

    -- * Request Lenses
    listLoggingConfigurations_maxResults,
    listLoggingConfigurations_nextToken,

    -- * Destructuring the Response
    ListLoggingConfigurationsResponse (..),
    newListLoggingConfigurationsResponse,

    -- * Response Lenses
    listLoggingConfigurationsResponse_nextToken,
    listLoggingConfigurationsResponse_httpStatus,
    listLoggingConfigurationsResponse_loggingConfigurations,
  )
where

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

-- | /See:/ 'newListLoggingConfigurations' smart constructor.
data ListLoggingConfigurations = ListLoggingConfigurations'
  { -- | Maximum number of logging configurations to return. Default: 50.
    ListLoggingConfigurations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The first logging configurations to retrieve. This is used for
    -- pagination; see the @nextToken@ response field.
    ListLoggingConfigurations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListLoggingConfigurations -> ListLoggingConfigurations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLoggingConfigurations -> ListLoggingConfigurations -> Bool
$c/= :: ListLoggingConfigurations -> ListLoggingConfigurations -> Bool
== :: ListLoggingConfigurations -> ListLoggingConfigurations -> Bool
$c== :: ListLoggingConfigurations -> ListLoggingConfigurations -> Bool
Prelude.Eq, ReadPrec [ListLoggingConfigurations]
ReadPrec ListLoggingConfigurations
Int -> ReadS ListLoggingConfigurations
ReadS [ListLoggingConfigurations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLoggingConfigurations]
$creadListPrec :: ReadPrec [ListLoggingConfigurations]
readPrec :: ReadPrec ListLoggingConfigurations
$creadPrec :: ReadPrec ListLoggingConfigurations
readList :: ReadS [ListLoggingConfigurations]
$creadList :: ReadS [ListLoggingConfigurations]
readsPrec :: Int -> ReadS ListLoggingConfigurations
$creadsPrec :: Int -> ReadS ListLoggingConfigurations
Prelude.Read, Int -> ListLoggingConfigurations -> ShowS
[ListLoggingConfigurations] -> ShowS
ListLoggingConfigurations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLoggingConfigurations] -> ShowS
$cshowList :: [ListLoggingConfigurations] -> ShowS
show :: ListLoggingConfigurations -> String
$cshow :: ListLoggingConfigurations -> String
showsPrec :: Int -> ListLoggingConfigurations -> ShowS
$cshowsPrec :: Int -> ListLoggingConfigurations -> ShowS
Prelude.Show, forall x.
Rep ListLoggingConfigurations x -> ListLoggingConfigurations
forall x.
ListLoggingConfigurations -> Rep ListLoggingConfigurations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListLoggingConfigurations x -> ListLoggingConfigurations
$cfrom :: forall x.
ListLoggingConfigurations -> Rep ListLoggingConfigurations x
Prelude.Generic)

-- |
-- Create a value of 'ListLoggingConfigurations' 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:
--
-- 'maxResults', 'listLoggingConfigurations_maxResults' - Maximum number of logging configurations to return. Default: 50.
--
-- 'nextToken', 'listLoggingConfigurations_nextToken' - The first logging configurations to retrieve. This is used for
-- pagination; see the @nextToken@ response field.
newListLoggingConfigurations ::
  ListLoggingConfigurations
newListLoggingConfigurations :: ListLoggingConfigurations
newListLoggingConfigurations =
  ListLoggingConfigurations'
    { $sel:maxResults:ListLoggingConfigurations' :: Maybe Natural
maxResults =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListLoggingConfigurations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Maximum number of logging configurations to return. Default: 50.
listLoggingConfigurations_maxResults :: Lens.Lens' ListLoggingConfigurations (Prelude.Maybe Prelude.Natural)
listLoggingConfigurations_maxResults :: Lens' ListLoggingConfigurations (Maybe Natural)
listLoggingConfigurations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLoggingConfigurations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListLoggingConfigurations' :: ListLoggingConfigurations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListLoggingConfigurations
s@ListLoggingConfigurations' {} Maybe Natural
a -> ListLoggingConfigurations
s {$sel:maxResults:ListLoggingConfigurations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListLoggingConfigurations)

-- | The first logging configurations to retrieve. This is used for
-- pagination; see the @nextToken@ response field.
listLoggingConfigurations_nextToken :: Lens.Lens' ListLoggingConfigurations (Prelude.Maybe Prelude.Text)
listLoggingConfigurations_nextToken :: Lens' ListLoggingConfigurations (Maybe Text)
listLoggingConfigurations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLoggingConfigurations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLoggingConfigurations' :: ListLoggingConfigurations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLoggingConfigurations
s@ListLoggingConfigurations' {} Maybe Text
a -> ListLoggingConfigurations
s {$sel:nextToken:ListLoggingConfigurations' :: Maybe Text
nextToken = Maybe Text
a} :: ListLoggingConfigurations)

instance Core.AWSRequest ListLoggingConfigurations where
  type
    AWSResponse ListLoggingConfigurations =
      ListLoggingConfigurationsResponse
  request :: (Service -> Service)
-> ListLoggingConfigurations -> Request ListLoggingConfigurations
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 ListLoggingConfigurations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListLoggingConfigurations)))
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
-> [LoggingConfigurationSummary]
-> ListLoggingConfigurationsResponse
ListLoggingConfigurationsResponse'
            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
"loggingConfigurations"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListLoggingConfigurations where
  hashWithSalt :: Int -> ListLoggingConfigurations -> Int
hashWithSalt Int
_salt ListLoggingConfigurations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListLoggingConfigurations' :: ListLoggingConfigurations -> Maybe Text
$sel:maxResults:ListLoggingConfigurations' :: ListLoggingConfigurations -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListLoggingConfigurations where
  rnf :: ListLoggingConfigurations -> ()
rnf ListLoggingConfigurations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListLoggingConfigurations' :: ListLoggingConfigurations -> Maybe Text
$sel:maxResults:ListLoggingConfigurations' :: ListLoggingConfigurations -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders ListLoggingConfigurations where
  toHeaders :: ListLoggingConfigurations -> 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 ListLoggingConfigurations where
  toJSON :: ListLoggingConfigurations -> Value
toJSON ListLoggingConfigurations' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListLoggingConfigurations' :: ListLoggingConfigurations -> Maybe Text
$sel:maxResults:ListLoggingConfigurations' :: ListLoggingConfigurations -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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 Natural
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 ListLoggingConfigurations where
  toPath :: ListLoggingConfigurations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/ListLoggingConfigurations"

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

-- | /See:/ 'newListLoggingConfigurationsResponse' smart constructor.
data ListLoggingConfigurationsResponse = ListLoggingConfigurationsResponse'
  { -- | If there are more logging configurations than @maxResults@, use
    -- @nextToken@ in the request to get the next set.
    ListLoggingConfigurationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListLoggingConfigurationsResponse -> Int
httpStatus :: Prelude.Int,
    -- | List of the matching logging configurations (summary information only).
    -- There is only one type of destination (@cloudWatchLogs@, @firehose@, or
    -- @s3@) in a @destinationConfiguration@.
    ListLoggingConfigurationsResponse -> [LoggingConfigurationSummary]
loggingConfigurations :: [LoggingConfigurationSummary]
  }
  deriving (ListLoggingConfigurationsResponse
-> ListLoggingConfigurationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListLoggingConfigurationsResponse
-> ListLoggingConfigurationsResponse -> Bool
$c/= :: ListLoggingConfigurationsResponse
-> ListLoggingConfigurationsResponse -> Bool
== :: ListLoggingConfigurationsResponse
-> ListLoggingConfigurationsResponse -> Bool
$c== :: ListLoggingConfigurationsResponse
-> ListLoggingConfigurationsResponse -> Bool
Prelude.Eq, ReadPrec [ListLoggingConfigurationsResponse]
ReadPrec ListLoggingConfigurationsResponse
Int -> ReadS ListLoggingConfigurationsResponse
ReadS [ListLoggingConfigurationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListLoggingConfigurationsResponse]
$creadListPrec :: ReadPrec [ListLoggingConfigurationsResponse]
readPrec :: ReadPrec ListLoggingConfigurationsResponse
$creadPrec :: ReadPrec ListLoggingConfigurationsResponse
readList :: ReadS [ListLoggingConfigurationsResponse]
$creadList :: ReadS [ListLoggingConfigurationsResponse]
readsPrec :: Int -> ReadS ListLoggingConfigurationsResponse
$creadsPrec :: Int -> ReadS ListLoggingConfigurationsResponse
Prelude.Read, Int -> ListLoggingConfigurationsResponse -> ShowS
[ListLoggingConfigurationsResponse] -> ShowS
ListLoggingConfigurationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListLoggingConfigurationsResponse] -> ShowS
$cshowList :: [ListLoggingConfigurationsResponse] -> ShowS
show :: ListLoggingConfigurationsResponse -> String
$cshow :: ListLoggingConfigurationsResponse -> String
showsPrec :: Int -> ListLoggingConfigurationsResponse -> ShowS
$cshowsPrec :: Int -> ListLoggingConfigurationsResponse -> ShowS
Prelude.Show, forall x.
Rep ListLoggingConfigurationsResponse x
-> ListLoggingConfigurationsResponse
forall x.
ListLoggingConfigurationsResponse
-> Rep ListLoggingConfigurationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListLoggingConfigurationsResponse x
-> ListLoggingConfigurationsResponse
$cfrom :: forall x.
ListLoggingConfigurationsResponse
-> Rep ListLoggingConfigurationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListLoggingConfigurationsResponse' 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', 'listLoggingConfigurationsResponse_nextToken' - If there are more logging configurations than @maxResults@, use
-- @nextToken@ in the request to get the next set.
--
-- 'httpStatus', 'listLoggingConfigurationsResponse_httpStatus' - The response's http status code.
--
-- 'loggingConfigurations', 'listLoggingConfigurationsResponse_loggingConfigurations' - List of the matching logging configurations (summary information only).
-- There is only one type of destination (@cloudWatchLogs@, @firehose@, or
-- @s3@) in a @destinationConfiguration@.
newListLoggingConfigurationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListLoggingConfigurationsResponse
newListLoggingConfigurationsResponse :: Int -> ListLoggingConfigurationsResponse
newListLoggingConfigurationsResponse Int
pHttpStatus_ =
  ListLoggingConfigurationsResponse'
    { $sel:nextToken:ListLoggingConfigurationsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListLoggingConfigurationsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:loggingConfigurations:ListLoggingConfigurationsResponse' :: [LoggingConfigurationSummary]
loggingConfigurations = forall a. Monoid a => a
Prelude.mempty
    }

-- | If there are more logging configurations than @maxResults@, use
-- @nextToken@ in the request to get the next set.
listLoggingConfigurationsResponse_nextToken :: Lens.Lens' ListLoggingConfigurationsResponse (Prelude.Maybe Prelude.Text)
listLoggingConfigurationsResponse_nextToken :: Lens' ListLoggingConfigurationsResponse (Maybe Text)
listLoggingConfigurationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLoggingConfigurationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListLoggingConfigurationsResponse' :: ListLoggingConfigurationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListLoggingConfigurationsResponse
s@ListLoggingConfigurationsResponse' {} Maybe Text
a -> ListLoggingConfigurationsResponse
s {$sel:nextToken:ListLoggingConfigurationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListLoggingConfigurationsResponse)

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

-- | List of the matching logging configurations (summary information only).
-- There is only one type of destination (@cloudWatchLogs@, @firehose@, or
-- @s3@) in a @destinationConfiguration@.
listLoggingConfigurationsResponse_loggingConfigurations :: Lens.Lens' ListLoggingConfigurationsResponse [LoggingConfigurationSummary]
listLoggingConfigurationsResponse_loggingConfigurations :: Lens'
  ListLoggingConfigurationsResponse [LoggingConfigurationSummary]
listLoggingConfigurationsResponse_loggingConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListLoggingConfigurationsResponse' {[LoggingConfigurationSummary]
loggingConfigurations :: [LoggingConfigurationSummary]
$sel:loggingConfigurations:ListLoggingConfigurationsResponse' :: ListLoggingConfigurationsResponse -> [LoggingConfigurationSummary]
loggingConfigurations} -> [LoggingConfigurationSummary]
loggingConfigurations) (\s :: ListLoggingConfigurationsResponse
s@ListLoggingConfigurationsResponse' {} [LoggingConfigurationSummary]
a -> ListLoggingConfigurationsResponse
s {$sel:loggingConfigurations:ListLoggingConfigurationsResponse' :: [LoggingConfigurationSummary]
loggingConfigurations = [LoggingConfigurationSummary]
a} :: ListLoggingConfigurationsResponse) 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
    ListLoggingConfigurationsResponse
  where
  rnf :: ListLoggingConfigurationsResponse -> ()
rnf ListLoggingConfigurationsResponse' {Int
[LoggingConfigurationSummary]
Maybe Text
loggingConfigurations :: [LoggingConfigurationSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:loggingConfigurations:ListLoggingConfigurationsResponse' :: ListLoggingConfigurationsResponse -> [LoggingConfigurationSummary]
$sel:httpStatus:ListLoggingConfigurationsResponse' :: ListLoggingConfigurationsResponse -> Int
$sel:nextToken:ListLoggingConfigurationsResponse' :: ListLoggingConfigurationsResponse -> 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 [LoggingConfigurationSummary]
loggingConfigurations