{-# 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.DescribeTrafficMirrorSessions
-- 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 Traffic Mirror sessions. By default, all Traffic
-- Mirror sessions are described. Alternatively, you can filter the
-- results.
--
-- This operation returns paginated results.
module Amazonka.EC2.DescribeTrafficMirrorSessions
  ( -- * Creating a Request
    DescribeTrafficMirrorSessions (..),
    newDescribeTrafficMirrorSessions,

    -- * Request Lenses
    describeTrafficMirrorSessions_dryRun,
    describeTrafficMirrorSessions_filters,
    describeTrafficMirrorSessions_maxResults,
    describeTrafficMirrorSessions_nextToken,
    describeTrafficMirrorSessions_trafficMirrorSessionIds,

    -- * Destructuring the Response
    DescribeTrafficMirrorSessionsResponse (..),
    newDescribeTrafficMirrorSessionsResponse,

    -- * Response Lenses
    describeTrafficMirrorSessionsResponse_nextToken,
    describeTrafficMirrorSessionsResponse_trafficMirrorSessions,
    describeTrafficMirrorSessionsResponse_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:/ 'newDescribeTrafficMirrorSessions' smart constructor.
data DescribeTrafficMirrorSessions = DescribeTrafficMirrorSessions'
  { -- | 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@.
    DescribeTrafficMirrorSessions -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters. The possible values are:
    --
    -- -   @description@: The Traffic Mirror session description.
    --
    -- -   @network-interface-id@: The ID of the Traffic Mirror session network
    --     interface.
    --
    -- -   @owner-id@: The ID of the account that owns the Traffic Mirror
    --     session.
    --
    -- -   @packet-length@: The assigned number of packets to mirror.
    --
    -- -   @session-number@: The assigned session number.
    --
    -- -   @traffic-mirror-filter-id@: The ID of the Traffic Mirror filter.
    --
    -- -   @traffic-mirror-session-id@: The ID of the Traffic Mirror session.
    --
    -- -   @traffic-mirror-target-id@: The ID of the Traffic Mirror target.
    --
    -- -   @virtual-network-id@: The virtual network ID of the Traffic Mirror
    --     session.
    DescribeTrafficMirrorSessions -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The maximum number of results to return with a single call. To retrieve
    -- the remaining results, make another call with the returned @nextToken@
    -- value.
    DescribeTrafficMirrorSessions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next page of results.
    DescribeTrafficMirrorSessions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Traffic Mirror session.
    DescribeTrafficMirrorSessions -> Maybe [Text]
trafficMirrorSessionIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeTrafficMirrorSessions
-> DescribeTrafficMirrorSessions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTrafficMirrorSessions
-> DescribeTrafficMirrorSessions -> Bool
$c/= :: DescribeTrafficMirrorSessions
-> DescribeTrafficMirrorSessions -> Bool
== :: DescribeTrafficMirrorSessions
-> DescribeTrafficMirrorSessions -> Bool
$c== :: DescribeTrafficMirrorSessions
-> DescribeTrafficMirrorSessions -> Bool
Prelude.Eq, ReadPrec [DescribeTrafficMirrorSessions]
ReadPrec DescribeTrafficMirrorSessions
Int -> ReadS DescribeTrafficMirrorSessions
ReadS [DescribeTrafficMirrorSessions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTrafficMirrorSessions]
$creadListPrec :: ReadPrec [DescribeTrafficMirrorSessions]
readPrec :: ReadPrec DescribeTrafficMirrorSessions
$creadPrec :: ReadPrec DescribeTrafficMirrorSessions
readList :: ReadS [DescribeTrafficMirrorSessions]
$creadList :: ReadS [DescribeTrafficMirrorSessions]
readsPrec :: Int -> ReadS DescribeTrafficMirrorSessions
$creadsPrec :: Int -> ReadS DescribeTrafficMirrorSessions
Prelude.Read, Int -> DescribeTrafficMirrorSessions -> ShowS
[DescribeTrafficMirrorSessions] -> ShowS
DescribeTrafficMirrorSessions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTrafficMirrorSessions] -> ShowS
$cshowList :: [DescribeTrafficMirrorSessions] -> ShowS
show :: DescribeTrafficMirrorSessions -> String
$cshow :: DescribeTrafficMirrorSessions -> String
showsPrec :: Int -> DescribeTrafficMirrorSessions -> ShowS
$cshowsPrec :: Int -> DescribeTrafficMirrorSessions -> ShowS
Prelude.Show, forall x.
Rep DescribeTrafficMirrorSessions x
-> DescribeTrafficMirrorSessions
forall x.
DescribeTrafficMirrorSessions
-> Rep DescribeTrafficMirrorSessions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTrafficMirrorSessions x
-> DescribeTrafficMirrorSessions
$cfrom :: forall x.
DescribeTrafficMirrorSessions
-> Rep DescribeTrafficMirrorSessions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTrafficMirrorSessions' 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', 'describeTrafficMirrorSessions_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@.
--
-- 'filters', 'describeTrafficMirrorSessions_filters' - One or more filters. The possible values are:
--
-- -   @description@: The Traffic Mirror session description.
--
-- -   @network-interface-id@: The ID of the Traffic Mirror session network
--     interface.
--
-- -   @owner-id@: The ID of the account that owns the Traffic Mirror
--     session.
--
-- -   @packet-length@: The assigned number of packets to mirror.
--
-- -   @session-number@: The assigned session number.
--
-- -   @traffic-mirror-filter-id@: The ID of the Traffic Mirror filter.
--
-- -   @traffic-mirror-session-id@: The ID of the Traffic Mirror session.
--
-- -   @traffic-mirror-target-id@: The ID of the Traffic Mirror target.
--
-- -   @virtual-network-id@: The virtual network ID of the Traffic Mirror
--     session.
--
-- 'maxResults', 'describeTrafficMirrorSessions_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', 'describeTrafficMirrorSessions_nextToken' - The token for the next page of results.
--
-- 'trafficMirrorSessionIds', 'describeTrafficMirrorSessions_trafficMirrorSessionIds' - The ID of the Traffic Mirror session.
newDescribeTrafficMirrorSessions ::
  DescribeTrafficMirrorSessions
newDescribeTrafficMirrorSessions :: DescribeTrafficMirrorSessions
newDescribeTrafficMirrorSessions =
  DescribeTrafficMirrorSessions'
    { $sel:dryRun:DescribeTrafficMirrorSessions' :: Maybe Bool
dryRun =
        forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeTrafficMirrorSessions' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeTrafficMirrorSessions' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeTrafficMirrorSessions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:trafficMirrorSessionIds:DescribeTrafficMirrorSessions' :: Maybe [Text]
trafficMirrorSessionIds = 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@.
describeTrafficMirrorSessions_dryRun :: Lens.Lens' DescribeTrafficMirrorSessions (Prelude.Maybe Prelude.Bool)
describeTrafficMirrorSessions_dryRun :: Lens' DescribeTrafficMirrorSessions (Maybe Bool)
describeTrafficMirrorSessions_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrafficMirrorSessions' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DescribeTrafficMirrorSessions
s@DescribeTrafficMirrorSessions' {} Maybe Bool
a -> DescribeTrafficMirrorSessions
s {$sel:dryRun:DescribeTrafficMirrorSessions' :: Maybe Bool
dryRun = Maybe Bool
a} :: DescribeTrafficMirrorSessions)

-- | One or more filters. The possible values are:
--
-- -   @description@: The Traffic Mirror session description.
--
-- -   @network-interface-id@: The ID of the Traffic Mirror session network
--     interface.
--
-- -   @owner-id@: The ID of the account that owns the Traffic Mirror
--     session.
--
-- -   @packet-length@: The assigned number of packets to mirror.
--
-- -   @session-number@: The assigned session number.
--
-- -   @traffic-mirror-filter-id@: The ID of the Traffic Mirror filter.
--
-- -   @traffic-mirror-session-id@: The ID of the Traffic Mirror session.
--
-- -   @traffic-mirror-target-id@: The ID of the Traffic Mirror target.
--
-- -   @virtual-network-id@: The virtual network ID of the Traffic Mirror
--     session.
describeTrafficMirrorSessions_filters :: Lens.Lens' DescribeTrafficMirrorSessions (Prelude.Maybe [Filter])
describeTrafficMirrorSessions_filters :: Lens' DescribeTrafficMirrorSessions (Maybe [Filter])
describeTrafficMirrorSessions_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrafficMirrorSessions' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeTrafficMirrorSessions
s@DescribeTrafficMirrorSessions' {} Maybe [Filter]
a -> DescribeTrafficMirrorSessions
s {$sel:filters:DescribeTrafficMirrorSessions' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeTrafficMirrorSessions) 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.
describeTrafficMirrorSessions_maxResults :: Lens.Lens' DescribeTrafficMirrorSessions (Prelude.Maybe Prelude.Natural)
describeTrafficMirrorSessions_maxResults :: Lens' DescribeTrafficMirrorSessions (Maybe Natural)
describeTrafficMirrorSessions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrafficMirrorSessions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeTrafficMirrorSessions
s@DescribeTrafficMirrorSessions' {} Maybe Natural
a -> DescribeTrafficMirrorSessions
s {$sel:maxResults:DescribeTrafficMirrorSessions' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeTrafficMirrorSessions)

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

-- | The ID of the Traffic Mirror session.
describeTrafficMirrorSessions_trafficMirrorSessionIds :: Lens.Lens' DescribeTrafficMirrorSessions (Prelude.Maybe [Prelude.Text])
describeTrafficMirrorSessions_trafficMirrorSessionIds :: Lens' DescribeTrafficMirrorSessions (Maybe [Text])
describeTrafficMirrorSessions_trafficMirrorSessionIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrafficMirrorSessions' {Maybe [Text]
trafficMirrorSessionIds :: Maybe [Text]
$sel:trafficMirrorSessionIds:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe [Text]
trafficMirrorSessionIds} -> Maybe [Text]
trafficMirrorSessionIds) (\s :: DescribeTrafficMirrorSessions
s@DescribeTrafficMirrorSessions' {} Maybe [Text]
a -> DescribeTrafficMirrorSessions
s {$sel:trafficMirrorSessionIds:DescribeTrafficMirrorSessions' :: Maybe [Text]
trafficMirrorSessionIds = Maybe [Text]
a} :: DescribeTrafficMirrorSessions) 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

instance Core.AWSPager DescribeTrafficMirrorSessions where
  page :: DescribeTrafficMirrorSessions
-> AWSResponse DescribeTrafficMirrorSessions
-> Maybe DescribeTrafficMirrorSessions
page DescribeTrafficMirrorSessions
rq AWSResponse DescribeTrafficMirrorSessions
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeTrafficMirrorSessions
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTrafficMirrorSessionsResponse (Maybe Text)
describeTrafficMirrorSessionsResponse_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 DescribeTrafficMirrorSessions
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  DescribeTrafficMirrorSessionsResponse
  (Maybe [TrafficMirrorSession])
describeTrafficMirrorSessionsResponse_trafficMirrorSessions
            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.$ DescribeTrafficMirrorSessions
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeTrafficMirrorSessions (Maybe Text)
describeTrafficMirrorSessions_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeTrafficMirrorSessions
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeTrafficMirrorSessionsResponse (Maybe Text)
describeTrafficMirrorSessionsResponse_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
    DescribeTrafficMirrorSessions
  where
  type
    AWSResponse DescribeTrafficMirrorSessions =
      DescribeTrafficMirrorSessionsResponse
  request :: (Service -> Service)
-> DescribeTrafficMirrorSessions
-> Request DescribeTrafficMirrorSessions
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 DescribeTrafficMirrorSessions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeTrafficMirrorSessions)))
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 Text
-> Maybe [TrafficMirrorSession]
-> Int
-> DescribeTrafficMirrorSessionsResponse
DescribeTrafficMirrorSessionsResponse'
            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
"nextToken")
            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
"trafficMirrorSessionSet"
                            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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    DescribeTrafficMirrorSessions
  where
  hashWithSalt :: Int -> DescribeTrafficMirrorSessions -> Int
hashWithSalt Int
_salt DescribeTrafficMirrorSessions' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
trafficMirrorSessionIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:trafficMirrorSessionIds:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe [Text]
$sel:nextToken:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Text
$sel:maxResults:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Natural
$sel:filters:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe [Filter]
$sel:dryRun:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> 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]
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
trafficMirrorSessionIds

instance Prelude.NFData DescribeTrafficMirrorSessions where
  rnf :: DescribeTrafficMirrorSessions -> ()
rnf DescribeTrafficMirrorSessions' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
trafficMirrorSessionIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:trafficMirrorSessionIds:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe [Text]
$sel:nextToken:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Text
$sel:maxResults:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Natural
$sel:filters:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe [Filter]
$sel:dryRun:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> 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]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
trafficMirrorSessionIds

instance Data.ToHeaders DescribeTrafficMirrorSessions where
  toHeaders :: DescribeTrafficMirrorSessions -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DescribeTrafficMirrorSessions where
  toQuery :: DescribeTrafficMirrorSessions -> QueryString
toQuery DescribeTrafficMirrorSessions' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
trafficMirrorSessionIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:trafficMirrorSessionIds:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe [Text]
$sel:nextToken:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Text
$sel:maxResults:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Natural
$sel:filters:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe [Filter]
$sel:dryRun:DescribeTrafficMirrorSessions' :: DescribeTrafficMirrorSessions -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"DescribeTrafficMirrorSessions" ::
                      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]
filters),
        ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TrafficMirrorSessionId"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
trafficMirrorSessionIds
          )
      ]

-- | /See:/ 'newDescribeTrafficMirrorSessionsResponse' smart constructor.
data DescribeTrafficMirrorSessionsResponse = DescribeTrafficMirrorSessionsResponse'
  { -- | The token to use to retrieve the next page of results. The value is
    -- @null@ when there are no more results to return.
    DescribeTrafficMirrorSessionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Describes one or more Traffic Mirror sessions. By default, all Traffic
    -- Mirror sessions are described. Alternatively, you can filter the
    -- results.
    DescribeTrafficMirrorSessionsResponse
-> Maybe [TrafficMirrorSession]
trafficMirrorSessions :: Prelude.Maybe [TrafficMirrorSession],
    -- | The response's http status code.
    DescribeTrafficMirrorSessionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeTrafficMirrorSessionsResponse
-> DescribeTrafficMirrorSessionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTrafficMirrorSessionsResponse
-> DescribeTrafficMirrorSessionsResponse -> Bool
$c/= :: DescribeTrafficMirrorSessionsResponse
-> DescribeTrafficMirrorSessionsResponse -> Bool
== :: DescribeTrafficMirrorSessionsResponse
-> DescribeTrafficMirrorSessionsResponse -> Bool
$c== :: DescribeTrafficMirrorSessionsResponse
-> DescribeTrafficMirrorSessionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTrafficMirrorSessionsResponse]
ReadPrec DescribeTrafficMirrorSessionsResponse
Int -> ReadS DescribeTrafficMirrorSessionsResponse
ReadS [DescribeTrafficMirrorSessionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTrafficMirrorSessionsResponse]
$creadListPrec :: ReadPrec [DescribeTrafficMirrorSessionsResponse]
readPrec :: ReadPrec DescribeTrafficMirrorSessionsResponse
$creadPrec :: ReadPrec DescribeTrafficMirrorSessionsResponse
readList :: ReadS [DescribeTrafficMirrorSessionsResponse]
$creadList :: ReadS [DescribeTrafficMirrorSessionsResponse]
readsPrec :: Int -> ReadS DescribeTrafficMirrorSessionsResponse
$creadsPrec :: Int -> ReadS DescribeTrafficMirrorSessionsResponse
Prelude.Read, Int -> DescribeTrafficMirrorSessionsResponse -> ShowS
[DescribeTrafficMirrorSessionsResponse] -> ShowS
DescribeTrafficMirrorSessionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTrafficMirrorSessionsResponse] -> ShowS
$cshowList :: [DescribeTrafficMirrorSessionsResponse] -> ShowS
show :: DescribeTrafficMirrorSessionsResponse -> String
$cshow :: DescribeTrafficMirrorSessionsResponse -> String
showsPrec :: Int -> DescribeTrafficMirrorSessionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeTrafficMirrorSessionsResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeTrafficMirrorSessionsResponse x
-> DescribeTrafficMirrorSessionsResponse
forall x.
DescribeTrafficMirrorSessionsResponse
-> Rep DescribeTrafficMirrorSessionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTrafficMirrorSessionsResponse x
-> DescribeTrafficMirrorSessionsResponse
$cfrom :: forall x.
DescribeTrafficMirrorSessionsResponse
-> Rep DescribeTrafficMirrorSessionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTrafficMirrorSessionsResponse' 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', 'describeTrafficMirrorSessionsResponse_nextToken' - The token to use to retrieve the next page of results. The value is
-- @null@ when there are no more results to return.
--
-- 'trafficMirrorSessions', 'describeTrafficMirrorSessionsResponse_trafficMirrorSessions' - Describes one or more Traffic Mirror sessions. By default, all Traffic
-- Mirror sessions are described. Alternatively, you can filter the
-- results.
--
-- 'httpStatus', 'describeTrafficMirrorSessionsResponse_httpStatus' - The response's http status code.
newDescribeTrafficMirrorSessionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTrafficMirrorSessionsResponse
newDescribeTrafficMirrorSessionsResponse :: Int -> DescribeTrafficMirrorSessionsResponse
newDescribeTrafficMirrorSessionsResponse Int
pHttpStatus_ =
  DescribeTrafficMirrorSessionsResponse'
    { $sel:nextToken:DescribeTrafficMirrorSessionsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:trafficMirrorSessions:DescribeTrafficMirrorSessionsResponse' :: Maybe [TrafficMirrorSession]
trafficMirrorSessions =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeTrafficMirrorSessionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to retrieve the next page of results. The value is
-- @null@ when there are no more results to return.
describeTrafficMirrorSessionsResponse_nextToken :: Lens.Lens' DescribeTrafficMirrorSessionsResponse (Prelude.Maybe Prelude.Text)
describeTrafficMirrorSessionsResponse_nextToken :: Lens' DescribeTrafficMirrorSessionsResponse (Maybe Text)
describeTrafficMirrorSessionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrafficMirrorSessionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeTrafficMirrorSessionsResponse' :: DescribeTrafficMirrorSessionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeTrafficMirrorSessionsResponse
s@DescribeTrafficMirrorSessionsResponse' {} Maybe Text
a -> DescribeTrafficMirrorSessionsResponse
s {$sel:nextToken:DescribeTrafficMirrorSessionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeTrafficMirrorSessionsResponse)

-- | Describes one or more Traffic Mirror sessions. By default, all Traffic
-- Mirror sessions are described. Alternatively, you can filter the
-- results.
describeTrafficMirrorSessionsResponse_trafficMirrorSessions :: Lens.Lens' DescribeTrafficMirrorSessionsResponse (Prelude.Maybe [TrafficMirrorSession])
describeTrafficMirrorSessionsResponse_trafficMirrorSessions :: Lens'
  DescribeTrafficMirrorSessionsResponse
  (Maybe [TrafficMirrorSession])
describeTrafficMirrorSessionsResponse_trafficMirrorSessions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrafficMirrorSessionsResponse' {Maybe [TrafficMirrorSession]
trafficMirrorSessions :: Maybe [TrafficMirrorSession]
$sel:trafficMirrorSessions:DescribeTrafficMirrorSessionsResponse' :: DescribeTrafficMirrorSessionsResponse
-> Maybe [TrafficMirrorSession]
trafficMirrorSessions} -> Maybe [TrafficMirrorSession]
trafficMirrorSessions) (\s :: DescribeTrafficMirrorSessionsResponse
s@DescribeTrafficMirrorSessionsResponse' {} Maybe [TrafficMirrorSession]
a -> DescribeTrafficMirrorSessionsResponse
s {$sel:trafficMirrorSessions:DescribeTrafficMirrorSessionsResponse' :: Maybe [TrafficMirrorSession]
trafficMirrorSessions = Maybe [TrafficMirrorSession]
a} :: DescribeTrafficMirrorSessionsResponse) 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 response's http status code.
describeTrafficMirrorSessionsResponse_httpStatus :: Lens.Lens' DescribeTrafficMirrorSessionsResponse Prelude.Int
describeTrafficMirrorSessionsResponse_httpStatus :: Lens' DescribeTrafficMirrorSessionsResponse Int
describeTrafficMirrorSessionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrafficMirrorSessionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeTrafficMirrorSessionsResponse' :: DescribeTrafficMirrorSessionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeTrafficMirrorSessionsResponse
s@DescribeTrafficMirrorSessionsResponse' {} Int
a -> DescribeTrafficMirrorSessionsResponse
s {$sel:httpStatus:DescribeTrafficMirrorSessionsResponse' :: Int
httpStatus = Int
a} :: DescribeTrafficMirrorSessionsResponse)

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