{-# 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.AppRunner.ListVpcConnectors
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of App Runner VPC connectors in your Amazon Web Services
-- account.
module Amazonka.AppRunner.ListVpcConnectors
  ( -- * Creating a Request
    ListVpcConnectors (..),
    newListVpcConnectors,

    -- * Request Lenses
    listVpcConnectors_maxResults,
    listVpcConnectors_nextToken,

    -- * Destructuring the Response
    ListVpcConnectorsResponse (..),
    newListVpcConnectorsResponse,

    -- * Response Lenses
    listVpcConnectorsResponse_nextToken,
    listVpcConnectorsResponse_httpStatus,
    listVpcConnectorsResponse_vpcConnectors,
  )
where

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

-- | /See:/ 'newListVpcConnectors' smart constructor.
data ListVpcConnectors = ListVpcConnectors'
  { -- | The maximum number of results to include in each response (result page).
    -- It\'s used for a paginated request.
    --
    -- If you don\'t specify @MaxResults@, the request retrieves all available
    -- results in a single response.
    ListVpcConnectors -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A token from a previous result page. It\'s used for a paginated request.
    -- The request retrieves the next result page. All other parameter values
    -- must be identical to the ones that are specified in the initial request.
    --
    -- If you don\'t specify @NextToken@, the request retrieves the first
    -- result page.
    ListVpcConnectors -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListVpcConnectors -> ListVpcConnectors -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVpcConnectors -> ListVpcConnectors -> Bool
$c/= :: ListVpcConnectors -> ListVpcConnectors -> Bool
== :: ListVpcConnectors -> ListVpcConnectors -> Bool
$c== :: ListVpcConnectors -> ListVpcConnectors -> Bool
Prelude.Eq, ReadPrec [ListVpcConnectors]
ReadPrec ListVpcConnectors
Int -> ReadS ListVpcConnectors
ReadS [ListVpcConnectors]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVpcConnectors]
$creadListPrec :: ReadPrec [ListVpcConnectors]
readPrec :: ReadPrec ListVpcConnectors
$creadPrec :: ReadPrec ListVpcConnectors
readList :: ReadS [ListVpcConnectors]
$creadList :: ReadS [ListVpcConnectors]
readsPrec :: Int -> ReadS ListVpcConnectors
$creadsPrec :: Int -> ReadS ListVpcConnectors
Prelude.Read, Int -> ListVpcConnectors -> ShowS
[ListVpcConnectors] -> ShowS
ListVpcConnectors -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVpcConnectors] -> ShowS
$cshowList :: [ListVpcConnectors] -> ShowS
show :: ListVpcConnectors -> String
$cshow :: ListVpcConnectors -> String
showsPrec :: Int -> ListVpcConnectors -> ShowS
$cshowsPrec :: Int -> ListVpcConnectors -> ShowS
Prelude.Show, forall x. Rep ListVpcConnectors x -> ListVpcConnectors
forall x. ListVpcConnectors -> Rep ListVpcConnectors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListVpcConnectors x -> ListVpcConnectors
$cfrom :: forall x. ListVpcConnectors -> Rep ListVpcConnectors x
Prelude.Generic)

-- |
-- Create a value of 'ListVpcConnectors' 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:
--
-- 'maxResults', 'listVpcConnectors_maxResults' - The maximum number of results to include in each response (result page).
-- It\'s used for a paginated request.
--
-- If you don\'t specify @MaxResults@, the request retrieves all available
-- results in a single response.
--
-- 'nextToken', 'listVpcConnectors_nextToken' - A token from a previous result page. It\'s used for a paginated request.
-- The request retrieves the next result page. All other parameter values
-- must be identical to the ones that are specified in the initial request.
--
-- If you don\'t specify @NextToken@, the request retrieves the first
-- result page.
newListVpcConnectors ::
  ListVpcConnectors
newListVpcConnectors :: ListVpcConnectors
newListVpcConnectors =
  ListVpcConnectors'
    { $sel:maxResults:ListVpcConnectors' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListVpcConnectors' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of results to include in each response (result page).
-- It\'s used for a paginated request.
--
-- If you don\'t specify @MaxResults@, the request retrieves all available
-- results in a single response.
listVpcConnectors_maxResults :: Lens.Lens' ListVpcConnectors (Prelude.Maybe Prelude.Natural)
listVpcConnectors_maxResults :: Lens' ListVpcConnectors (Maybe Natural)
listVpcConnectors_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVpcConnectors' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListVpcConnectors' :: ListVpcConnectors -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListVpcConnectors
s@ListVpcConnectors' {} Maybe Natural
a -> ListVpcConnectors
s {$sel:maxResults:ListVpcConnectors' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListVpcConnectors)

-- | A token from a previous result page. It\'s used for a paginated request.
-- The request retrieves the next result page. All other parameter values
-- must be identical to the ones that are specified in the initial request.
--
-- If you don\'t specify @NextToken@, the request retrieves the first
-- result page.
listVpcConnectors_nextToken :: Lens.Lens' ListVpcConnectors (Prelude.Maybe Prelude.Text)
listVpcConnectors_nextToken :: Lens' ListVpcConnectors (Maybe Text)
listVpcConnectors_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVpcConnectors' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListVpcConnectors' :: ListVpcConnectors -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListVpcConnectors
s@ListVpcConnectors' {} Maybe Text
a -> ListVpcConnectors
s {$sel:nextToken:ListVpcConnectors' :: Maybe Text
nextToken = Maybe Text
a} :: ListVpcConnectors)

instance Core.AWSRequest ListVpcConnectors where
  type
    AWSResponse ListVpcConnectors =
      ListVpcConnectorsResponse
  request :: (Service -> Service)
-> ListVpcConnectors -> Request ListVpcConnectors
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListVpcConnectors
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListVpcConnectors)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> [VpcConnector] -> ListVpcConnectorsResponse
ListVpcConnectorsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VpcConnectors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListVpcConnectors where
  hashWithSalt :: Int -> ListVpcConnectors -> Int
hashWithSalt Int
_salt ListVpcConnectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListVpcConnectors' :: ListVpcConnectors -> Maybe Text
$sel:maxResults:ListVpcConnectors' :: ListVpcConnectors -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListVpcConnectors where
  rnf :: ListVpcConnectors -> ()
rnf ListVpcConnectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListVpcConnectors' :: ListVpcConnectors -> Maybe Text
$sel:maxResults:ListVpcConnectors' :: ListVpcConnectors -> Maybe Natural
..} =
    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

instance Data.ToHeaders ListVpcConnectors where
  toHeaders :: ListVpcConnectors -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AppRunner.ListVpcConnectors" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListVpcConnectors where
  toJSON :: ListVpcConnectors -> Value
toJSON ListVpcConnectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListVpcConnectors' :: ListVpcConnectors -> Maybe Text
$sel:maxResults:ListVpcConnectors' :: ListVpcConnectors -> Maybe Natural
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
          ]
      )

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

instance Data.ToQuery ListVpcConnectors where
  toQuery :: ListVpcConnectors -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListVpcConnectorsResponse' smart constructor.
data ListVpcConnectorsResponse = ListVpcConnectorsResponse'
  { -- | The token that you can pass in a subsequent request to get the next
    -- result page. It\'s returned in a paginated request.
    ListVpcConnectorsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListVpcConnectorsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A list of information records for VPC connectors. In a paginated
    -- request, the request returns up to @MaxResults@ records for each call.
    ListVpcConnectorsResponse -> [VpcConnector]
vpcConnectors :: [VpcConnector]
  }
  deriving (ListVpcConnectorsResponse -> ListVpcConnectorsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVpcConnectorsResponse -> ListVpcConnectorsResponse -> Bool
$c/= :: ListVpcConnectorsResponse -> ListVpcConnectorsResponse -> Bool
== :: ListVpcConnectorsResponse -> ListVpcConnectorsResponse -> Bool
$c== :: ListVpcConnectorsResponse -> ListVpcConnectorsResponse -> Bool
Prelude.Eq, ReadPrec [ListVpcConnectorsResponse]
ReadPrec ListVpcConnectorsResponse
Int -> ReadS ListVpcConnectorsResponse
ReadS [ListVpcConnectorsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVpcConnectorsResponse]
$creadListPrec :: ReadPrec [ListVpcConnectorsResponse]
readPrec :: ReadPrec ListVpcConnectorsResponse
$creadPrec :: ReadPrec ListVpcConnectorsResponse
readList :: ReadS [ListVpcConnectorsResponse]
$creadList :: ReadS [ListVpcConnectorsResponse]
readsPrec :: Int -> ReadS ListVpcConnectorsResponse
$creadsPrec :: Int -> ReadS ListVpcConnectorsResponse
Prelude.Read, Int -> ListVpcConnectorsResponse -> ShowS
[ListVpcConnectorsResponse] -> ShowS
ListVpcConnectorsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVpcConnectorsResponse] -> ShowS
$cshowList :: [ListVpcConnectorsResponse] -> ShowS
show :: ListVpcConnectorsResponse -> String
$cshow :: ListVpcConnectorsResponse -> String
showsPrec :: Int -> ListVpcConnectorsResponse -> ShowS
$cshowsPrec :: Int -> ListVpcConnectorsResponse -> ShowS
Prelude.Show, forall x.
Rep ListVpcConnectorsResponse x -> ListVpcConnectorsResponse
forall x.
ListVpcConnectorsResponse -> Rep ListVpcConnectorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListVpcConnectorsResponse x -> ListVpcConnectorsResponse
$cfrom :: forall x.
ListVpcConnectorsResponse -> Rep ListVpcConnectorsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListVpcConnectorsResponse' 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', 'listVpcConnectorsResponse_nextToken' - The token that you can pass in a subsequent request to get the next
-- result page. It\'s returned in a paginated request.
--
-- 'httpStatus', 'listVpcConnectorsResponse_httpStatus' - The response's http status code.
--
-- 'vpcConnectors', 'listVpcConnectorsResponse_vpcConnectors' - A list of information records for VPC connectors. In a paginated
-- request, the request returns up to @MaxResults@ records for each call.
newListVpcConnectorsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListVpcConnectorsResponse
newListVpcConnectorsResponse :: Int -> ListVpcConnectorsResponse
newListVpcConnectorsResponse Int
pHttpStatus_ =
  ListVpcConnectorsResponse'
    { $sel:nextToken:ListVpcConnectorsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListVpcConnectorsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:vpcConnectors:ListVpcConnectorsResponse' :: [VpcConnector]
vpcConnectors = forall a. Monoid a => a
Prelude.mempty
    }

-- | The token that you can pass in a subsequent request to get the next
-- result page. It\'s returned in a paginated request.
listVpcConnectorsResponse_nextToken :: Lens.Lens' ListVpcConnectorsResponse (Prelude.Maybe Prelude.Text)
listVpcConnectorsResponse_nextToken :: Lens' ListVpcConnectorsResponse (Maybe Text)
listVpcConnectorsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVpcConnectorsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListVpcConnectorsResponse' :: ListVpcConnectorsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListVpcConnectorsResponse
s@ListVpcConnectorsResponse' {} Maybe Text
a -> ListVpcConnectorsResponse
s {$sel:nextToken:ListVpcConnectorsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListVpcConnectorsResponse)

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

-- | A list of information records for VPC connectors. In a paginated
-- request, the request returns up to @MaxResults@ records for each call.
listVpcConnectorsResponse_vpcConnectors :: Lens.Lens' ListVpcConnectorsResponse [VpcConnector]
listVpcConnectorsResponse_vpcConnectors :: Lens' ListVpcConnectorsResponse [VpcConnector]
listVpcConnectorsResponse_vpcConnectors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVpcConnectorsResponse' {[VpcConnector]
vpcConnectors :: [VpcConnector]
$sel:vpcConnectors:ListVpcConnectorsResponse' :: ListVpcConnectorsResponse -> [VpcConnector]
vpcConnectors} -> [VpcConnector]
vpcConnectors) (\s :: ListVpcConnectorsResponse
s@ListVpcConnectorsResponse' {} [VpcConnector]
a -> ListVpcConnectorsResponse
s {$sel:vpcConnectors:ListVpcConnectorsResponse' :: [VpcConnector]
vpcConnectors = [VpcConnector]
a} :: ListVpcConnectorsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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