{-# 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.Route53Resolver.ListResolverEndpoints
-- 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)
--
-- Lists all the Resolver endpoints that were created using the current
-- Amazon Web Services account.
--
-- This operation returns paginated results.
module Amazonka.Route53Resolver.ListResolverEndpoints
  ( -- * Creating a Request
    ListResolverEndpoints (..),
    newListResolverEndpoints,

    -- * Request Lenses
    listResolverEndpoints_filters,
    listResolverEndpoints_nextToken,
    listResolverEndpoints_maxResults,

    -- * Destructuring the Response
    ListResolverEndpointsResponse (..),
    newListResolverEndpointsResponse,

    -- * Response Lenses
    listResolverEndpointsResponse_resolverEndpoints,
    listResolverEndpointsResponse_nextToken,
    listResolverEndpointsResponse_maxResults,
    listResolverEndpointsResponse_httpStatus,
  )
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.Route53Resolver.Types

-- | /See:/ 'newListResolverEndpoints' smart constructor.
data ListResolverEndpoints = ListResolverEndpoints'
  { -- | An optional specification to return a subset of Resolver endpoints, such
    -- as all inbound Resolver endpoints.
    --
    -- If you submit a second or subsequent @ListResolverEndpoints@ request and
    -- specify the @NextToken@ parameter, you must use the same values for
    -- @Filters@, if any, as in the previous request.
    ListResolverEndpoints -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | For the first @ListResolverEndpoints@ request, omit this value.
    --
    -- If you have more than @MaxResults@ Resolver endpoints, you can submit
    -- another @ListResolverEndpoints@ request to get the next group of
    -- Resolver endpoints. In the next request, specify the value of
    -- @NextToken@ from the previous response.
    ListResolverEndpoints -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of Resolver endpoints that you want to return in the
    -- response to a @ListResolverEndpoints@ request. If you don\'t specify a
    -- value for @MaxResults@, Resolver returns up to 100 Resolver endpoints.
    ListResolverEndpoints -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListResolverEndpoints -> ListResolverEndpoints -> Bool
(ListResolverEndpoints -> ListResolverEndpoints -> Bool)
-> (ListResolverEndpoints -> ListResolverEndpoints -> Bool)
-> Eq ListResolverEndpoints
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResolverEndpoints -> ListResolverEndpoints -> Bool
$c/= :: ListResolverEndpoints -> ListResolverEndpoints -> Bool
== :: ListResolverEndpoints -> ListResolverEndpoints -> Bool
$c== :: ListResolverEndpoints -> ListResolverEndpoints -> Bool
Prelude.Eq, ReadPrec [ListResolverEndpoints]
ReadPrec ListResolverEndpoints
Int -> ReadS ListResolverEndpoints
ReadS [ListResolverEndpoints]
(Int -> ReadS ListResolverEndpoints)
-> ReadS [ListResolverEndpoints]
-> ReadPrec ListResolverEndpoints
-> ReadPrec [ListResolverEndpoints]
-> Read ListResolverEndpoints
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResolverEndpoints]
$creadListPrec :: ReadPrec [ListResolverEndpoints]
readPrec :: ReadPrec ListResolverEndpoints
$creadPrec :: ReadPrec ListResolverEndpoints
readList :: ReadS [ListResolverEndpoints]
$creadList :: ReadS [ListResolverEndpoints]
readsPrec :: Int -> ReadS ListResolverEndpoints
$creadsPrec :: Int -> ReadS ListResolverEndpoints
Prelude.Read, Int -> ListResolverEndpoints -> ShowS
[ListResolverEndpoints] -> ShowS
ListResolverEndpoints -> String
(Int -> ListResolverEndpoints -> ShowS)
-> (ListResolverEndpoints -> String)
-> ([ListResolverEndpoints] -> ShowS)
-> Show ListResolverEndpoints
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResolverEndpoints] -> ShowS
$cshowList :: [ListResolverEndpoints] -> ShowS
show :: ListResolverEndpoints -> String
$cshow :: ListResolverEndpoints -> String
showsPrec :: Int -> ListResolverEndpoints -> ShowS
$cshowsPrec :: Int -> ListResolverEndpoints -> ShowS
Prelude.Show, (forall x. ListResolverEndpoints -> Rep ListResolverEndpoints x)
-> (forall x. Rep ListResolverEndpoints x -> ListResolverEndpoints)
-> Generic ListResolverEndpoints
forall x. Rep ListResolverEndpoints x -> ListResolverEndpoints
forall x. ListResolverEndpoints -> Rep ListResolverEndpoints x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListResolverEndpoints x -> ListResolverEndpoints
$cfrom :: forall x. ListResolverEndpoints -> Rep ListResolverEndpoints x
Prelude.Generic)

-- |
-- Create a value of 'ListResolverEndpoints' 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:
--
-- 'filters', 'listResolverEndpoints_filters' - An optional specification to return a subset of Resolver endpoints, such
-- as all inbound Resolver endpoints.
--
-- If you submit a second or subsequent @ListResolverEndpoints@ request and
-- specify the @NextToken@ parameter, you must use the same values for
-- @Filters@, if any, as in the previous request.
--
-- 'nextToken', 'listResolverEndpoints_nextToken' - For the first @ListResolverEndpoints@ request, omit this value.
--
-- If you have more than @MaxResults@ Resolver endpoints, you can submit
-- another @ListResolverEndpoints@ request to get the next group of
-- Resolver endpoints. In the next request, specify the value of
-- @NextToken@ from the previous response.
--
-- 'maxResults', 'listResolverEndpoints_maxResults' - The maximum number of Resolver endpoints that you want to return in the
-- response to a @ListResolverEndpoints@ request. If you don\'t specify a
-- value for @MaxResults@, Resolver returns up to 100 Resolver endpoints.
newListResolverEndpoints ::
  ListResolverEndpoints
newListResolverEndpoints :: ListResolverEndpoints
newListResolverEndpoints =
  ListResolverEndpoints' :: Maybe [Filter]
-> Maybe Text -> Maybe Natural -> ListResolverEndpoints
ListResolverEndpoints'
    { $sel:filters:ListResolverEndpoints' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResolverEndpoints' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListResolverEndpoints' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | An optional specification to return a subset of Resolver endpoints, such
-- as all inbound Resolver endpoints.
--
-- If you submit a second or subsequent @ListResolverEndpoints@ request and
-- specify the @NextToken@ parameter, you must use the same values for
-- @Filters@, if any, as in the previous request.
listResolverEndpoints_filters :: Lens.Lens' ListResolverEndpoints (Prelude.Maybe [Filter])
listResolverEndpoints_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> ListResolverEndpoints -> f ListResolverEndpoints
listResolverEndpoints_filters = (ListResolverEndpoints -> Maybe [Filter])
-> (ListResolverEndpoints
    -> Maybe [Filter] -> ListResolverEndpoints)
-> Lens
     ListResolverEndpoints
     ListResolverEndpoints
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverEndpoints' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListResolverEndpoints' :: ListResolverEndpoints -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListResolverEndpoints
s@ListResolverEndpoints' {} Maybe [Filter]
a -> ListResolverEndpoints
s {$sel:filters:ListResolverEndpoints' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListResolverEndpoints) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> ListResolverEndpoints -> f ListResolverEndpoints)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> ListResolverEndpoints
-> f ListResolverEndpoints
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 AnIso [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | For the first @ListResolverEndpoints@ request, omit this value.
--
-- If you have more than @MaxResults@ Resolver endpoints, you can submit
-- another @ListResolverEndpoints@ request to get the next group of
-- Resolver endpoints. In the next request, specify the value of
-- @NextToken@ from the previous response.
listResolverEndpoints_nextToken :: Lens.Lens' ListResolverEndpoints (Prelude.Maybe Prelude.Text)
listResolverEndpoints_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResolverEndpoints -> f ListResolverEndpoints
listResolverEndpoints_nextToken = (ListResolverEndpoints -> Maybe Text)
-> (ListResolverEndpoints -> Maybe Text -> ListResolverEndpoints)
-> Lens
     ListResolverEndpoints
     ListResolverEndpoints
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverEndpoints' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResolverEndpoints' :: ListResolverEndpoints -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResolverEndpoints
s@ListResolverEndpoints' {} Maybe Text
a -> ListResolverEndpoints
s {$sel:nextToken:ListResolverEndpoints' :: Maybe Text
nextToken = Maybe Text
a} :: ListResolverEndpoints)

-- | The maximum number of Resolver endpoints that you want to return in the
-- response to a @ListResolverEndpoints@ request. If you don\'t specify a
-- value for @MaxResults@, Resolver returns up to 100 Resolver endpoints.
listResolverEndpoints_maxResults :: Lens.Lens' ListResolverEndpoints (Prelude.Maybe Prelude.Natural)
listResolverEndpoints_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListResolverEndpoints -> f ListResolverEndpoints
listResolverEndpoints_maxResults = (ListResolverEndpoints -> Maybe Natural)
-> (ListResolverEndpoints
    -> Maybe Natural -> ListResolverEndpoints)
-> Lens
     ListResolverEndpoints
     ListResolverEndpoints
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverEndpoints' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResolverEndpoints' :: ListResolverEndpoints -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResolverEndpoints
s@ListResolverEndpoints' {} Maybe Natural
a -> ListResolverEndpoints
s {$sel:maxResults:ListResolverEndpoints' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResolverEndpoints)

instance Core.AWSPager ListResolverEndpoints where
  page :: ListResolverEndpoints
-> AWSResponse ListResolverEndpoints -> Maybe ListResolverEndpoints
page ListResolverEndpoints
rq AWSResponse ListResolverEndpoints
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListResolverEndpoints
ListResolverEndpointsResponse
rs
            ListResolverEndpointsResponse
-> Getting (First Text) ListResolverEndpointsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListResolverEndpointsResponse
-> Const (First Text) ListResolverEndpointsResponse
Lens' ListResolverEndpointsResponse (Maybe Text)
listResolverEndpointsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListResolverEndpointsResponse
 -> Const (First Text) ListResolverEndpointsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListResolverEndpointsResponse 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 ListResolverEndpoints
forall a. Maybe a
Prelude.Nothing
    | Maybe [ResolverEndpoint] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListResolverEndpoints
ListResolverEndpointsResponse
rs
            ListResolverEndpointsResponse
-> Getting
     (First [ResolverEndpoint])
     ListResolverEndpointsResponse
     [ResolverEndpoint]
-> Maybe [ResolverEndpoint]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ResolverEndpoint]
 -> Const (First [ResolverEndpoint]) (Maybe [ResolverEndpoint]))
-> ListResolverEndpointsResponse
-> Const (First [ResolverEndpoint]) ListResolverEndpointsResponse
Lens' ListResolverEndpointsResponse (Maybe [ResolverEndpoint])
listResolverEndpointsResponse_resolverEndpoints
              ((Maybe [ResolverEndpoint]
  -> Const (First [ResolverEndpoint]) (Maybe [ResolverEndpoint]))
 -> ListResolverEndpointsResponse
 -> Const (First [ResolverEndpoint]) ListResolverEndpointsResponse)
-> (([ResolverEndpoint]
     -> Const (First [ResolverEndpoint]) [ResolverEndpoint])
    -> Maybe [ResolverEndpoint]
    -> Const (First [ResolverEndpoint]) (Maybe [ResolverEndpoint]))
-> Getting
     (First [ResolverEndpoint])
     ListResolverEndpointsResponse
     [ResolverEndpoint]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ResolverEndpoint]
 -> Const (First [ResolverEndpoint]) [ResolverEndpoint])
-> Maybe [ResolverEndpoint]
-> Const (First [ResolverEndpoint]) (Maybe [ResolverEndpoint])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListResolverEndpoints
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListResolverEndpoints -> Maybe ListResolverEndpoints
forall a. a -> Maybe a
Prelude.Just (ListResolverEndpoints -> Maybe ListResolverEndpoints)
-> ListResolverEndpoints -> Maybe ListResolverEndpoints
forall a b. (a -> b) -> a -> b
Prelude.$
        ListResolverEndpoints
rq
          ListResolverEndpoints
-> (ListResolverEndpoints -> ListResolverEndpoints)
-> ListResolverEndpoints
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListResolverEndpoints -> Identity ListResolverEndpoints
Lens
  ListResolverEndpoints
  ListResolverEndpoints
  (Maybe Text)
  (Maybe Text)
listResolverEndpoints_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListResolverEndpoints -> Identity ListResolverEndpoints)
-> Maybe Text -> ListResolverEndpoints -> ListResolverEndpoints
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListResolverEndpoints
ListResolverEndpointsResponse
rs
          ListResolverEndpointsResponse
-> Getting (First Text) ListResolverEndpointsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListResolverEndpointsResponse
-> Const (First Text) ListResolverEndpointsResponse
Lens' ListResolverEndpointsResponse (Maybe Text)
listResolverEndpointsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListResolverEndpointsResponse
 -> Const (First Text) ListResolverEndpointsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListResolverEndpointsResponse 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 ListResolverEndpoints where
  type
    AWSResponse ListResolverEndpoints =
      ListResolverEndpointsResponse
  request :: ListResolverEndpoints -> Request ListResolverEndpoints
request = Service -> ListResolverEndpoints -> Request ListResolverEndpoints
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListResolverEndpoints
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListResolverEndpoints)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListResolverEndpoints))
-> Logger
-> Service
-> Proxy ListResolverEndpoints
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListResolverEndpoints)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [ResolverEndpoint]
-> Maybe Text
-> Maybe Natural
-> Int
-> ListResolverEndpointsResponse
ListResolverEndpointsResponse'
            (Maybe [ResolverEndpoint]
 -> Maybe Text
 -> Maybe Natural
 -> Int
 -> ListResolverEndpointsResponse)
-> Either String (Maybe [ResolverEndpoint])
-> Either
     String
     (Maybe Text
      -> Maybe Natural -> Int -> ListResolverEndpointsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ResolverEndpoint]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResolverEndpoints"
                            Either String (Maybe (Maybe [ResolverEndpoint]))
-> Maybe [ResolverEndpoint]
-> Either String (Maybe [ResolverEndpoint])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ResolverEndpoint]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String
  (Maybe Text
   -> Maybe Natural -> Int -> ListResolverEndpointsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Natural -> Int -> ListResolverEndpointsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either
  String (Maybe Natural -> Int -> ListResolverEndpointsResponse)
-> Either String (Maybe Natural)
-> Either String (Int -> ListResolverEndpointsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MaxResults")
            Either String (Int -> ListResolverEndpointsResponse)
-> Either String Int -> Either String ListResolverEndpointsResponse
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))
      )

instance Prelude.Hashable ListResolverEndpoints

instance Prelude.NFData ListResolverEndpoints

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

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

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

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

-- | /See:/ 'newListResolverEndpointsResponse' smart constructor.
data ListResolverEndpointsResponse = ListResolverEndpointsResponse'
  { -- | The Resolver endpoints that were created by using the current Amazon Web
    -- Services account, and that match the specified filters, if any.
    ListResolverEndpointsResponse -> Maybe [ResolverEndpoint]
resolverEndpoints :: Prelude.Maybe [ResolverEndpoint],
    -- | If more than @MaxResults@ IP addresses match the specified criteria, you
    -- can submit another @ListResolverEndpoint@ request to get the next group
    -- of results. In the next request, specify the value of @NextToken@ from
    -- the previous response.
    ListResolverEndpointsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The value that you specified for @MaxResults@ in the request.
    ListResolverEndpointsResponse -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The response's http status code.
    ListResolverEndpointsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListResolverEndpointsResponse
-> ListResolverEndpointsResponse -> Bool
(ListResolverEndpointsResponse
 -> ListResolverEndpointsResponse -> Bool)
-> (ListResolverEndpointsResponse
    -> ListResolverEndpointsResponse -> Bool)
-> Eq ListResolverEndpointsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResolverEndpointsResponse
-> ListResolverEndpointsResponse -> Bool
$c/= :: ListResolverEndpointsResponse
-> ListResolverEndpointsResponse -> Bool
== :: ListResolverEndpointsResponse
-> ListResolverEndpointsResponse -> Bool
$c== :: ListResolverEndpointsResponse
-> ListResolverEndpointsResponse -> Bool
Prelude.Eq, ReadPrec [ListResolverEndpointsResponse]
ReadPrec ListResolverEndpointsResponse
Int -> ReadS ListResolverEndpointsResponse
ReadS [ListResolverEndpointsResponse]
(Int -> ReadS ListResolverEndpointsResponse)
-> ReadS [ListResolverEndpointsResponse]
-> ReadPrec ListResolverEndpointsResponse
-> ReadPrec [ListResolverEndpointsResponse]
-> Read ListResolverEndpointsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResolverEndpointsResponse]
$creadListPrec :: ReadPrec [ListResolverEndpointsResponse]
readPrec :: ReadPrec ListResolverEndpointsResponse
$creadPrec :: ReadPrec ListResolverEndpointsResponse
readList :: ReadS [ListResolverEndpointsResponse]
$creadList :: ReadS [ListResolverEndpointsResponse]
readsPrec :: Int -> ReadS ListResolverEndpointsResponse
$creadsPrec :: Int -> ReadS ListResolverEndpointsResponse
Prelude.Read, Int -> ListResolverEndpointsResponse -> ShowS
[ListResolverEndpointsResponse] -> ShowS
ListResolverEndpointsResponse -> String
(Int -> ListResolverEndpointsResponse -> ShowS)
-> (ListResolverEndpointsResponse -> String)
-> ([ListResolverEndpointsResponse] -> ShowS)
-> Show ListResolverEndpointsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResolverEndpointsResponse] -> ShowS
$cshowList :: [ListResolverEndpointsResponse] -> ShowS
show :: ListResolverEndpointsResponse -> String
$cshow :: ListResolverEndpointsResponse -> String
showsPrec :: Int -> ListResolverEndpointsResponse -> ShowS
$cshowsPrec :: Int -> ListResolverEndpointsResponse -> ShowS
Prelude.Show, (forall x.
 ListResolverEndpointsResponse
 -> Rep ListResolverEndpointsResponse x)
-> (forall x.
    Rep ListResolverEndpointsResponse x
    -> ListResolverEndpointsResponse)
-> Generic ListResolverEndpointsResponse
forall x.
Rep ListResolverEndpointsResponse x
-> ListResolverEndpointsResponse
forall x.
ListResolverEndpointsResponse
-> Rep ListResolverEndpointsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResolverEndpointsResponse x
-> ListResolverEndpointsResponse
$cfrom :: forall x.
ListResolverEndpointsResponse
-> Rep ListResolverEndpointsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListResolverEndpointsResponse' 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:
--
-- 'resolverEndpoints', 'listResolverEndpointsResponse_resolverEndpoints' - The Resolver endpoints that were created by using the current Amazon Web
-- Services account, and that match the specified filters, if any.
--
-- 'nextToken', 'listResolverEndpointsResponse_nextToken' - If more than @MaxResults@ IP addresses match the specified criteria, you
-- can submit another @ListResolverEndpoint@ request to get the next group
-- of results. In the next request, specify the value of @NextToken@ from
-- the previous response.
--
-- 'maxResults', 'listResolverEndpointsResponse_maxResults' - The value that you specified for @MaxResults@ in the request.
--
-- 'httpStatus', 'listResolverEndpointsResponse_httpStatus' - The response's http status code.
newListResolverEndpointsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResolverEndpointsResponse
newListResolverEndpointsResponse :: Int -> ListResolverEndpointsResponse
newListResolverEndpointsResponse Int
pHttpStatus_ =
  ListResolverEndpointsResponse' :: Maybe [ResolverEndpoint]
-> Maybe Text
-> Maybe Natural
-> Int
-> ListResolverEndpointsResponse
ListResolverEndpointsResponse'
    { $sel:resolverEndpoints:ListResolverEndpointsResponse' :: Maybe [ResolverEndpoint]
resolverEndpoints =
        Maybe [ResolverEndpoint]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResolverEndpointsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListResolverEndpointsResponse' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListResolverEndpointsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Resolver endpoints that were created by using the current Amazon Web
-- Services account, and that match the specified filters, if any.
listResolverEndpointsResponse_resolverEndpoints :: Lens.Lens' ListResolverEndpointsResponse (Prelude.Maybe [ResolverEndpoint])
listResolverEndpointsResponse_resolverEndpoints :: (Maybe [ResolverEndpoint] -> f (Maybe [ResolverEndpoint]))
-> ListResolverEndpointsResponse -> f ListResolverEndpointsResponse
listResolverEndpointsResponse_resolverEndpoints = (ListResolverEndpointsResponse -> Maybe [ResolverEndpoint])
-> (ListResolverEndpointsResponse
    -> Maybe [ResolverEndpoint] -> ListResolverEndpointsResponse)
-> Lens' ListResolverEndpointsResponse (Maybe [ResolverEndpoint])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverEndpointsResponse' {Maybe [ResolverEndpoint]
resolverEndpoints :: Maybe [ResolverEndpoint]
$sel:resolverEndpoints:ListResolverEndpointsResponse' :: ListResolverEndpointsResponse -> Maybe [ResolverEndpoint]
resolverEndpoints} -> Maybe [ResolverEndpoint]
resolverEndpoints) (\s :: ListResolverEndpointsResponse
s@ListResolverEndpointsResponse' {} Maybe [ResolverEndpoint]
a -> ListResolverEndpointsResponse
s {$sel:resolverEndpoints:ListResolverEndpointsResponse' :: Maybe [ResolverEndpoint]
resolverEndpoints = Maybe [ResolverEndpoint]
a} :: ListResolverEndpointsResponse) ((Maybe [ResolverEndpoint] -> f (Maybe [ResolverEndpoint]))
 -> ListResolverEndpointsResponse
 -> f ListResolverEndpointsResponse)
-> ((Maybe [ResolverEndpoint] -> f (Maybe [ResolverEndpoint]))
    -> Maybe [ResolverEndpoint] -> f (Maybe [ResolverEndpoint]))
-> (Maybe [ResolverEndpoint] -> f (Maybe [ResolverEndpoint]))
-> ListResolverEndpointsResponse
-> f ListResolverEndpointsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ResolverEndpoint]
  [ResolverEndpoint]
  [ResolverEndpoint]
  [ResolverEndpoint]
-> Iso
     (Maybe [ResolverEndpoint])
     (Maybe [ResolverEndpoint])
     (Maybe [ResolverEndpoint])
     (Maybe [ResolverEndpoint])
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 AnIso
  [ResolverEndpoint]
  [ResolverEndpoint]
  [ResolverEndpoint]
  [ResolverEndpoint]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If more than @MaxResults@ IP addresses match the specified criteria, you
-- can submit another @ListResolverEndpoint@ request to get the next group
-- of results. In the next request, specify the value of @NextToken@ from
-- the previous response.
listResolverEndpointsResponse_nextToken :: Lens.Lens' ListResolverEndpointsResponse (Prelude.Maybe Prelude.Text)
listResolverEndpointsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResolverEndpointsResponse -> f ListResolverEndpointsResponse
listResolverEndpointsResponse_nextToken = (ListResolverEndpointsResponse -> Maybe Text)
-> (ListResolverEndpointsResponse
    -> Maybe Text -> ListResolverEndpointsResponse)
-> Lens' ListResolverEndpointsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverEndpointsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResolverEndpointsResponse' :: ListResolverEndpointsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResolverEndpointsResponse
s@ListResolverEndpointsResponse' {} Maybe Text
a -> ListResolverEndpointsResponse
s {$sel:nextToken:ListResolverEndpointsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListResolverEndpointsResponse)

-- | The value that you specified for @MaxResults@ in the request.
listResolverEndpointsResponse_maxResults :: Lens.Lens' ListResolverEndpointsResponse (Prelude.Maybe Prelude.Natural)
listResolverEndpointsResponse_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListResolverEndpointsResponse -> f ListResolverEndpointsResponse
listResolverEndpointsResponse_maxResults = (ListResolverEndpointsResponse -> Maybe Natural)
-> (ListResolverEndpointsResponse
    -> Maybe Natural -> ListResolverEndpointsResponse)
-> Lens
     ListResolverEndpointsResponse
     ListResolverEndpointsResponse
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverEndpointsResponse' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListResolverEndpointsResponse' :: ListResolverEndpointsResponse -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListResolverEndpointsResponse
s@ListResolverEndpointsResponse' {} Maybe Natural
a -> ListResolverEndpointsResponse
s {$sel:maxResults:ListResolverEndpointsResponse' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListResolverEndpointsResponse)

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

instance Prelude.NFData ListResolverEndpointsResponse