{-# 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.DescribeVpcs
-- 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 VPCs.
--
-- This operation returns paginated results.
module Amazonka.EC2.DescribeVpcs
  ( -- * Creating a Request
    DescribeVpcs (..),
    newDescribeVpcs,

    -- * Request Lenses
    describeVpcs_dryRun,
    describeVpcs_filters,
    describeVpcs_maxResults,
    describeVpcs_nextToken,
    describeVpcs_vpcIds,

    -- * Destructuring the Response
    DescribeVpcsResponse (..),
    newDescribeVpcsResponse,

    -- * Response Lenses
    describeVpcsResponse_nextToken,
    describeVpcsResponse_vpcs,
    describeVpcsResponse_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:/ 'newDescribeVpcs' smart constructor.
data DescribeVpcs = DescribeVpcs'
  { -- | 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@.
    DescribeVpcs -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | One or more filters.
    --
    -- -   @cidr@ - The primary IPv4 CIDR block of the VPC. The CIDR block you
    --     specify must exactly match the VPC\'s CIDR block for information to
    --     be returned for the VPC. Must contain the slash followed by one or
    --     two digits (for example, @\/28@).
    --
    -- -   @cidr-block-association.cidr-block@ - An IPv4 CIDR block associated
    --     with the VPC.
    --
    -- -   @cidr-block-association.association-id@ - The association ID for an
    --     IPv4 CIDR block associated with the VPC.
    --
    -- -   @cidr-block-association.state@ - The state of an IPv4 CIDR block
    --     associated with the VPC.
    --
    -- -   @dhcp-options-id@ - The ID of a set of DHCP options.
    --
    -- -   @ipv6-cidr-block-association.ipv6-cidr-block@ - An IPv6 CIDR block
    --     associated with the VPC.
    --
    -- -   @ipv6-cidr-block-association.ipv6-pool@ - The ID of the IPv6 address
    --     pool from which the IPv6 CIDR block is allocated.
    --
    -- -   @ipv6-cidr-block-association.association-id@ - The association ID
    --     for an IPv6 CIDR block associated with the VPC.
    --
    -- -   @ipv6-cidr-block-association.state@ - The state of an IPv6 CIDR
    --     block associated with the VPC.
    --
    -- -   @is-default@ - Indicates whether the VPC is the default VPC.
    --
    -- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
    --     VPC.
    --
    -- -   @state@ - The state of the VPC (@pending@ | @available@).
    --
    -- -   @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-id@ - The ID of the VPC.
    DescribeVpcs -> 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.
    DescribeVpcs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next page of results.
    DescribeVpcs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | One or more VPC IDs.
    --
    -- Default: Describes all your VPCs.
    DescribeVpcs -> Maybe [Text]
vpcIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (DescribeVpcs -> DescribeVpcs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeVpcs -> DescribeVpcs -> Bool
$c/= :: DescribeVpcs -> DescribeVpcs -> Bool
== :: DescribeVpcs -> DescribeVpcs -> Bool
$c== :: DescribeVpcs -> DescribeVpcs -> Bool
Prelude.Eq, ReadPrec [DescribeVpcs]
ReadPrec DescribeVpcs
Int -> ReadS DescribeVpcs
ReadS [DescribeVpcs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeVpcs]
$creadListPrec :: ReadPrec [DescribeVpcs]
readPrec :: ReadPrec DescribeVpcs
$creadPrec :: ReadPrec DescribeVpcs
readList :: ReadS [DescribeVpcs]
$creadList :: ReadS [DescribeVpcs]
readsPrec :: Int -> ReadS DescribeVpcs
$creadsPrec :: Int -> ReadS DescribeVpcs
Prelude.Read, Int -> DescribeVpcs -> ShowS
[DescribeVpcs] -> ShowS
DescribeVpcs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeVpcs] -> ShowS
$cshowList :: [DescribeVpcs] -> ShowS
show :: DescribeVpcs -> String
$cshow :: DescribeVpcs -> String
showsPrec :: Int -> DescribeVpcs -> ShowS
$cshowsPrec :: Int -> DescribeVpcs -> ShowS
Prelude.Show, forall x. Rep DescribeVpcs x -> DescribeVpcs
forall x. DescribeVpcs -> Rep DescribeVpcs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeVpcs x -> DescribeVpcs
$cfrom :: forall x. DescribeVpcs -> Rep DescribeVpcs x
Prelude.Generic)

-- |
-- Create a value of 'DescribeVpcs' 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', 'describeVpcs_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', 'describeVpcs_filters' - One or more filters.
--
-- -   @cidr@ - The primary IPv4 CIDR block of the VPC. The CIDR block you
--     specify must exactly match the VPC\'s CIDR block for information to
--     be returned for the VPC. Must contain the slash followed by one or
--     two digits (for example, @\/28@).
--
-- -   @cidr-block-association.cidr-block@ - An IPv4 CIDR block associated
--     with the VPC.
--
-- -   @cidr-block-association.association-id@ - The association ID for an
--     IPv4 CIDR block associated with the VPC.
--
-- -   @cidr-block-association.state@ - The state of an IPv4 CIDR block
--     associated with the VPC.
--
-- -   @dhcp-options-id@ - The ID of a set of DHCP options.
--
-- -   @ipv6-cidr-block-association.ipv6-cidr-block@ - An IPv6 CIDR block
--     associated with the VPC.
--
-- -   @ipv6-cidr-block-association.ipv6-pool@ - The ID of the IPv6 address
--     pool from which the IPv6 CIDR block is allocated.
--
-- -   @ipv6-cidr-block-association.association-id@ - The association ID
--     for an IPv6 CIDR block associated with the VPC.
--
-- -   @ipv6-cidr-block-association.state@ - The state of an IPv6 CIDR
--     block associated with the VPC.
--
-- -   @is-default@ - Indicates whether the VPC is the default VPC.
--
-- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
--     VPC.
--
-- -   @state@ - The state of the VPC (@pending@ | @available@).
--
-- -   @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-id@ - The ID of the VPC.
--
-- 'maxResults', 'describeVpcs_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', 'describeVpcs_nextToken' - The token for the next page of results.
--
-- 'vpcIds', 'describeVpcs_vpcIds' - One or more VPC IDs.
--
-- Default: Describes all your VPCs.
newDescribeVpcs ::
  DescribeVpcs
newDescribeVpcs :: DescribeVpcs
newDescribeVpcs =
  DescribeVpcs'
    { $sel:dryRun:DescribeVpcs' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeVpcs' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeVpcs' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeVpcs' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcIds:DescribeVpcs' :: Maybe [Text]
vpcIds = 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@.
describeVpcs_dryRun :: Lens.Lens' DescribeVpcs (Prelude.Maybe Prelude.Bool)
describeVpcs_dryRun :: Lens' DescribeVpcs (Maybe Bool)
describeVpcs_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcs' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:DescribeVpcs' :: DescribeVpcs -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: DescribeVpcs
s@DescribeVpcs' {} Maybe Bool
a -> DescribeVpcs
s {$sel:dryRun:DescribeVpcs' :: Maybe Bool
dryRun = Maybe Bool
a} :: DescribeVpcs)

-- | One or more filters.
--
-- -   @cidr@ - The primary IPv4 CIDR block of the VPC. The CIDR block you
--     specify must exactly match the VPC\'s CIDR block for information to
--     be returned for the VPC. Must contain the slash followed by one or
--     two digits (for example, @\/28@).
--
-- -   @cidr-block-association.cidr-block@ - An IPv4 CIDR block associated
--     with the VPC.
--
-- -   @cidr-block-association.association-id@ - The association ID for an
--     IPv4 CIDR block associated with the VPC.
--
-- -   @cidr-block-association.state@ - The state of an IPv4 CIDR block
--     associated with the VPC.
--
-- -   @dhcp-options-id@ - The ID of a set of DHCP options.
--
-- -   @ipv6-cidr-block-association.ipv6-cidr-block@ - An IPv6 CIDR block
--     associated with the VPC.
--
-- -   @ipv6-cidr-block-association.ipv6-pool@ - The ID of the IPv6 address
--     pool from which the IPv6 CIDR block is allocated.
--
-- -   @ipv6-cidr-block-association.association-id@ - The association ID
--     for an IPv6 CIDR block associated with the VPC.
--
-- -   @ipv6-cidr-block-association.state@ - The state of an IPv6 CIDR
--     block associated with the VPC.
--
-- -   @is-default@ - Indicates whether the VPC is the default VPC.
--
-- -   @owner-id@ - The ID of the Amazon Web Services account that owns the
--     VPC.
--
-- -   @state@ - The state of the VPC (@pending@ | @available@).
--
-- -   @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-id@ - The ID of the VPC.
describeVpcs_filters :: Lens.Lens' DescribeVpcs (Prelude.Maybe [Filter])
describeVpcs_filters :: Lens' DescribeVpcs (Maybe [Filter])
describeVpcs_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcs' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeVpcs' :: DescribeVpcs -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeVpcs
s@DescribeVpcs' {} Maybe [Filter]
a -> DescribeVpcs
s {$sel:filters:DescribeVpcs' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeVpcs) 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.
describeVpcs_maxResults :: Lens.Lens' DescribeVpcs (Prelude.Maybe Prelude.Natural)
describeVpcs_maxResults :: Lens' DescribeVpcs (Maybe Natural)
describeVpcs_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcs' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeVpcs' :: DescribeVpcs -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeVpcs
s@DescribeVpcs' {} Maybe Natural
a -> DescribeVpcs
s {$sel:maxResults:DescribeVpcs' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeVpcs)

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

-- | One or more VPC IDs.
--
-- Default: Describes all your VPCs.
describeVpcs_vpcIds :: Lens.Lens' DescribeVpcs (Prelude.Maybe [Prelude.Text])
describeVpcs_vpcIds :: Lens' DescribeVpcs (Maybe [Text])
describeVpcs_vpcIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcs' {Maybe [Text]
vpcIds :: Maybe [Text]
$sel:vpcIds:DescribeVpcs' :: DescribeVpcs -> Maybe [Text]
vpcIds} -> Maybe [Text]
vpcIds) (\s :: DescribeVpcs
s@DescribeVpcs' {} Maybe [Text]
a -> DescribeVpcs
s {$sel:vpcIds:DescribeVpcs' :: Maybe [Text]
vpcIds = Maybe [Text]
a} :: DescribeVpcs) 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 DescribeVpcs where
  page :: DescribeVpcs -> AWSResponse DescribeVpcs -> Maybe DescribeVpcs
page DescribeVpcs
rq AWSResponse DescribeVpcs
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeVpcs
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeVpcsResponse (Maybe Text)
describeVpcsResponse_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 DescribeVpcs
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeVpcsResponse (Maybe [Vpc])
describeVpcsResponse_vpcs
            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.$ DescribeVpcs
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' DescribeVpcs (Maybe Text)
describeVpcs_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeVpcs
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' DescribeVpcsResponse (Maybe Text)
describeVpcsResponse_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 DescribeVpcs where
  type AWSResponse DescribeVpcs = DescribeVpcsResponse
  request :: (Service -> Service) -> DescribeVpcs -> Request DescribeVpcs
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 DescribeVpcs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeVpcs)))
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 [Vpc] -> Int -> DescribeVpcsResponse
DescribeVpcsResponse'
            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
"vpcSet"
                            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 DescribeVpcs where
  hashWithSalt :: Int -> DescribeVpcs -> Int
hashWithSalt Int
_salt DescribeVpcs' {Maybe Bool
Maybe Natural
Maybe [Text]
Maybe [Filter]
Maybe Text
vpcIds :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
dryRun :: Maybe Bool
$sel:vpcIds:DescribeVpcs' :: DescribeVpcs -> Maybe [Text]
$sel:nextToken:DescribeVpcs' :: DescribeVpcs -> Maybe Text
$sel:maxResults:DescribeVpcs' :: DescribeVpcs -> Maybe Natural
$sel:filters:DescribeVpcs' :: DescribeVpcs -> Maybe [Filter]
$sel:dryRun:DescribeVpcs' :: DescribeVpcs -> 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]
vpcIds

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

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

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

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

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

-- |
-- Create a value of 'DescribeVpcsResponse' 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', 'describeVpcsResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'vpcs', 'describeVpcsResponse_vpcs' - Information about one or more VPCs.
--
-- 'httpStatus', 'describeVpcsResponse_httpStatus' - The response's http status code.
newDescribeVpcsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeVpcsResponse
newDescribeVpcsResponse :: Int -> DescribeVpcsResponse
newDescribeVpcsResponse Int
pHttpStatus_ =
  DescribeVpcsResponse'
    { $sel:nextToken:DescribeVpcsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcs:DescribeVpcsResponse' :: Maybe [Vpc]
vpcs = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeVpcsResponse' :: 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.
describeVpcsResponse_nextToken :: Lens.Lens' DescribeVpcsResponse (Prelude.Maybe Prelude.Text)
describeVpcsResponse_nextToken :: Lens' DescribeVpcsResponse (Maybe Text)
describeVpcsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeVpcsResponse' :: DescribeVpcsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeVpcsResponse
s@DescribeVpcsResponse' {} Maybe Text
a -> DescribeVpcsResponse
s {$sel:nextToken:DescribeVpcsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeVpcsResponse)

-- | Information about one or more VPCs.
describeVpcsResponse_vpcs :: Lens.Lens' DescribeVpcsResponse (Prelude.Maybe [Vpc])
describeVpcsResponse_vpcs :: Lens' DescribeVpcsResponse (Maybe [Vpc])
describeVpcsResponse_vpcs = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcsResponse' {Maybe [Vpc]
vpcs :: Maybe [Vpc]
$sel:vpcs:DescribeVpcsResponse' :: DescribeVpcsResponse -> Maybe [Vpc]
vpcs} -> Maybe [Vpc]
vpcs) (\s :: DescribeVpcsResponse
s@DescribeVpcsResponse' {} Maybe [Vpc]
a -> DescribeVpcsResponse
s {$sel:vpcs:DescribeVpcsResponse' :: Maybe [Vpc]
vpcs = Maybe [Vpc]
a} :: DescribeVpcsResponse) 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.
describeVpcsResponse_httpStatus :: Lens.Lens' DescribeVpcsResponse Prelude.Int
describeVpcsResponse_httpStatus :: Lens' DescribeVpcsResponse Int
describeVpcsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeVpcsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeVpcsResponse' :: DescribeVpcsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeVpcsResponse
s@DescribeVpcsResponse' {} Int
a -> DescribeVpcsResponse
s {$sel:httpStatus:DescribeVpcsResponse' :: Int
httpStatus = Int
a} :: DescribeVpcsResponse)

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