{-# 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.CloudWatchLogs.DescribeLogGroups
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the specified log groups. You can list all your log groups or
-- filter the results by prefix. The results are ASCII-sorted by log group
-- name.
--
-- CloudWatch Logs doesn’t support IAM policies that control access to the
-- @DescribeLogGroups@ action by using the @aws:ResourceTag\/key-name @
-- condition key. Other CloudWatch Logs actions do support the use of the
-- @aws:ResourceTag\/key-name @ condition key to control access. For more
-- information about using tags to control access, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html Controlling access to Amazon Web Services resources using tags>.
--
-- This operation returns paginated results.
module Amazonka.CloudWatchLogs.DescribeLogGroups
  ( -- * Creating a Request
    DescribeLogGroups (..),
    newDescribeLogGroups,

    -- * Request Lenses
    describeLogGroups_logGroupNamePrefix,
    describeLogGroups_nextToken,
    describeLogGroups_limit,

    -- * Destructuring the Response
    DescribeLogGroupsResponse (..),
    newDescribeLogGroupsResponse,

    -- * Response Lenses
    describeLogGroupsResponse_logGroups,
    describeLogGroupsResponse_nextToken,
    describeLogGroupsResponse_httpStatus,
  )
where

import Amazonka.CloudWatchLogs.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeLogGroups' smart constructor.
data DescribeLogGroups = DescribeLogGroups'
  { -- | The prefix to match.
    DescribeLogGroups -> Maybe Text
logGroupNamePrefix :: Prelude.Maybe Prelude.Text,
    -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeLogGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items returned. If you don\'t specify a value, the
    -- default is up to 50 items.
    DescribeLogGroups -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeLogGroups -> DescribeLogGroups -> Bool
(DescribeLogGroups -> DescribeLogGroups -> Bool)
-> (DescribeLogGroups -> DescribeLogGroups -> Bool)
-> Eq DescribeLogGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLogGroups -> DescribeLogGroups -> Bool
$c/= :: DescribeLogGroups -> DescribeLogGroups -> Bool
== :: DescribeLogGroups -> DescribeLogGroups -> Bool
$c== :: DescribeLogGroups -> DescribeLogGroups -> Bool
Prelude.Eq, ReadPrec [DescribeLogGroups]
ReadPrec DescribeLogGroups
Int -> ReadS DescribeLogGroups
ReadS [DescribeLogGroups]
(Int -> ReadS DescribeLogGroups)
-> ReadS [DescribeLogGroups]
-> ReadPrec DescribeLogGroups
-> ReadPrec [DescribeLogGroups]
-> Read DescribeLogGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLogGroups]
$creadListPrec :: ReadPrec [DescribeLogGroups]
readPrec :: ReadPrec DescribeLogGroups
$creadPrec :: ReadPrec DescribeLogGroups
readList :: ReadS [DescribeLogGroups]
$creadList :: ReadS [DescribeLogGroups]
readsPrec :: Int -> ReadS DescribeLogGroups
$creadsPrec :: Int -> ReadS DescribeLogGroups
Prelude.Read, Int -> DescribeLogGroups -> ShowS
[DescribeLogGroups] -> ShowS
DescribeLogGroups -> String
(Int -> DescribeLogGroups -> ShowS)
-> (DescribeLogGroups -> String)
-> ([DescribeLogGroups] -> ShowS)
-> Show DescribeLogGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLogGroups] -> ShowS
$cshowList :: [DescribeLogGroups] -> ShowS
show :: DescribeLogGroups -> String
$cshow :: DescribeLogGroups -> String
showsPrec :: Int -> DescribeLogGroups -> ShowS
$cshowsPrec :: Int -> DescribeLogGroups -> ShowS
Prelude.Show, (forall x. DescribeLogGroups -> Rep DescribeLogGroups x)
-> (forall x. Rep DescribeLogGroups x -> DescribeLogGroups)
-> Generic DescribeLogGroups
forall x. Rep DescribeLogGroups x -> DescribeLogGroups
forall x. DescribeLogGroups -> Rep DescribeLogGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeLogGroups x -> DescribeLogGroups
$cfrom :: forall x. DescribeLogGroups -> Rep DescribeLogGroups x
Prelude.Generic)

-- |
-- Create a value of 'DescribeLogGroups' 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:
--
-- 'logGroupNamePrefix', 'describeLogGroups_logGroupNamePrefix' - The prefix to match.
--
-- 'nextToken', 'describeLogGroups_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'limit', 'describeLogGroups_limit' - The maximum number of items returned. If you don\'t specify a value, the
-- default is up to 50 items.
newDescribeLogGroups ::
  DescribeLogGroups
newDescribeLogGroups :: DescribeLogGroups
newDescribeLogGroups =
  DescribeLogGroups' :: Maybe Text -> Maybe Text -> Maybe Natural -> DescribeLogGroups
DescribeLogGroups'
    { $sel:logGroupNamePrefix:DescribeLogGroups' :: Maybe Text
logGroupNamePrefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeLogGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeLogGroups' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The prefix to match.
describeLogGroups_logGroupNamePrefix :: Lens.Lens' DescribeLogGroups (Prelude.Maybe Prelude.Text)
describeLogGroups_logGroupNamePrefix :: (Maybe Text -> f (Maybe Text))
-> DescribeLogGroups -> f DescribeLogGroups
describeLogGroups_logGroupNamePrefix = (DescribeLogGroups -> Maybe Text)
-> (DescribeLogGroups -> Maybe Text -> DescribeLogGroups)
-> Lens
     DescribeLogGroups DescribeLogGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLogGroups' {Maybe Text
logGroupNamePrefix :: Maybe Text
$sel:logGroupNamePrefix:DescribeLogGroups' :: DescribeLogGroups -> Maybe Text
logGroupNamePrefix} -> Maybe Text
logGroupNamePrefix) (\s :: DescribeLogGroups
s@DescribeLogGroups' {} Maybe Text
a -> DescribeLogGroups
s {$sel:logGroupNamePrefix:DescribeLogGroups' :: Maybe Text
logGroupNamePrefix = Maybe Text
a} :: DescribeLogGroups)

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
describeLogGroups_nextToken :: Lens.Lens' DescribeLogGroups (Prelude.Maybe Prelude.Text)
describeLogGroups_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeLogGroups -> f DescribeLogGroups
describeLogGroups_nextToken = (DescribeLogGroups -> Maybe Text)
-> (DescribeLogGroups -> Maybe Text -> DescribeLogGroups)
-> Lens
     DescribeLogGroups DescribeLogGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLogGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeLogGroups' :: DescribeLogGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeLogGroups
s@DescribeLogGroups' {} Maybe Text
a -> DescribeLogGroups
s {$sel:nextToken:DescribeLogGroups' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeLogGroups)

-- | The maximum number of items returned. If you don\'t specify a value, the
-- default is up to 50 items.
describeLogGroups_limit :: Lens.Lens' DescribeLogGroups (Prelude.Maybe Prelude.Natural)
describeLogGroups_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeLogGroups -> f DescribeLogGroups
describeLogGroups_limit = (DescribeLogGroups -> Maybe Natural)
-> (DescribeLogGroups -> Maybe Natural -> DescribeLogGroups)
-> Lens
     DescribeLogGroups DescribeLogGroups (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLogGroups' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeLogGroups' :: DescribeLogGroups -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeLogGroups
s@DescribeLogGroups' {} Maybe Natural
a -> DescribeLogGroups
s {$sel:limit:DescribeLogGroups' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeLogGroups)

instance Core.AWSPager DescribeLogGroups where
  page :: DescribeLogGroups
-> AWSResponse DescribeLogGroups -> Maybe DescribeLogGroups
page DescribeLogGroups
rq AWSResponse DescribeLogGroups
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeLogGroups
DescribeLogGroupsResponse
rs
            DescribeLogGroupsResponse
-> Getting (First Text) DescribeLogGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeLogGroupsResponse
-> Const (First Text) DescribeLogGroupsResponse
Lens' DescribeLogGroupsResponse (Maybe Text)
describeLogGroupsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeLogGroupsResponse
 -> Const (First Text) DescribeLogGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeLogGroupsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeLogGroups
forall a. Maybe a
Prelude.Nothing
    | Maybe [LogGroup] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeLogGroups
DescribeLogGroupsResponse
rs
            DescribeLogGroupsResponse
-> Getting (First [LogGroup]) DescribeLogGroupsResponse [LogGroup]
-> Maybe [LogGroup]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [LogGroup] -> Const (First [LogGroup]) (Maybe [LogGroup]))
-> DescribeLogGroupsResponse
-> Const (First [LogGroup]) DescribeLogGroupsResponse
Lens' DescribeLogGroupsResponse (Maybe [LogGroup])
describeLogGroupsResponse_logGroups
              ((Maybe [LogGroup] -> Const (First [LogGroup]) (Maybe [LogGroup]))
 -> DescribeLogGroupsResponse
 -> Const (First [LogGroup]) DescribeLogGroupsResponse)
-> (([LogGroup] -> Const (First [LogGroup]) [LogGroup])
    -> Maybe [LogGroup] -> Const (First [LogGroup]) (Maybe [LogGroup]))
-> Getting (First [LogGroup]) DescribeLogGroupsResponse [LogGroup]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LogGroup] -> Const (First [LogGroup]) [LogGroup])
-> Maybe [LogGroup] -> Const (First [LogGroup]) (Maybe [LogGroup])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeLogGroups
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeLogGroups -> Maybe DescribeLogGroups
forall a. a -> Maybe a
Prelude.Just (DescribeLogGroups -> Maybe DescribeLogGroups)
-> DescribeLogGroups -> Maybe DescribeLogGroups
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeLogGroups
rq
          DescribeLogGroups
-> (DescribeLogGroups -> DescribeLogGroups) -> DescribeLogGroups
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeLogGroups -> Identity DescribeLogGroups
Lens DescribeLogGroups DescribeLogGroups (Maybe Text) (Maybe Text)
describeLogGroups_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeLogGroups -> Identity DescribeLogGroups)
-> Maybe Text -> DescribeLogGroups -> DescribeLogGroups
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeLogGroups
DescribeLogGroupsResponse
rs
          DescribeLogGroupsResponse
-> Getting (First Text) DescribeLogGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeLogGroupsResponse
-> Const (First Text) DescribeLogGroupsResponse
Lens' DescribeLogGroupsResponse (Maybe Text)
describeLogGroupsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeLogGroupsResponse
 -> Const (First Text) DescribeLogGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeLogGroupsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeLogGroups where
  type
    AWSResponse DescribeLogGroups =
      DescribeLogGroupsResponse
  request :: DescribeLogGroups -> Request DescribeLogGroups
request = Service -> DescribeLogGroups -> Request DescribeLogGroups
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeLogGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLogGroups)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeLogGroups))
-> Logger
-> Service
-> Proxy DescribeLogGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeLogGroups)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [LogGroup] -> Maybe Text -> Int -> DescribeLogGroupsResponse
DescribeLogGroupsResponse'
            (Maybe [LogGroup]
 -> Maybe Text -> Int -> DescribeLogGroupsResponse)
-> Either String (Maybe [LogGroup])
-> Either String (Maybe Text -> Int -> DescribeLogGroupsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [LogGroup]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"logGroups" Either String (Maybe (Maybe [LogGroup]))
-> Maybe [LogGroup] -> Either String (Maybe [LogGroup])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [LogGroup]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> DescribeLogGroupsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeLogGroupsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Int -> DescribeLogGroupsResponse)
-> Either String Int -> Either String DescribeLogGroupsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeLogGroups

instance Prelude.NFData DescribeLogGroups

instance Core.ToHeaders DescribeLogGroups where
  toHeaders :: DescribeLogGroups -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeLogGroups -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Logs_20140328.DescribeLogGroups" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DescribeLogGroups where
  toJSON :: DescribeLogGroups -> Value
toJSON DescribeLogGroups' {Maybe Natural
Maybe Text
limit :: Maybe Natural
nextToken :: Maybe Text
logGroupNamePrefix :: Maybe Text
$sel:limit:DescribeLogGroups' :: DescribeLogGroups -> Maybe Natural
$sel:nextToken:DescribeLogGroups' :: DescribeLogGroups -> Maybe Text
$sel:logGroupNamePrefix:DescribeLogGroups' :: DescribeLogGroups -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"logGroupNamePrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
logGroupNamePrefix,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit
          ]
      )

instance Core.ToPath DescribeLogGroups where
  toPath :: DescribeLogGroups -> ByteString
toPath = ByteString -> DescribeLogGroups -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDescribeLogGroupsResponse' smart constructor.
data DescribeLogGroupsResponse = DescribeLogGroupsResponse'
  { -- | The log groups.
    --
    -- If the @retentionInDays@ value if not included for a log group, then
    -- that log group is set to have its events never expire.
    DescribeLogGroupsResponse -> Maybe [LogGroup]
logGroups :: Prelude.Maybe [LogGroup],
    DescribeLogGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeLogGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeLogGroupsResponse -> DescribeLogGroupsResponse -> Bool
(DescribeLogGroupsResponse -> DescribeLogGroupsResponse -> Bool)
-> (DescribeLogGroupsResponse -> DescribeLogGroupsResponse -> Bool)
-> Eq DescribeLogGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLogGroupsResponse -> DescribeLogGroupsResponse -> Bool
$c/= :: DescribeLogGroupsResponse -> DescribeLogGroupsResponse -> Bool
== :: DescribeLogGroupsResponse -> DescribeLogGroupsResponse -> Bool
$c== :: DescribeLogGroupsResponse -> DescribeLogGroupsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeLogGroupsResponse]
ReadPrec DescribeLogGroupsResponse
Int -> ReadS DescribeLogGroupsResponse
ReadS [DescribeLogGroupsResponse]
(Int -> ReadS DescribeLogGroupsResponse)
-> ReadS [DescribeLogGroupsResponse]
-> ReadPrec DescribeLogGroupsResponse
-> ReadPrec [DescribeLogGroupsResponse]
-> Read DescribeLogGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLogGroupsResponse]
$creadListPrec :: ReadPrec [DescribeLogGroupsResponse]
readPrec :: ReadPrec DescribeLogGroupsResponse
$creadPrec :: ReadPrec DescribeLogGroupsResponse
readList :: ReadS [DescribeLogGroupsResponse]
$creadList :: ReadS [DescribeLogGroupsResponse]
readsPrec :: Int -> ReadS DescribeLogGroupsResponse
$creadsPrec :: Int -> ReadS DescribeLogGroupsResponse
Prelude.Read, Int -> DescribeLogGroupsResponse -> ShowS
[DescribeLogGroupsResponse] -> ShowS
DescribeLogGroupsResponse -> String
(Int -> DescribeLogGroupsResponse -> ShowS)
-> (DescribeLogGroupsResponse -> String)
-> ([DescribeLogGroupsResponse] -> ShowS)
-> Show DescribeLogGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLogGroupsResponse] -> ShowS
$cshowList :: [DescribeLogGroupsResponse] -> ShowS
show :: DescribeLogGroupsResponse -> String
$cshow :: DescribeLogGroupsResponse -> String
showsPrec :: Int -> DescribeLogGroupsResponse -> ShowS
$cshowsPrec :: Int -> DescribeLogGroupsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeLogGroupsResponse -> Rep DescribeLogGroupsResponse x)
-> (forall x.
    Rep DescribeLogGroupsResponse x -> DescribeLogGroupsResponse)
-> Generic DescribeLogGroupsResponse
forall x.
Rep DescribeLogGroupsResponse x -> DescribeLogGroupsResponse
forall x.
DescribeLogGroupsResponse -> Rep DescribeLogGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeLogGroupsResponse x -> DescribeLogGroupsResponse
$cfrom :: forall x.
DescribeLogGroupsResponse -> Rep DescribeLogGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeLogGroupsResponse' 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:
--
-- 'logGroups', 'describeLogGroupsResponse_logGroups' - The log groups.
--
-- If the @retentionInDays@ value if not included for a log group, then
-- that log group is set to have its events never expire.
--
-- 'nextToken', 'describeLogGroupsResponse_nextToken' - Undocumented member.
--
-- 'httpStatus', 'describeLogGroupsResponse_httpStatus' - The response's http status code.
newDescribeLogGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeLogGroupsResponse
newDescribeLogGroupsResponse :: Int -> DescribeLogGroupsResponse
newDescribeLogGroupsResponse Int
pHttpStatus_ =
  DescribeLogGroupsResponse' :: Maybe [LogGroup] -> Maybe Text -> Int -> DescribeLogGroupsResponse
DescribeLogGroupsResponse'
    { $sel:logGroups:DescribeLogGroupsResponse' :: Maybe [LogGroup]
logGroups =
        Maybe [LogGroup]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeLogGroupsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeLogGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The log groups.
--
-- If the @retentionInDays@ value if not included for a log group, then
-- that log group is set to have its events never expire.
describeLogGroupsResponse_logGroups :: Lens.Lens' DescribeLogGroupsResponse (Prelude.Maybe [LogGroup])
describeLogGroupsResponse_logGroups :: (Maybe [LogGroup] -> f (Maybe [LogGroup]))
-> DescribeLogGroupsResponse -> f DescribeLogGroupsResponse
describeLogGroupsResponse_logGroups = (DescribeLogGroupsResponse -> Maybe [LogGroup])
-> (DescribeLogGroupsResponse
    -> Maybe [LogGroup] -> DescribeLogGroupsResponse)
-> Lens' DescribeLogGroupsResponse (Maybe [LogGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLogGroupsResponse' {Maybe [LogGroup]
logGroups :: Maybe [LogGroup]
$sel:logGroups:DescribeLogGroupsResponse' :: DescribeLogGroupsResponse -> Maybe [LogGroup]
logGroups} -> Maybe [LogGroup]
logGroups) (\s :: DescribeLogGroupsResponse
s@DescribeLogGroupsResponse' {} Maybe [LogGroup]
a -> DescribeLogGroupsResponse
s {$sel:logGroups:DescribeLogGroupsResponse' :: Maybe [LogGroup]
logGroups = Maybe [LogGroup]
a} :: DescribeLogGroupsResponse) ((Maybe [LogGroup] -> f (Maybe [LogGroup]))
 -> DescribeLogGroupsResponse -> f DescribeLogGroupsResponse)
-> ((Maybe [LogGroup] -> f (Maybe [LogGroup]))
    -> Maybe [LogGroup] -> f (Maybe [LogGroup]))
-> (Maybe [LogGroup] -> f (Maybe [LogGroup]))
-> DescribeLogGroupsResponse
-> f DescribeLogGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [LogGroup] [LogGroup] [LogGroup] [LogGroup]
-> Iso
     (Maybe [LogGroup])
     (Maybe [LogGroup])
     (Maybe [LogGroup])
     (Maybe [LogGroup])
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 AnIso [LogGroup] [LogGroup] [LogGroup] [LogGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
describeLogGroupsResponse_nextToken :: Lens.Lens' DescribeLogGroupsResponse (Prelude.Maybe Prelude.Text)
describeLogGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeLogGroupsResponse -> f DescribeLogGroupsResponse
describeLogGroupsResponse_nextToken = (DescribeLogGroupsResponse -> Maybe Text)
-> (DescribeLogGroupsResponse
    -> Maybe Text -> DescribeLogGroupsResponse)
-> Lens' DescribeLogGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLogGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeLogGroupsResponse' :: DescribeLogGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeLogGroupsResponse
s@DescribeLogGroupsResponse' {} Maybe Text
a -> DescribeLogGroupsResponse
s {$sel:nextToken:DescribeLogGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeLogGroupsResponse)

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

instance Prelude.NFData DescribeLogGroupsResponse