{-# 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.Route53.ListVPCAssociationAuthorizations
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets a list of the VPCs that were created by other accounts and that can
-- be associated with a specified hosted zone because you\'ve submitted one
-- or more @CreateVPCAssociationAuthorization@ requests.
--
-- The response includes a @VPCs@ element with a @VPC@ child element for
-- each VPC that can be associated with the hosted zone.
--
-- This operation returns paginated results.
module Amazonka.Route53.ListVPCAssociationAuthorizations
  ( -- * Creating a Request
    ListVPCAssociationAuthorizations (..),
    newListVPCAssociationAuthorizations,

    -- * Request Lenses
    listVPCAssociationAuthorizations_nextToken,
    listVPCAssociationAuthorizations_maxResults,
    listVPCAssociationAuthorizations_hostedZoneId,

    -- * Destructuring the Response
    ListVPCAssociationAuthorizationsResponse (..),
    newListVPCAssociationAuthorizationsResponse,

    -- * Response Lenses
    listVPCAssociationAuthorizationsResponse_nextToken,
    listVPCAssociationAuthorizationsResponse_httpStatus,
    listVPCAssociationAuthorizationsResponse_hostedZoneId,
    listVPCAssociationAuthorizationsResponse_vPCs,
  )
where

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

-- | A complex type that contains information about that can be associated
-- with your hosted zone.
--
-- /See:/ 'newListVPCAssociationAuthorizations' smart constructor.
data ListVPCAssociationAuthorizations = ListVPCAssociationAuthorizations'
  { -- | /Optional/: If a response includes a @NextToken@ element, there are more
    -- VPCs that can be associated with the specified hosted zone. To get the
    -- next page of results, submit another request, and include the value of
    -- @NextToken@ from the response in the @nexttoken@ parameter in another
    -- @ListVPCAssociationAuthorizations@ request.
    ListVPCAssociationAuthorizations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | /Optional/: An integer that specifies the maximum number of VPCs that
    -- you want Amazon Route 53 to return. If you don\'t specify a value for
    -- @MaxResults@, Route 53 returns up to 50 VPCs per page.
    ListVPCAssociationAuthorizations -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text,
    -- | The ID of the hosted zone for which you want a list of VPCs that can be
    -- associated with the hosted zone.
    ListVPCAssociationAuthorizations -> ResourceId
hostedZoneId :: ResourceId
  }
  deriving (ListVPCAssociationAuthorizations
-> ListVPCAssociationAuthorizations -> Bool
(ListVPCAssociationAuthorizations
 -> ListVPCAssociationAuthorizations -> Bool)
-> (ListVPCAssociationAuthorizations
    -> ListVPCAssociationAuthorizations -> Bool)
-> Eq ListVPCAssociationAuthorizations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVPCAssociationAuthorizations
-> ListVPCAssociationAuthorizations -> Bool
$c/= :: ListVPCAssociationAuthorizations
-> ListVPCAssociationAuthorizations -> Bool
== :: ListVPCAssociationAuthorizations
-> ListVPCAssociationAuthorizations -> Bool
$c== :: ListVPCAssociationAuthorizations
-> ListVPCAssociationAuthorizations -> Bool
Prelude.Eq, ReadPrec [ListVPCAssociationAuthorizations]
ReadPrec ListVPCAssociationAuthorizations
Int -> ReadS ListVPCAssociationAuthorizations
ReadS [ListVPCAssociationAuthorizations]
(Int -> ReadS ListVPCAssociationAuthorizations)
-> ReadS [ListVPCAssociationAuthorizations]
-> ReadPrec ListVPCAssociationAuthorizations
-> ReadPrec [ListVPCAssociationAuthorizations]
-> Read ListVPCAssociationAuthorizations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVPCAssociationAuthorizations]
$creadListPrec :: ReadPrec [ListVPCAssociationAuthorizations]
readPrec :: ReadPrec ListVPCAssociationAuthorizations
$creadPrec :: ReadPrec ListVPCAssociationAuthorizations
readList :: ReadS [ListVPCAssociationAuthorizations]
$creadList :: ReadS [ListVPCAssociationAuthorizations]
readsPrec :: Int -> ReadS ListVPCAssociationAuthorizations
$creadsPrec :: Int -> ReadS ListVPCAssociationAuthorizations
Prelude.Read, Int -> ListVPCAssociationAuthorizations -> ShowS
[ListVPCAssociationAuthorizations] -> ShowS
ListVPCAssociationAuthorizations -> String
(Int -> ListVPCAssociationAuthorizations -> ShowS)
-> (ListVPCAssociationAuthorizations -> String)
-> ([ListVPCAssociationAuthorizations] -> ShowS)
-> Show ListVPCAssociationAuthorizations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVPCAssociationAuthorizations] -> ShowS
$cshowList :: [ListVPCAssociationAuthorizations] -> ShowS
show :: ListVPCAssociationAuthorizations -> String
$cshow :: ListVPCAssociationAuthorizations -> String
showsPrec :: Int -> ListVPCAssociationAuthorizations -> ShowS
$cshowsPrec :: Int -> ListVPCAssociationAuthorizations -> ShowS
Prelude.Show, (forall x.
 ListVPCAssociationAuthorizations
 -> Rep ListVPCAssociationAuthorizations x)
-> (forall x.
    Rep ListVPCAssociationAuthorizations x
    -> ListVPCAssociationAuthorizations)
-> Generic ListVPCAssociationAuthorizations
forall x.
Rep ListVPCAssociationAuthorizations x
-> ListVPCAssociationAuthorizations
forall x.
ListVPCAssociationAuthorizations
-> Rep ListVPCAssociationAuthorizations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListVPCAssociationAuthorizations x
-> ListVPCAssociationAuthorizations
$cfrom :: forall x.
ListVPCAssociationAuthorizations
-> Rep ListVPCAssociationAuthorizations x
Prelude.Generic)

-- |
-- Create a value of 'ListVPCAssociationAuthorizations' 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', 'listVPCAssociationAuthorizations_nextToken' - /Optional/: If a response includes a @NextToken@ element, there are more
-- VPCs that can be associated with the specified hosted zone. To get the
-- next page of results, submit another request, and include the value of
-- @NextToken@ from the response in the @nexttoken@ parameter in another
-- @ListVPCAssociationAuthorizations@ request.
--
-- 'maxResults', 'listVPCAssociationAuthorizations_maxResults' - /Optional/: An integer that specifies the maximum number of VPCs that
-- you want Amazon Route 53 to return. If you don\'t specify a value for
-- @MaxResults@, Route 53 returns up to 50 VPCs per page.
--
-- 'hostedZoneId', 'listVPCAssociationAuthorizations_hostedZoneId' - The ID of the hosted zone for which you want a list of VPCs that can be
-- associated with the hosted zone.
newListVPCAssociationAuthorizations ::
  -- | 'hostedZoneId'
  ResourceId ->
  ListVPCAssociationAuthorizations
newListVPCAssociationAuthorizations :: ResourceId -> ListVPCAssociationAuthorizations
newListVPCAssociationAuthorizations ResourceId
pHostedZoneId_ =
  ListVPCAssociationAuthorizations' :: Maybe Text
-> Maybe Text -> ResourceId -> ListVPCAssociationAuthorizations
ListVPCAssociationAuthorizations'
    { $sel:nextToken:ListVPCAssociationAuthorizations' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListVPCAssociationAuthorizations' :: Maybe Text
maxResults = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:hostedZoneId:ListVPCAssociationAuthorizations' :: ResourceId
hostedZoneId = ResourceId
pHostedZoneId_
    }

-- | /Optional/: If a response includes a @NextToken@ element, there are more
-- VPCs that can be associated with the specified hosted zone. To get the
-- next page of results, submit another request, and include the value of
-- @NextToken@ from the response in the @nexttoken@ parameter in another
-- @ListVPCAssociationAuthorizations@ request.
listVPCAssociationAuthorizations_nextToken :: Lens.Lens' ListVPCAssociationAuthorizations (Prelude.Maybe Prelude.Text)
listVPCAssociationAuthorizations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListVPCAssociationAuthorizations
-> f ListVPCAssociationAuthorizations
listVPCAssociationAuthorizations_nextToken = (ListVPCAssociationAuthorizations -> Maybe Text)
-> (ListVPCAssociationAuthorizations
    -> Maybe Text -> ListVPCAssociationAuthorizations)
-> Lens
     ListVPCAssociationAuthorizations
     ListVPCAssociationAuthorizations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVPCAssociationAuthorizations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListVPCAssociationAuthorizations
s@ListVPCAssociationAuthorizations' {} Maybe Text
a -> ListVPCAssociationAuthorizations
s {$sel:nextToken:ListVPCAssociationAuthorizations' :: Maybe Text
nextToken = Maybe Text
a} :: ListVPCAssociationAuthorizations)

-- | /Optional/: An integer that specifies the maximum number of VPCs that
-- you want Amazon Route 53 to return. If you don\'t specify a value for
-- @MaxResults@, Route 53 returns up to 50 VPCs per page.
listVPCAssociationAuthorizations_maxResults :: Lens.Lens' ListVPCAssociationAuthorizations (Prelude.Maybe Prelude.Text)
listVPCAssociationAuthorizations_maxResults :: (Maybe Text -> f (Maybe Text))
-> ListVPCAssociationAuthorizations
-> f ListVPCAssociationAuthorizations
listVPCAssociationAuthorizations_maxResults = (ListVPCAssociationAuthorizations -> Maybe Text)
-> (ListVPCAssociationAuthorizations
    -> Maybe Text -> ListVPCAssociationAuthorizations)
-> Lens
     ListVPCAssociationAuthorizations
     ListVPCAssociationAuthorizations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVPCAssociationAuthorizations' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: ListVPCAssociationAuthorizations
s@ListVPCAssociationAuthorizations' {} Maybe Text
a -> ListVPCAssociationAuthorizations
s {$sel:maxResults:ListVPCAssociationAuthorizations' :: Maybe Text
maxResults = Maybe Text
a} :: ListVPCAssociationAuthorizations)

-- | The ID of the hosted zone for which you want a list of VPCs that can be
-- associated with the hosted zone.
listVPCAssociationAuthorizations_hostedZoneId :: Lens.Lens' ListVPCAssociationAuthorizations ResourceId
listVPCAssociationAuthorizations_hostedZoneId :: (ResourceId -> f ResourceId)
-> ListVPCAssociationAuthorizations
-> f ListVPCAssociationAuthorizations
listVPCAssociationAuthorizations_hostedZoneId = (ListVPCAssociationAuthorizations -> ResourceId)
-> (ListVPCAssociationAuthorizations
    -> ResourceId -> ListVPCAssociationAuthorizations)
-> Lens
     ListVPCAssociationAuthorizations
     ListVPCAssociationAuthorizations
     ResourceId
     ResourceId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVPCAssociationAuthorizations' {ResourceId
hostedZoneId :: ResourceId
$sel:hostedZoneId:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> ResourceId
hostedZoneId} -> ResourceId
hostedZoneId) (\s :: ListVPCAssociationAuthorizations
s@ListVPCAssociationAuthorizations' {} ResourceId
a -> ListVPCAssociationAuthorizations
s {$sel:hostedZoneId:ListVPCAssociationAuthorizations' :: ResourceId
hostedZoneId = ResourceId
a} :: ListVPCAssociationAuthorizations)

instance
  Core.AWSPager
    ListVPCAssociationAuthorizations
  where
  page :: ListVPCAssociationAuthorizations
-> AWSResponse ListVPCAssociationAuthorizations
-> Maybe ListVPCAssociationAuthorizations
page ListVPCAssociationAuthorizations
rq AWSResponse ListVPCAssociationAuthorizations
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListVPCAssociationAuthorizations
ListVPCAssociationAuthorizationsResponse
rs
            ListVPCAssociationAuthorizationsResponse
-> Getting
     (First Text) ListVPCAssociationAuthorizationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListVPCAssociationAuthorizationsResponse
-> Const (First Text) ListVPCAssociationAuthorizationsResponse
Lens' ListVPCAssociationAuthorizationsResponse (Maybe Text)
listVPCAssociationAuthorizationsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListVPCAssociationAuthorizationsResponse
 -> Const (First Text) ListVPCAssociationAuthorizationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListVPCAssociationAuthorizationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListVPCAssociationAuthorizations
forall a. Maybe a
Prelude.Nothing
    | [VPC] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListVPCAssociationAuthorizations
ListVPCAssociationAuthorizationsResponse
rs
            ListVPCAssociationAuthorizationsResponse
-> Getting [VPC] ListVPCAssociationAuthorizationsResponse [VPC]
-> [VPC]
forall s a. s -> Getting a s a -> a
Lens.^. (NonEmpty VPC -> Const [VPC] (NonEmpty VPC))
-> ListVPCAssociationAuthorizationsResponse
-> Const [VPC] ListVPCAssociationAuthorizationsResponse
Lens' ListVPCAssociationAuthorizationsResponse (NonEmpty VPC)
listVPCAssociationAuthorizationsResponse_vPCs
              ((NonEmpty VPC -> Const [VPC] (NonEmpty VPC))
 -> ListVPCAssociationAuthorizationsResponse
 -> Const [VPC] ListVPCAssociationAuthorizationsResponse)
-> (([VPC] -> Const [VPC] [VPC])
    -> NonEmpty VPC -> Const [VPC] (NonEmpty VPC))
-> Getting [VPC] ListVPCAssociationAuthorizationsResponse [VPC]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty VPC -> [VPC])
-> ([VPC] -> Const [VPC] [VPC])
-> NonEmpty VPC
-> Const [VPC] (NonEmpty VPC)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to NonEmpty VPC -> [VPC]
forall l. IsList l => l -> [Item l]
Prelude.toList
        ) =
      Maybe ListVPCAssociationAuthorizations
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListVPCAssociationAuthorizations
-> Maybe ListVPCAssociationAuthorizations
forall a. a -> Maybe a
Prelude.Just (ListVPCAssociationAuthorizations
 -> Maybe ListVPCAssociationAuthorizations)
-> ListVPCAssociationAuthorizations
-> Maybe ListVPCAssociationAuthorizations
forall a b. (a -> b) -> a -> b
Prelude.$
        ListVPCAssociationAuthorizations
rq
          ListVPCAssociationAuthorizations
-> (ListVPCAssociationAuthorizations
    -> ListVPCAssociationAuthorizations)
-> ListVPCAssociationAuthorizations
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListVPCAssociationAuthorizations
-> Identity ListVPCAssociationAuthorizations
Lens
  ListVPCAssociationAuthorizations
  ListVPCAssociationAuthorizations
  (Maybe Text)
  (Maybe Text)
listVPCAssociationAuthorizations_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListVPCAssociationAuthorizations
 -> Identity ListVPCAssociationAuthorizations)
-> Maybe Text
-> ListVPCAssociationAuthorizations
-> ListVPCAssociationAuthorizations
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListVPCAssociationAuthorizations
ListVPCAssociationAuthorizationsResponse
rs
          ListVPCAssociationAuthorizationsResponse
-> Getting
     (First Text) ListVPCAssociationAuthorizationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListVPCAssociationAuthorizationsResponse
-> Const (First Text) ListVPCAssociationAuthorizationsResponse
Lens' ListVPCAssociationAuthorizationsResponse (Maybe Text)
listVPCAssociationAuthorizationsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListVPCAssociationAuthorizationsResponse
 -> Const (First Text) ListVPCAssociationAuthorizationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListVPCAssociationAuthorizationsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    ListVPCAssociationAuthorizations
  where
  type
    AWSResponse ListVPCAssociationAuthorizations =
      ListVPCAssociationAuthorizationsResponse
  request :: ListVPCAssociationAuthorizations
-> Request ListVPCAssociationAuthorizations
request = Service
-> ListVPCAssociationAuthorizations
-> Request ListVPCAssociationAuthorizations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListVPCAssociationAuthorizations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListVPCAssociationAuthorizations)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse ListVPCAssociationAuthorizations))
-> Logger
-> Service
-> Proxy ListVPCAssociationAuthorizations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListVPCAssociationAuthorizations)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Int
-> ResourceId
-> NonEmpty VPC
-> ListVPCAssociationAuthorizationsResponse
ListVPCAssociationAuthorizationsResponse'
            (Maybe Text
 -> Int
 -> ResourceId
 -> NonEmpty VPC
 -> ListVPCAssociationAuthorizationsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int
      -> ResourceId
      -> NonEmpty VPC
      -> ListVPCAssociationAuthorizationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
            Either
  String
  (Int
   -> ResourceId
   -> NonEmpty VPC
   -> ListVPCAssociationAuthorizationsResponse)
-> Either String Int
-> Either
     String
     (ResourceId
      -> NonEmpty VPC -> ListVPCAssociationAuthorizationsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either
  String
  (ResourceId
   -> NonEmpty VPC -> ListVPCAssociationAuthorizationsResponse)
-> Either String ResourceId
-> Either
     String (NonEmpty VPC -> ListVPCAssociationAuthorizationsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ResourceId
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HostedZoneId")
            Either
  String (NonEmpty VPC -> ListVPCAssociationAuthorizationsResponse)
-> Either String (NonEmpty VPC)
-> Either String ListVPCAssociationAuthorizationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VPCs" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (NonEmpty VPC))
-> Either String (NonEmpty VPC)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= Text -> [Node] -> Either String (NonEmpty VPC)
forall a. FromXML a => Text -> [Node] -> Either String (NonEmpty a)
Core.parseXMLList1 Text
"VPC"
                        )
      )

instance
  Prelude.Hashable
    ListVPCAssociationAuthorizations

instance
  Prelude.NFData
    ListVPCAssociationAuthorizations

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

instance Core.ToPath ListVPCAssociationAuthorizations where
  toPath :: ListVPCAssociationAuthorizations -> ByteString
toPath ListVPCAssociationAuthorizations' {Maybe Text
ResourceId
hostedZoneId :: ResourceId
maxResults :: Maybe Text
nextToken :: Maybe Text
$sel:hostedZoneId:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> ResourceId
$sel:maxResults:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> Maybe Text
$sel:nextToken:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2013-04-01/hostedzone/",
        ResourceId -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ResourceId
hostedZoneId,
        ByteString
"/authorizevpcassociation"
      ]

instance
  Core.ToQuery
    ListVPCAssociationAuthorizations
  where
  toQuery :: ListVPCAssociationAuthorizations -> QueryString
toQuery ListVPCAssociationAuthorizations' {Maybe Text
ResourceId
hostedZoneId :: ResourceId
maxResults :: Maybe Text
nextToken :: Maybe Text
$sel:hostedZoneId:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> ResourceId
$sel:maxResults:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> Maybe Text
$sel:nextToken:ListVPCAssociationAuthorizations' :: ListVPCAssociationAuthorizations -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nexttoken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxresults" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
maxResults
      ]

-- | A complex type that contains the response information for the request.
--
-- /See:/ 'newListVPCAssociationAuthorizationsResponse' smart constructor.
data ListVPCAssociationAuthorizationsResponse = ListVPCAssociationAuthorizationsResponse'
  { -- | When the response includes a @NextToken@ element, there are more VPCs
    -- that can be associated with the specified hosted zone. To get the next
    -- page of VPCs, submit another @ListVPCAssociationAuthorizations@ request,
    -- and include the value of the @NextToken@ element from the response in
    -- the @nexttoken@ request parameter.
    ListVPCAssociationAuthorizationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListVPCAssociationAuthorizationsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The ID of the hosted zone that you can associate the listed VPCs with.
    ListVPCAssociationAuthorizationsResponse -> ResourceId
hostedZoneId :: ResourceId,
    -- | The list of VPCs that are authorized to be associated with the specified
    -- hosted zone.
    ListVPCAssociationAuthorizationsResponse -> NonEmpty VPC
vPCs :: Prelude.NonEmpty VPC
  }
  deriving (ListVPCAssociationAuthorizationsResponse
-> ListVPCAssociationAuthorizationsResponse -> Bool
(ListVPCAssociationAuthorizationsResponse
 -> ListVPCAssociationAuthorizationsResponse -> Bool)
-> (ListVPCAssociationAuthorizationsResponse
    -> ListVPCAssociationAuthorizationsResponse -> Bool)
-> Eq ListVPCAssociationAuthorizationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVPCAssociationAuthorizationsResponse
-> ListVPCAssociationAuthorizationsResponse -> Bool
$c/= :: ListVPCAssociationAuthorizationsResponse
-> ListVPCAssociationAuthorizationsResponse -> Bool
== :: ListVPCAssociationAuthorizationsResponse
-> ListVPCAssociationAuthorizationsResponse -> Bool
$c== :: ListVPCAssociationAuthorizationsResponse
-> ListVPCAssociationAuthorizationsResponse -> Bool
Prelude.Eq, ReadPrec [ListVPCAssociationAuthorizationsResponse]
ReadPrec ListVPCAssociationAuthorizationsResponse
Int -> ReadS ListVPCAssociationAuthorizationsResponse
ReadS [ListVPCAssociationAuthorizationsResponse]
(Int -> ReadS ListVPCAssociationAuthorizationsResponse)
-> ReadS [ListVPCAssociationAuthorizationsResponse]
-> ReadPrec ListVPCAssociationAuthorizationsResponse
-> ReadPrec [ListVPCAssociationAuthorizationsResponse]
-> Read ListVPCAssociationAuthorizationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVPCAssociationAuthorizationsResponse]
$creadListPrec :: ReadPrec [ListVPCAssociationAuthorizationsResponse]
readPrec :: ReadPrec ListVPCAssociationAuthorizationsResponse
$creadPrec :: ReadPrec ListVPCAssociationAuthorizationsResponse
readList :: ReadS [ListVPCAssociationAuthorizationsResponse]
$creadList :: ReadS [ListVPCAssociationAuthorizationsResponse]
readsPrec :: Int -> ReadS ListVPCAssociationAuthorizationsResponse
$creadsPrec :: Int -> ReadS ListVPCAssociationAuthorizationsResponse
Prelude.Read, Int -> ListVPCAssociationAuthorizationsResponse -> ShowS
[ListVPCAssociationAuthorizationsResponse] -> ShowS
ListVPCAssociationAuthorizationsResponse -> String
(Int -> ListVPCAssociationAuthorizationsResponse -> ShowS)
-> (ListVPCAssociationAuthorizationsResponse -> String)
-> ([ListVPCAssociationAuthorizationsResponse] -> ShowS)
-> Show ListVPCAssociationAuthorizationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVPCAssociationAuthorizationsResponse] -> ShowS
$cshowList :: [ListVPCAssociationAuthorizationsResponse] -> ShowS
show :: ListVPCAssociationAuthorizationsResponse -> String
$cshow :: ListVPCAssociationAuthorizationsResponse -> String
showsPrec :: Int -> ListVPCAssociationAuthorizationsResponse -> ShowS
$cshowsPrec :: Int -> ListVPCAssociationAuthorizationsResponse -> ShowS
Prelude.Show, (forall x.
 ListVPCAssociationAuthorizationsResponse
 -> Rep ListVPCAssociationAuthorizationsResponse x)
-> (forall x.
    Rep ListVPCAssociationAuthorizationsResponse x
    -> ListVPCAssociationAuthorizationsResponse)
-> Generic ListVPCAssociationAuthorizationsResponse
forall x.
Rep ListVPCAssociationAuthorizationsResponse x
-> ListVPCAssociationAuthorizationsResponse
forall x.
ListVPCAssociationAuthorizationsResponse
-> Rep ListVPCAssociationAuthorizationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListVPCAssociationAuthorizationsResponse x
-> ListVPCAssociationAuthorizationsResponse
$cfrom :: forall x.
ListVPCAssociationAuthorizationsResponse
-> Rep ListVPCAssociationAuthorizationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListVPCAssociationAuthorizationsResponse' 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', 'listVPCAssociationAuthorizationsResponse_nextToken' - When the response includes a @NextToken@ element, there are more VPCs
-- that can be associated with the specified hosted zone. To get the next
-- page of VPCs, submit another @ListVPCAssociationAuthorizations@ request,
-- and include the value of the @NextToken@ element from the response in
-- the @nexttoken@ request parameter.
--
-- 'httpStatus', 'listVPCAssociationAuthorizationsResponse_httpStatus' - The response's http status code.
--
-- 'hostedZoneId', 'listVPCAssociationAuthorizationsResponse_hostedZoneId' - The ID of the hosted zone that you can associate the listed VPCs with.
--
-- 'vPCs', 'listVPCAssociationAuthorizationsResponse_vPCs' - The list of VPCs that are authorized to be associated with the specified
-- hosted zone.
newListVPCAssociationAuthorizationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'hostedZoneId'
  ResourceId ->
  -- | 'vPCs'
  Prelude.NonEmpty VPC ->
  ListVPCAssociationAuthorizationsResponse
newListVPCAssociationAuthorizationsResponse :: Int
-> ResourceId
-> NonEmpty VPC
-> ListVPCAssociationAuthorizationsResponse
newListVPCAssociationAuthorizationsResponse
  Int
pHttpStatus_
  ResourceId
pHostedZoneId_
  NonEmpty VPC
pVPCs_ =
    ListVPCAssociationAuthorizationsResponse' :: Maybe Text
-> Int
-> ResourceId
-> NonEmpty VPC
-> ListVPCAssociationAuthorizationsResponse
ListVPCAssociationAuthorizationsResponse'
      { $sel:nextToken:ListVPCAssociationAuthorizationsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListVPCAssociationAuthorizationsResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:hostedZoneId:ListVPCAssociationAuthorizationsResponse' :: ResourceId
hostedZoneId = ResourceId
pHostedZoneId_,
        $sel:vPCs:ListVPCAssociationAuthorizationsResponse' :: NonEmpty VPC
vPCs = Tagged (NonEmpty VPC) (Identity (NonEmpty VPC))
-> Tagged (NonEmpty VPC) (Identity (NonEmpty VPC))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty VPC) (Identity (NonEmpty VPC))
 -> Tagged (NonEmpty VPC) (Identity (NonEmpty VPC)))
-> NonEmpty VPC -> NonEmpty VPC
forall t b. AReview t b -> b -> t
Lens.# NonEmpty VPC
pVPCs_
      }

-- | When the response includes a @NextToken@ element, there are more VPCs
-- that can be associated with the specified hosted zone. To get the next
-- page of VPCs, submit another @ListVPCAssociationAuthorizations@ request,
-- and include the value of the @NextToken@ element from the response in
-- the @nexttoken@ request parameter.
listVPCAssociationAuthorizationsResponse_nextToken :: Lens.Lens' ListVPCAssociationAuthorizationsResponse (Prelude.Maybe Prelude.Text)
listVPCAssociationAuthorizationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListVPCAssociationAuthorizationsResponse
-> f ListVPCAssociationAuthorizationsResponse
listVPCAssociationAuthorizationsResponse_nextToken = (ListVPCAssociationAuthorizationsResponse -> Maybe Text)
-> (ListVPCAssociationAuthorizationsResponse
    -> Maybe Text -> ListVPCAssociationAuthorizationsResponse)
-> Lens' ListVPCAssociationAuthorizationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVPCAssociationAuthorizationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListVPCAssociationAuthorizationsResponse' :: ListVPCAssociationAuthorizationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListVPCAssociationAuthorizationsResponse
s@ListVPCAssociationAuthorizationsResponse' {} Maybe Text
a -> ListVPCAssociationAuthorizationsResponse
s {$sel:nextToken:ListVPCAssociationAuthorizationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListVPCAssociationAuthorizationsResponse)

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

-- | The ID of the hosted zone that you can associate the listed VPCs with.
listVPCAssociationAuthorizationsResponse_hostedZoneId :: Lens.Lens' ListVPCAssociationAuthorizationsResponse ResourceId
listVPCAssociationAuthorizationsResponse_hostedZoneId :: (ResourceId -> f ResourceId)
-> ListVPCAssociationAuthorizationsResponse
-> f ListVPCAssociationAuthorizationsResponse
listVPCAssociationAuthorizationsResponse_hostedZoneId = (ListVPCAssociationAuthorizationsResponse -> ResourceId)
-> (ListVPCAssociationAuthorizationsResponse
    -> ResourceId -> ListVPCAssociationAuthorizationsResponse)
-> Lens
     ListVPCAssociationAuthorizationsResponse
     ListVPCAssociationAuthorizationsResponse
     ResourceId
     ResourceId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVPCAssociationAuthorizationsResponse' {ResourceId
hostedZoneId :: ResourceId
$sel:hostedZoneId:ListVPCAssociationAuthorizationsResponse' :: ListVPCAssociationAuthorizationsResponse -> ResourceId
hostedZoneId} -> ResourceId
hostedZoneId) (\s :: ListVPCAssociationAuthorizationsResponse
s@ListVPCAssociationAuthorizationsResponse' {} ResourceId
a -> ListVPCAssociationAuthorizationsResponse
s {$sel:hostedZoneId:ListVPCAssociationAuthorizationsResponse' :: ResourceId
hostedZoneId = ResourceId
a} :: ListVPCAssociationAuthorizationsResponse)

-- | The list of VPCs that are authorized to be associated with the specified
-- hosted zone.
listVPCAssociationAuthorizationsResponse_vPCs :: Lens.Lens' ListVPCAssociationAuthorizationsResponse (Prelude.NonEmpty VPC)
listVPCAssociationAuthorizationsResponse_vPCs :: (NonEmpty VPC -> f (NonEmpty VPC))
-> ListVPCAssociationAuthorizationsResponse
-> f ListVPCAssociationAuthorizationsResponse
listVPCAssociationAuthorizationsResponse_vPCs = (ListVPCAssociationAuthorizationsResponse -> NonEmpty VPC)
-> (ListVPCAssociationAuthorizationsResponse
    -> NonEmpty VPC -> ListVPCAssociationAuthorizationsResponse)
-> Lens' ListVPCAssociationAuthorizationsResponse (NonEmpty VPC)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVPCAssociationAuthorizationsResponse' {NonEmpty VPC
vPCs :: NonEmpty VPC
$sel:vPCs:ListVPCAssociationAuthorizationsResponse' :: ListVPCAssociationAuthorizationsResponse -> NonEmpty VPC
vPCs} -> NonEmpty VPC
vPCs) (\s :: ListVPCAssociationAuthorizationsResponse
s@ListVPCAssociationAuthorizationsResponse' {} NonEmpty VPC
a -> ListVPCAssociationAuthorizationsResponse
s {$sel:vPCs:ListVPCAssociationAuthorizationsResponse' :: NonEmpty VPC
vPCs = NonEmpty VPC
a} :: ListVPCAssociationAuthorizationsResponse) ((NonEmpty VPC -> f (NonEmpty VPC))
 -> ListVPCAssociationAuthorizationsResponse
 -> f ListVPCAssociationAuthorizationsResponse)
-> ((NonEmpty VPC -> f (NonEmpty VPC))
    -> NonEmpty VPC -> f (NonEmpty VPC))
-> (NonEmpty VPC -> f (NonEmpty VPC))
-> ListVPCAssociationAuthorizationsResponse
-> f ListVPCAssociationAuthorizationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty VPC -> f (NonEmpty VPC))
-> NonEmpty VPC -> f (NonEmpty VPC)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    ListVPCAssociationAuthorizationsResponse