{-# 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.DescribeVpcPeeringConnections
-- 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 of your VPC peering connections.
--
-- This operation returns paginated results.
module Amazonka.EC2.DescribeVpcPeeringConnections
  ( -- * Creating a Request
    DescribeVpcPeeringConnections (..),
    newDescribeVpcPeeringConnections,

    -- * Request Lenses
    describeVpcPeeringConnections_dryRun,
    describeVpcPeeringConnections_filters,
    describeVpcPeeringConnections_maxResults,
    describeVpcPeeringConnections_nextToken,
    describeVpcPeeringConnections_vpcPeeringConnectionIds,

    -- * Destructuring the Response
    DescribeVpcPeeringConnectionsResponse (..),
    newDescribeVpcPeeringConnectionsResponse,

    -- * Response Lenses
    describeVpcPeeringConnectionsResponse_nextToken,
    describeVpcPeeringConnectionsResponse_vpcPeeringConnections,
    describeVpcPeeringConnectionsResponse_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:/ 'newDescribeVpcPeeringConnections' smart constructor.
data DescribeVpcPeeringConnections = DescribeVpcPeeringConnections'
  { -- | 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@.
    DescribeVpcPeeringConnections -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters.
    --
    -- -   @accepter-vpc-info.cidr-block@ - The IPv4 CIDR block of the accepter
    --     VPC.
    --
    -- -   @accepter-vpc-info.owner-id@ - The ID of the Amazon Web Services
    --     account that owns the accepter VPC.
    --
    -- -   @accepter-vpc-info.vpc-id@ - The ID of the accepter VPC.
    --
    -- -   @expiration-time@ - The expiration date and time for the VPC peering
    --     connection.
    --
    -- -   @requester-vpc-info.cidr-block@ - The IPv4 CIDR block of the
    --     requester\'s VPC.
    --
    -- -   @requester-vpc-info.owner-id@ - The ID of the Amazon Web Services
    --     account that owns the requester VPC.
    --
    -- -   @requester-vpc-info.vpc-id@ - The ID of the requester VPC.
    --
    -- -   @status-code@ - The status of the VPC peering connection
    --     (@pending-acceptance@ | @failed@ | @expired@ | @provisioning@ |
    --     @active@ | @deleting@ | @deleted@ | @rejected@).
    --
    -- -   @status-message@ - A message that provides more information about
    --     the status of the VPC peering connection, if applicable.
    --
    -- -   @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.
    --
    -- -   @vpc-peering-connection-id@ - The ID of the VPC peering connection.
    DescribeVpcPeeringConnections -> 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.
    DescribeVpcPeeringConnections -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next page of results.
    DescribeVpcPeeringConnections -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | One or more VPC peering connection IDs.
    --
    -- Default: Describes all your VPC peering connections.
    DescribeVpcPeeringConnections -> Maybe [Text]
vpcPeeringConnectionIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeVpcPeeringConnections
-> DescribeVpcPeeringConnections -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeVpcPeeringConnections
-> DescribeVpcPeeringConnections -> Bool
$c/= :: DescribeVpcPeeringConnections
-> DescribeVpcPeeringConnections -> Bool
== :: DescribeVpcPeeringConnections
-> DescribeVpcPeeringConnections -> Bool
$c== :: DescribeVpcPeeringConnections
-> DescribeVpcPeeringConnections -> Bool
Prelude.Eq, ReadPrec [DescribeVpcPeeringConnections]
ReadPrec DescribeVpcPeeringConnections
Int -> ReadS DescribeVpcPeeringConnections
ReadS [DescribeVpcPeeringConnections]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeVpcPeeringConnections]
$creadListPrec :: ReadPrec [DescribeVpcPeeringConnections]
readPrec :: ReadPrec DescribeVpcPeeringConnections
$creadPrec :: ReadPrec DescribeVpcPeeringConnections
readList :: ReadS [DescribeVpcPeeringConnections]
$creadList :: ReadS [DescribeVpcPeeringConnections]
readsPrec :: Int -> ReadS DescribeVpcPeeringConnections
$creadsPrec :: Int -> ReadS DescribeVpcPeeringConnections
Prelude.Read, Int -> DescribeVpcPeeringConnections -> ShowS
[DescribeVpcPeeringConnections] -> ShowS
DescribeVpcPeeringConnections -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeVpcPeeringConnections] -> ShowS
$cshowList :: [DescribeVpcPeeringConnections] -> ShowS
show :: DescribeVpcPeeringConnections -> String
$cshow :: DescribeVpcPeeringConnections -> String
showsPrec :: Int -> DescribeVpcPeeringConnections -> ShowS
$cshowsPrec :: Int -> DescribeVpcPeeringConnections -> ShowS
Prelude.Show, forall x.
Rep DescribeVpcPeeringConnections x
-> DescribeVpcPeeringConnections
forall x.
DescribeVpcPeeringConnections
-> Rep DescribeVpcPeeringConnections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeVpcPeeringConnections x
-> DescribeVpcPeeringConnections
$cfrom :: forall x.
DescribeVpcPeeringConnections
-> Rep DescribeVpcPeeringConnections x
Prelude.Generic)

-- |
-- Create a value of 'DescribeVpcPeeringConnections' 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', 'describeVpcPeeringConnections_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', 'describeVpcPeeringConnections_filters' - One or more filters.
--
-- -   @accepter-vpc-info.cidr-block@ - The IPv4 CIDR block of the accepter
--     VPC.
--
-- -   @accepter-vpc-info.owner-id@ - The ID of the Amazon Web Services
--     account that owns the accepter VPC.
--
-- -   @accepter-vpc-info.vpc-id@ - The ID of the accepter VPC.
--
-- -   @expiration-time@ - The expiration date and time for the VPC peering
--     connection.
--
-- -   @requester-vpc-info.cidr-block@ - The IPv4 CIDR block of the
--     requester\'s VPC.
--
-- -   @requester-vpc-info.owner-id@ - The ID of the Amazon Web Services
--     account that owns the requester VPC.
--
-- -   @requester-vpc-info.vpc-id@ - The ID of the requester VPC.
--
-- -   @status-code@ - The status of the VPC peering connection
--     (@pending-acceptance@ | @failed@ | @expired@ | @provisioning@ |
--     @active@ | @deleting@ | @deleted@ | @rejected@).
--
-- -   @status-message@ - A message that provides more information about
--     the status of the VPC peering connection, if applicable.
--
-- -   @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.
--
-- -   @vpc-peering-connection-id@ - The ID of the VPC peering connection.
--
-- 'maxResults', 'describeVpcPeeringConnections_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', 'describeVpcPeeringConnections_nextToken' - The token for the next page of results.
--
-- 'vpcPeeringConnectionIds', 'describeVpcPeeringConnections_vpcPeeringConnectionIds' - One or more VPC peering connection IDs.
--
-- Default: Describes all your VPC peering connections.
newDescribeVpcPeeringConnections ::
  DescribeVpcPeeringConnections
newDescribeVpcPeeringConnections :: DescribeVpcPeeringConnections
newDescribeVpcPeeringConnections =
  DescribeVpcPeeringConnections'
    { $sel:dryRun:DescribeVpcPeeringConnections' :: Maybe Bool
dryRun =
        forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeVpcPeeringConnections' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeVpcPeeringConnections' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeVpcPeeringConnections' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcPeeringConnectionIds:DescribeVpcPeeringConnections' :: Maybe [Text]
vpcPeeringConnectionIds = 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@.
describeVpcPeeringConnections_dryRun :: Lens.Lens' DescribeVpcPeeringConnections (Prelude.Maybe Prelude.Bool)
describeVpcPeeringConnections_dryRun :: Lens' DescribeVpcPeeringConnections (Maybe Bool)
describeVpcPeeringConnections_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcPeeringConnections' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DescribeVpcPeeringConnections
s@DescribeVpcPeeringConnections' {} Maybe Bool
a -> DescribeVpcPeeringConnections
s {$sel:dryRun:DescribeVpcPeeringConnections' :: Maybe Bool
dryRun = Maybe Bool
a} :: DescribeVpcPeeringConnections)

-- | One or more filters.
--
-- -   @accepter-vpc-info.cidr-block@ - The IPv4 CIDR block of the accepter
--     VPC.
--
-- -   @accepter-vpc-info.owner-id@ - The ID of the Amazon Web Services
--     account that owns the accepter VPC.
--
-- -   @accepter-vpc-info.vpc-id@ - The ID of the accepter VPC.
--
-- -   @expiration-time@ - The expiration date and time for the VPC peering
--     connection.
--
-- -   @requester-vpc-info.cidr-block@ - The IPv4 CIDR block of the
--     requester\'s VPC.
--
-- -   @requester-vpc-info.owner-id@ - The ID of the Amazon Web Services
--     account that owns the requester VPC.
--
-- -   @requester-vpc-info.vpc-id@ - The ID of the requester VPC.
--
-- -   @status-code@ - The status of the VPC peering connection
--     (@pending-acceptance@ | @failed@ | @expired@ | @provisioning@ |
--     @active@ | @deleting@ | @deleted@ | @rejected@).
--
-- -   @status-message@ - A message that provides more information about
--     the status of the VPC peering connection, if applicable.
--
-- -   @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.
--
-- -   @vpc-peering-connection-id@ - The ID of the VPC peering connection.
describeVpcPeeringConnections_filters :: Lens.Lens' DescribeVpcPeeringConnections (Prelude.Maybe [Filter])
describeVpcPeeringConnections_filters :: Lens' DescribeVpcPeeringConnections (Maybe [Filter])
describeVpcPeeringConnections_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcPeeringConnections' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeVpcPeeringConnections
s@DescribeVpcPeeringConnections' {} Maybe [Filter]
a -> DescribeVpcPeeringConnections
s {$sel:filters:DescribeVpcPeeringConnections' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeVpcPeeringConnections) 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.
describeVpcPeeringConnections_maxResults :: Lens.Lens' DescribeVpcPeeringConnections (Prelude.Maybe Prelude.Natural)
describeVpcPeeringConnections_maxResults :: Lens' DescribeVpcPeeringConnections (Maybe Natural)
describeVpcPeeringConnections_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcPeeringConnections' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeVpcPeeringConnections
s@DescribeVpcPeeringConnections' {} Maybe Natural
a -> DescribeVpcPeeringConnections
s {$sel:maxResults:DescribeVpcPeeringConnections' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeVpcPeeringConnections)

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

-- | One or more VPC peering connection IDs.
--
-- Default: Describes all your VPC peering connections.
describeVpcPeeringConnections_vpcPeeringConnectionIds :: Lens.Lens' DescribeVpcPeeringConnections (Prelude.Maybe [Prelude.Text])
describeVpcPeeringConnections_vpcPeeringConnectionIds :: Lens' DescribeVpcPeeringConnections (Maybe [Text])
describeVpcPeeringConnections_vpcPeeringConnectionIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcPeeringConnections' {Maybe [Text]
vpcPeeringConnectionIds :: Maybe [Text]
$sel:vpcPeeringConnectionIds:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe [Text]
vpcPeeringConnectionIds} -> Maybe [Text]
vpcPeeringConnectionIds) (\s :: DescribeVpcPeeringConnections
s@DescribeVpcPeeringConnections' {} Maybe [Text]
a -> DescribeVpcPeeringConnections
s {$sel:vpcPeeringConnectionIds:DescribeVpcPeeringConnections' :: Maybe [Text]
vpcPeeringConnectionIds = Maybe [Text]
a} :: DescribeVpcPeeringConnections) 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 DescribeVpcPeeringConnections where
  page :: DescribeVpcPeeringConnections
-> AWSResponse DescribeVpcPeeringConnections
-> Maybe DescribeVpcPeeringConnections
page DescribeVpcPeeringConnections
rq AWSResponse DescribeVpcPeeringConnections
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeVpcPeeringConnections
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeVpcPeeringConnectionsResponse (Maybe Text)
describeVpcPeeringConnectionsResponse_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 DescribeVpcPeeringConnections
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  DescribeVpcPeeringConnectionsResponse
  (Maybe [VpcPeeringConnection])
describeVpcPeeringConnectionsResponse_vpcPeeringConnections
            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.$ DescribeVpcPeeringConnections
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeVpcPeeringConnections (Maybe Text)
describeVpcPeeringConnections_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeVpcPeeringConnections
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeVpcPeeringConnectionsResponse (Maybe Text)
describeVpcPeeringConnectionsResponse_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
    DescribeVpcPeeringConnections
  where
  type
    AWSResponse DescribeVpcPeeringConnections =
      DescribeVpcPeeringConnectionsResponse
  request :: (Service -> Service)
-> DescribeVpcPeeringConnections
-> Request DescribeVpcPeeringConnections
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 DescribeVpcPeeringConnections
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeVpcPeeringConnections)))
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 [VpcPeeringConnection]
-> Int
-> DescribeVpcPeeringConnectionsResponse
DescribeVpcPeeringConnectionsResponse'
            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
"vpcPeeringConnectionSet"
                            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
    DescribeVpcPeeringConnections
  where
  hashWithSalt :: Int -> DescribeVpcPeeringConnections -> Int
hashWithSalt Int
_salt DescribeVpcPeeringConnections' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
vpcPeeringConnectionIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:vpcPeeringConnectionIds:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe [Text]
$sel:nextToken:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Text
$sel:maxResults:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Natural
$sel:filters:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe [Filter]
$sel:dryRun:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> 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]
vpcPeeringConnectionIds

instance Prelude.NFData DescribeVpcPeeringConnections where
  rnf :: DescribeVpcPeeringConnections -> ()
rnf DescribeVpcPeeringConnections' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
vpcPeeringConnectionIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:vpcPeeringConnectionIds:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe [Text]
$sel:nextToken:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Text
$sel:maxResults:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Natural
$sel:filters:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe [Filter]
$sel:dryRun:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> 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]
vpcPeeringConnectionIds

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

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

instance Data.ToQuery DescribeVpcPeeringConnections where
  toQuery :: DescribeVpcPeeringConnections -> QueryString
toQuery DescribeVpcPeeringConnections' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
vpcPeeringConnectionIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:vpcPeeringConnectionIds:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe [Text]
$sel:nextToken:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Text
$sel:maxResults:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Natural
$sel:filters:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe [Filter]
$sel:dryRun:DescribeVpcPeeringConnections' :: DescribeVpcPeeringConnections -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"DescribeVpcPeeringConnections" ::
                      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
"VpcPeeringConnectionId"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
vpcPeeringConnectionIds
          )
      ]

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

-- |
-- Create a value of 'DescribeVpcPeeringConnectionsResponse' 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', 'describeVpcPeeringConnectionsResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'vpcPeeringConnections', 'describeVpcPeeringConnectionsResponse_vpcPeeringConnections' - Information about the VPC peering connections.
--
-- 'httpStatus', 'describeVpcPeeringConnectionsResponse_httpStatus' - The response's http status code.
newDescribeVpcPeeringConnectionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeVpcPeeringConnectionsResponse
newDescribeVpcPeeringConnectionsResponse :: Int -> DescribeVpcPeeringConnectionsResponse
newDescribeVpcPeeringConnectionsResponse Int
pHttpStatus_ =
  DescribeVpcPeeringConnectionsResponse'
    { $sel:nextToken:DescribeVpcPeeringConnectionsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:vpcPeeringConnections:DescribeVpcPeeringConnectionsResponse' :: Maybe [VpcPeeringConnection]
vpcPeeringConnections =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeVpcPeeringConnectionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | Information about the VPC peering connections.
describeVpcPeeringConnectionsResponse_vpcPeeringConnections :: Lens.Lens' DescribeVpcPeeringConnectionsResponse (Prelude.Maybe [VpcPeeringConnection])
describeVpcPeeringConnectionsResponse_vpcPeeringConnections :: Lens'
  DescribeVpcPeeringConnectionsResponse
  (Maybe [VpcPeeringConnection])
describeVpcPeeringConnectionsResponse_vpcPeeringConnections = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcPeeringConnectionsResponse' {Maybe [VpcPeeringConnection]
vpcPeeringConnections :: Maybe [VpcPeeringConnection]
$sel:vpcPeeringConnections:DescribeVpcPeeringConnectionsResponse' :: DescribeVpcPeeringConnectionsResponse
-> Maybe [VpcPeeringConnection]
vpcPeeringConnections} -> Maybe [VpcPeeringConnection]
vpcPeeringConnections) (\s :: DescribeVpcPeeringConnectionsResponse
s@DescribeVpcPeeringConnectionsResponse' {} Maybe [VpcPeeringConnection]
a -> DescribeVpcPeeringConnectionsResponse
s {$sel:vpcPeeringConnections:DescribeVpcPeeringConnectionsResponse' :: Maybe [VpcPeeringConnection]
vpcPeeringConnections = Maybe [VpcPeeringConnection]
a} :: DescribeVpcPeeringConnectionsResponse) 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.
describeVpcPeeringConnectionsResponse_httpStatus :: Lens.Lens' DescribeVpcPeeringConnectionsResponse Prelude.Int
describeVpcPeeringConnectionsResponse_httpStatus :: Lens' DescribeVpcPeeringConnectionsResponse Int
describeVpcPeeringConnectionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcPeeringConnectionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeVpcPeeringConnectionsResponse' :: DescribeVpcPeeringConnectionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeVpcPeeringConnectionsResponse
s@DescribeVpcPeeringConnectionsResponse' {} Int
a -> DescribeVpcPeeringConnectionsResponse
s {$sel:httpStatus:DescribeVpcPeeringConnectionsResponse' :: Int
httpStatus = Int
a} :: DescribeVpcPeeringConnectionsResponse)

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