{-# 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.EC2.DescribeFlowLogs
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes one or more flow logs.
--
-- To view the published flow log records, you must view the log
-- destination. For example, the CloudWatch Logs log group, the Amazon S3
-- bucket, or the Kinesis Data Firehose delivery stream.
--
-- This operation returns paginated results.
module Amazonka.EC2.DescribeFlowLogs
  ( -- * Creating a Request
    DescribeFlowLogs (..),
    newDescribeFlowLogs,

    -- * Request Lenses
    describeFlowLogs_dryRun,
    describeFlowLogs_filter,
    describeFlowLogs_flowLogIds,
    describeFlowLogs_maxResults,
    describeFlowLogs_nextToken,

    -- * Destructuring the Response
    DescribeFlowLogsResponse (..),
    newDescribeFlowLogsResponse,

    -- * Response Lenses
    describeFlowLogsResponse_flowLogs,
    describeFlowLogsResponse_nextToken,
    describeFlowLogsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeFlowLogs' smart constructor.
data DescribeFlowLogs = DescribeFlowLogs'
  { -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    DescribeFlowLogs -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters.
    --
    -- -   @deliver-log-status@ - The status of the logs delivery (@SUCCESS@ |
    --     @FAILED@).
    --
    -- -   @log-destination-type@ - The type of destination for the flow log
    --     data (@cloud-watch-logs@ | @s3@ | @kinesis-data-firehose@).
    --
    -- -   @flow-log-id@ - The ID of the flow log.
    --
    -- -   @log-group-name@ - The name of the log group.
    --
    -- -   @resource-id@ - The ID of the VPC, subnet, or network interface.
    --
    -- -   @traffic-type@ - The type of traffic (@ACCEPT@ | @REJECT@ | @ALL@).
    --
    -- -   @tag@:\<key> - The key\/value combination of a tag assigned to the
    --     resource. Use the tag key in the filter name and the tag value as
    --     the filter value. For example, to find all resources that have a tag
    --     with the key @Owner@ and the value @TeamA@, specify @tag:Owner@ for
    --     the filter name and @TeamA@ for the filter value.
    --
    -- -   @tag-key@ - The key of a tag assigned to the resource. Use this
    --     filter to find all resources assigned a tag with a specific key,
    --     regardless of the tag value.
    DescribeFlowLogs -> Maybe [Filter]
filter' :: Prelude.Maybe [Filter],
    -- | One or more flow log IDs.
    --
    -- Constraint: Maximum of 1000 flow log IDs.
    DescribeFlowLogs -> Maybe [Text]
flowLogIds :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of results to return with a single call. To retrieve
    -- the remaining results, make another call with the returned @nextToken@
    -- value.
    DescribeFlowLogs -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The token for the next page of results.
    DescribeFlowLogs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeFlowLogs -> DescribeFlowLogs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFlowLogs -> DescribeFlowLogs -> Bool
$c/= :: DescribeFlowLogs -> DescribeFlowLogs -> Bool
== :: DescribeFlowLogs -> DescribeFlowLogs -> Bool
$c== :: DescribeFlowLogs -> DescribeFlowLogs -> Bool
Prelude.Eq, ReadPrec [DescribeFlowLogs]
ReadPrec DescribeFlowLogs
Int -> ReadS DescribeFlowLogs
ReadS [DescribeFlowLogs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFlowLogs]
$creadListPrec :: ReadPrec [DescribeFlowLogs]
readPrec :: ReadPrec DescribeFlowLogs
$creadPrec :: ReadPrec DescribeFlowLogs
readList :: ReadS [DescribeFlowLogs]
$creadList :: ReadS [DescribeFlowLogs]
readsPrec :: Int -> ReadS DescribeFlowLogs
$creadsPrec :: Int -> ReadS DescribeFlowLogs
Prelude.Read, Int -> DescribeFlowLogs -> ShowS
[DescribeFlowLogs] -> ShowS
DescribeFlowLogs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFlowLogs] -> ShowS
$cshowList :: [DescribeFlowLogs] -> ShowS
show :: DescribeFlowLogs -> String
$cshow :: DescribeFlowLogs -> String
showsPrec :: Int -> DescribeFlowLogs -> ShowS
$cshowsPrec :: Int -> DescribeFlowLogs -> ShowS
Prelude.Show, forall x. Rep DescribeFlowLogs x -> DescribeFlowLogs
forall x. DescribeFlowLogs -> Rep DescribeFlowLogs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFlowLogs x -> DescribeFlowLogs
$cfrom :: forall x. DescribeFlowLogs -> Rep DescribeFlowLogs x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFlowLogs' 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:
--
-- 'dryRun', 'describeFlowLogs_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'filter'', 'describeFlowLogs_filter' - One or more filters.
--
-- -   @deliver-log-status@ - The status of the logs delivery (@SUCCESS@ |
--     @FAILED@).
--
-- -   @log-destination-type@ - The type of destination for the flow log
--     data (@cloud-watch-logs@ | @s3@ | @kinesis-data-firehose@).
--
-- -   @flow-log-id@ - The ID of the flow log.
--
-- -   @log-group-name@ - The name of the log group.
--
-- -   @resource-id@ - The ID of the VPC, subnet, or network interface.
--
-- -   @traffic-type@ - The type of traffic (@ACCEPT@ | @REJECT@ | @ALL@).
--
-- -   @tag@:\<key> - The key\/value combination of a tag assigned to the
--     resource. Use the tag key in the filter name and the tag value as
--     the filter value. For example, to find all resources that have a tag
--     with the key @Owner@ and the value @TeamA@, specify @tag:Owner@ for
--     the filter name and @TeamA@ for the filter value.
--
-- -   @tag-key@ - The key of a tag assigned to the resource. Use this
--     filter to find all resources assigned a tag with a specific key,
--     regardless of the tag value.
--
-- 'flowLogIds', 'describeFlowLogs_flowLogIds' - One or more flow log IDs.
--
-- Constraint: Maximum of 1000 flow log IDs.
--
-- 'maxResults', 'describeFlowLogs_maxResults' - The maximum number of results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
--
-- 'nextToken', 'describeFlowLogs_nextToken' - The token for the next page of results.
newDescribeFlowLogs ::
  DescribeFlowLogs
newDescribeFlowLogs :: DescribeFlowLogs
newDescribeFlowLogs =
  DescribeFlowLogs'
    { $sel:dryRun:DescribeFlowLogs' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:filter':DescribeFlowLogs' :: Maybe [Filter]
filter' = forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogIds:DescribeFlowLogs' :: Maybe [Text]
flowLogIds = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeFlowLogs' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeFlowLogs' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
describeFlowLogs_dryRun :: Lens.Lens' DescribeFlowLogs (Prelude.Maybe Prelude.Bool)
describeFlowLogs_dryRun :: Lens' DescribeFlowLogs (Maybe Bool)
describeFlowLogs_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowLogs' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DescribeFlowLogs
s@DescribeFlowLogs' {} Maybe Bool
a -> DescribeFlowLogs
s {$sel:dryRun:DescribeFlowLogs' :: Maybe Bool
dryRun = Maybe Bool
a} :: DescribeFlowLogs)

-- | One or more filters.
--
-- -   @deliver-log-status@ - The status of the logs delivery (@SUCCESS@ |
--     @FAILED@).
--
-- -   @log-destination-type@ - The type of destination for the flow log
--     data (@cloud-watch-logs@ | @s3@ | @kinesis-data-firehose@).
--
-- -   @flow-log-id@ - The ID of the flow log.
--
-- -   @log-group-name@ - The name of the log group.
--
-- -   @resource-id@ - The ID of the VPC, subnet, or network interface.
--
-- -   @traffic-type@ - The type of traffic (@ACCEPT@ | @REJECT@ | @ALL@).
--
-- -   @tag@:\<key> - The key\/value combination of a tag assigned to the
--     resource. Use the tag key in the filter name and the tag value as
--     the filter value. For example, to find all resources that have a tag
--     with the key @Owner@ and the value @TeamA@, specify @tag:Owner@ for
--     the filter name and @TeamA@ for the filter value.
--
-- -   @tag-key@ - The key of a tag assigned to the resource. Use this
--     filter to find all resources assigned a tag with a specific key,
--     regardless of the tag value.
describeFlowLogs_filter :: Lens.Lens' DescribeFlowLogs (Prelude.Maybe [Filter])
describeFlowLogs_filter :: Lens' DescribeFlowLogs (Maybe [Filter])
describeFlowLogs_filter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowLogs' {Maybe [Filter]
filter' :: Maybe [Filter]
$sel:filter':DescribeFlowLogs' :: DescribeFlowLogs -> Maybe [Filter]
filter'} -> Maybe [Filter]
filter') (\s :: DescribeFlowLogs
s@DescribeFlowLogs' {} Maybe [Filter]
a -> DescribeFlowLogs
s {$sel:filter':DescribeFlowLogs' :: Maybe [Filter]
filter' = Maybe [Filter]
a} :: DescribeFlowLogs) 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

-- | One or more flow log IDs.
--
-- Constraint: Maximum of 1000 flow log IDs.
describeFlowLogs_flowLogIds :: Lens.Lens' DescribeFlowLogs (Prelude.Maybe [Prelude.Text])
describeFlowLogs_flowLogIds :: Lens' DescribeFlowLogs (Maybe [Text])
describeFlowLogs_flowLogIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowLogs' {Maybe [Text]
flowLogIds :: Maybe [Text]
$sel:flowLogIds:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe [Text]
flowLogIds} -> Maybe [Text]
flowLogIds) (\s :: DescribeFlowLogs
s@DescribeFlowLogs' {} Maybe [Text]
a -> DescribeFlowLogs
s {$sel:flowLogIds:DescribeFlowLogs' :: Maybe [Text]
flowLogIds = Maybe [Text]
a} :: DescribeFlowLogs) 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 results to return with a single call. To retrieve
-- the remaining results, make another call with the returned @nextToken@
-- value.
describeFlowLogs_maxResults :: Lens.Lens' DescribeFlowLogs (Prelude.Maybe Prelude.Int)
describeFlowLogs_maxResults :: Lens' DescribeFlowLogs (Maybe Int)
describeFlowLogs_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowLogs' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeFlowLogs
s@DescribeFlowLogs' {} Maybe Int
a -> DescribeFlowLogs
s {$sel:maxResults:DescribeFlowLogs' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeFlowLogs)

-- | The token for the next page of results.
describeFlowLogs_nextToken :: Lens.Lens' DescribeFlowLogs (Prelude.Maybe Prelude.Text)
describeFlowLogs_nextToken :: Lens' DescribeFlowLogs (Maybe Text)
describeFlowLogs_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowLogs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeFlowLogs
s@DescribeFlowLogs' {} Maybe Text
a -> DescribeFlowLogs
s {$sel:nextToken:DescribeFlowLogs' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeFlowLogs)

instance Core.AWSPager DescribeFlowLogs where
  page :: DescribeFlowLogs
-> AWSResponse DescribeFlowLogs -> Maybe DescribeFlowLogs
page DescribeFlowLogs
rq AWSResponse DescribeFlowLogs
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeFlowLogs
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeFlowLogsResponse (Maybe Text)
describeFlowLogsResponse_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 DescribeFlowLogs
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeFlowLogsResponse (Maybe [FlowLog])
describeFlowLogsResponse_flowLogs
            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
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ DescribeFlowLogs
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeFlowLogs (Maybe Text)
describeFlowLogs_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeFlowLogs
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeFlowLogsResponse (Maybe Text)
describeFlowLogsResponse_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 DescribeFlowLogs where
  type
    AWSResponse DescribeFlowLogs =
      DescribeFlowLogsResponse
  request :: (Service -> Service)
-> DescribeFlowLogs -> Request DescribeFlowLogs
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeFlowLogs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeFlowLogs)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [FlowLog] -> Maybe Text -> Int -> DescribeFlowLogsResponse
DescribeFlowLogsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"flowLogSet"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"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))
      )

instance Prelude.Hashable DescribeFlowLogs where
  hashWithSalt :: Int -> DescribeFlowLogs -> Int
hashWithSalt Int
_salt DescribeFlowLogs' {Maybe Bool
Maybe Int
Maybe [Text]
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
flowLogIds :: Maybe [Text]
filter' :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:nextToken:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Text
$sel:maxResults:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Int
$sel:flowLogIds:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe [Text]
$sel:filter':DescribeFlowLogs' :: DescribeFlowLogs -> Maybe [Filter]
$sel:dryRun:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filter'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
flowLogIds
      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 DescribeFlowLogs where
  rnf :: DescribeFlowLogs -> ()
rnf DescribeFlowLogs' {Maybe Bool
Maybe Int
Maybe [Text]
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
flowLogIds :: Maybe [Text]
filter' :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:nextToken:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Text
$sel:maxResults:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Int
$sel:flowLogIds:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe [Text]
$sel:filter':DescribeFlowLogs' :: DescribeFlowLogs -> Maybe [Filter]
$sel:dryRun:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Filter]
filter'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
flowLogIds
      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 DescribeFlowLogs where
  toHeaders :: DescribeFlowLogs -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DescribeFlowLogs where
  toQuery :: DescribeFlowLogs -> QueryString
toQuery DescribeFlowLogs' {Maybe Bool
Maybe Int
Maybe [Text]
Maybe [Filter]
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Int
flowLogIds :: Maybe [Text]
filter' :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:nextToken:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Text
$sel:maxResults:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Int
$sel:flowLogIds:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe [Text]
$sel:filter':DescribeFlowLogs' :: DescribeFlowLogs -> Maybe [Filter]
$sel:dryRun:DescribeFlowLogs' :: DescribeFlowLogs -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DescribeFlowLogs" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"Filter" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filter'),
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"FlowLogId"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
flowLogIds
          ),
        ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
      ]

-- | /See:/ 'newDescribeFlowLogsResponse' smart constructor.
data DescribeFlowLogsResponse = DescribeFlowLogsResponse'
  { -- | Information about the flow logs.
    DescribeFlowLogsResponse -> Maybe [FlowLog]
flowLogs :: Prelude.Maybe [FlowLog],
    -- | The token to use to retrieve the next page of results. This value is
    -- @null@ when there are no more results to return.
    DescribeFlowLogsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeFlowLogsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeFlowLogsResponse -> DescribeFlowLogsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFlowLogsResponse -> DescribeFlowLogsResponse -> Bool
$c/= :: DescribeFlowLogsResponse -> DescribeFlowLogsResponse -> Bool
== :: DescribeFlowLogsResponse -> DescribeFlowLogsResponse -> Bool
$c== :: DescribeFlowLogsResponse -> DescribeFlowLogsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeFlowLogsResponse]
ReadPrec DescribeFlowLogsResponse
Int -> ReadS DescribeFlowLogsResponse
ReadS [DescribeFlowLogsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFlowLogsResponse]
$creadListPrec :: ReadPrec [DescribeFlowLogsResponse]
readPrec :: ReadPrec DescribeFlowLogsResponse
$creadPrec :: ReadPrec DescribeFlowLogsResponse
readList :: ReadS [DescribeFlowLogsResponse]
$creadList :: ReadS [DescribeFlowLogsResponse]
readsPrec :: Int -> ReadS DescribeFlowLogsResponse
$creadsPrec :: Int -> ReadS DescribeFlowLogsResponse
Prelude.Read, Int -> DescribeFlowLogsResponse -> ShowS
[DescribeFlowLogsResponse] -> ShowS
DescribeFlowLogsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFlowLogsResponse] -> ShowS
$cshowList :: [DescribeFlowLogsResponse] -> ShowS
show :: DescribeFlowLogsResponse -> String
$cshow :: DescribeFlowLogsResponse -> String
showsPrec :: Int -> DescribeFlowLogsResponse -> ShowS
$cshowsPrec :: Int -> DescribeFlowLogsResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeFlowLogsResponse x -> DescribeFlowLogsResponse
forall x.
DescribeFlowLogsResponse -> Rep DescribeFlowLogsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeFlowLogsResponse x -> DescribeFlowLogsResponse
$cfrom :: forall x.
DescribeFlowLogsResponse -> Rep DescribeFlowLogsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFlowLogsResponse' 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:
--
-- 'flowLogs', 'describeFlowLogsResponse_flowLogs' - Information about the flow logs.
--
-- 'nextToken', 'describeFlowLogsResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'httpStatus', 'describeFlowLogsResponse_httpStatus' - The response's http status code.
newDescribeFlowLogsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeFlowLogsResponse
newDescribeFlowLogsResponse :: Int -> DescribeFlowLogsResponse
newDescribeFlowLogsResponse Int
pHttpStatus_ =
  DescribeFlowLogsResponse'
    { $sel:flowLogs:DescribeFlowLogsResponse' :: Maybe [FlowLog]
flowLogs =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeFlowLogsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeFlowLogsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the flow logs.
describeFlowLogsResponse_flowLogs :: Lens.Lens' DescribeFlowLogsResponse (Prelude.Maybe [FlowLog])
describeFlowLogsResponse_flowLogs :: Lens' DescribeFlowLogsResponse (Maybe [FlowLog])
describeFlowLogsResponse_flowLogs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowLogsResponse' {Maybe [FlowLog]
flowLogs :: Maybe [FlowLog]
$sel:flowLogs:DescribeFlowLogsResponse' :: DescribeFlowLogsResponse -> Maybe [FlowLog]
flowLogs} -> Maybe [FlowLog]
flowLogs) (\s :: DescribeFlowLogsResponse
s@DescribeFlowLogsResponse' {} Maybe [FlowLog]
a -> DescribeFlowLogsResponse
s {$sel:flowLogs:DescribeFlowLogsResponse' :: Maybe [FlowLog]
flowLogs = Maybe [FlowLog]
a} :: DescribeFlowLogsResponse) 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 token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
describeFlowLogsResponse_nextToken :: Lens.Lens' DescribeFlowLogsResponse (Prelude.Maybe Prelude.Text)
describeFlowLogsResponse_nextToken :: Lens' DescribeFlowLogsResponse (Maybe Text)
describeFlowLogsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFlowLogsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeFlowLogsResponse' :: DescribeFlowLogsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeFlowLogsResponse
s@DescribeFlowLogsResponse' {} Maybe Text
a -> DescribeFlowLogsResponse
s {$sel:nextToken:DescribeFlowLogsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeFlowLogsResponse)

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

instance Prelude.NFData DescribeFlowLogsResponse where
  rnf :: DescribeFlowLogsResponse -> ()
rnf DescribeFlowLogsResponse' {Int
Maybe [FlowLog]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
flowLogs :: Maybe [FlowLog]
$sel:httpStatus:DescribeFlowLogsResponse' :: DescribeFlowLogsResponse -> Int
$sel:nextToken:DescribeFlowLogsResponse' :: DescribeFlowLogsResponse -> Maybe Text
$sel:flowLogs:DescribeFlowLogsResponse' :: DescribeFlowLogsResponse -> Maybe [FlowLog]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [FlowLog]
flowLogs
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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