{-# 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.ListResolverEndpointIpAddresses
-- 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 the IP addresses for a specified Resolver endpoint.
--
-- This operation returns paginated results.
module Amazonka.Route53Resolver.ListResolverEndpointIpAddresses
  ( -- * Creating a Request
    ListResolverEndpointIpAddresses (..),
    newListResolverEndpointIpAddresses,

    -- * Request Lenses
    listResolverEndpointIpAddresses_nextToken,
    listResolverEndpointIpAddresses_maxResults,
    listResolverEndpointIpAddresses_resolverEndpointId,

    -- * Destructuring the Response
    ListResolverEndpointIpAddressesResponse (..),
    newListResolverEndpointIpAddressesResponse,

    -- * Response Lenses
    listResolverEndpointIpAddressesResponse_nextToken,
    listResolverEndpointIpAddressesResponse_maxResults,
    listResolverEndpointIpAddressesResponse_ipAddresses,
    listResolverEndpointIpAddressesResponse_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:/ 'newListResolverEndpointIpAddresses' smart constructor.
data ListResolverEndpointIpAddresses = ListResolverEndpointIpAddresses'
  { -- | For the first @ListResolverEndpointIpAddresses@ request, omit this
    -- value.
    --
    -- If the specified Resolver endpoint has more than @MaxResults@ IP
    -- addresses, you can submit another @ListResolverEndpointIpAddresses@
    -- request to get the next group of IP addresses. In the next request,
    -- specify the value of @NextToken@ from the previous response.
    ListResolverEndpointIpAddresses -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of IP addresses that you want to return in the
    -- response to a @ListResolverEndpointIpAddresses@ request. If you don\'t
    -- specify a value for @MaxResults@, Resolver returns up to 100 IP
    -- addresses.
    ListResolverEndpointIpAddresses -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the Resolver endpoint that you want to get IP addresses for.
    ListResolverEndpointIpAddresses -> Text
resolverEndpointId :: Prelude.Text
  }
  deriving (ListResolverEndpointIpAddresses
-> ListResolverEndpointIpAddresses -> Bool
(ListResolverEndpointIpAddresses
 -> ListResolverEndpointIpAddresses -> Bool)
-> (ListResolverEndpointIpAddresses
    -> ListResolverEndpointIpAddresses -> Bool)
-> Eq ListResolverEndpointIpAddresses
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResolverEndpointIpAddresses
-> ListResolverEndpointIpAddresses -> Bool
$c/= :: ListResolverEndpointIpAddresses
-> ListResolverEndpointIpAddresses -> Bool
== :: ListResolverEndpointIpAddresses
-> ListResolverEndpointIpAddresses -> Bool
$c== :: ListResolverEndpointIpAddresses
-> ListResolverEndpointIpAddresses -> Bool
Prelude.Eq, ReadPrec [ListResolverEndpointIpAddresses]
ReadPrec ListResolverEndpointIpAddresses
Int -> ReadS ListResolverEndpointIpAddresses
ReadS [ListResolverEndpointIpAddresses]
(Int -> ReadS ListResolverEndpointIpAddresses)
-> ReadS [ListResolverEndpointIpAddresses]
-> ReadPrec ListResolverEndpointIpAddresses
-> ReadPrec [ListResolverEndpointIpAddresses]
-> Read ListResolverEndpointIpAddresses
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResolverEndpointIpAddresses]
$creadListPrec :: ReadPrec [ListResolverEndpointIpAddresses]
readPrec :: ReadPrec ListResolverEndpointIpAddresses
$creadPrec :: ReadPrec ListResolverEndpointIpAddresses
readList :: ReadS [ListResolverEndpointIpAddresses]
$creadList :: ReadS [ListResolverEndpointIpAddresses]
readsPrec :: Int -> ReadS ListResolverEndpointIpAddresses
$creadsPrec :: Int -> ReadS ListResolverEndpointIpAddresses
Prelude.Read, Int -> ListResolverEndpointIpAddresses -> ShowS
[ListResolverEndpointIpAddresses] -> ShowS
ListResolverEndpointIpAddresses -> String
(Int -> ListResolverEndpointIpAddresses -> ShowS)
-> (ListResolverEndpointIpAddresses -> String)
-> ([ListResolverEndpointIpAddresses] -> ShowS)
-> Show ListResolverEndpointIpAddresses
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResolverEndpointIpAddresses] -> ShowS
$cshowList :: [ListResolverEndpointIpAddresses] -> ShowS
show :: ListResolverEndpointIpAddresses -> String
$cshow :: ListResolverEndpointIpAddresses -> String
showsPrec :: Int -> ListResolverEndpointIpAddresses -> ShowS
$cshowsPrec :: Int -> ListResolverEndpointIpAddresses -> ShowS
Prelude.Show, (forall x.
 ListResolverEndpointIpAddresses
 -> Rep ListResolverEndpointIpAddresses x)
-> (forall x.
    Rep ListResolverEndpointIpAddresses x
    -> ListResolverEndpointIpAddresses)
-> Generic ListResolverEndpointIpAddresses
forall x.
Rep ListResolverEndpointIpAddresses x
-> ListResolverEndpointIpAddresses
forall x.
ListResolverEndpointIpAddresses
-> Rep ListResolverEndpointIpAddresses x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResolverEndpointIpAddresses x
-> ListResolverEndpointIpAddresses
$cfrom :: forall x.
ListResolverEndpointIpAddresses
-> Rep ListResolverEndpointIpAddresses x
Prelude.Generic)

-- |
-- Create a value of 'ListResolverEndpointIpAddresses' 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', 'listResolverEndpointIpAddresses_nextToken' - For the first @ListResolverEndpointIpAddresses@ request, omit this
-- value.
--
-- If the specified Resolver endpoint has more than @MaxResults@ IP
-- addresses, you can submit another @ListResolverEndpointIpAddresses@
-- request to get the next group of IP addresses. In the next request,
-- specify the value of @NextToken@ from the previous response.
--
-- 'maxResults', 'listResolverEndpointIpAddresses_maxResults' - The maximum number of IP addresses that you want to return in the
-- response to a @ListResolverEndpointIpAddresses@ request. If you don\'t
-- specify a value for @MaxResults@, Resolver returns up to 100 IP
-- addresses.
--
-- 'resolverEndpointId', 'listResolverEndpointIpAddresses_resolverEndpointId' - The ID of the Resolver endpoint that you want to get IP addresses for.
newListResolverEndpointIpAddresses ::
  -- | 'resolverEndpointId'
  Prelude.Text ->
  ListResolverEndpointIpAddresses
newListResolverEndpointIpAddresses :: Text -> ListResolverEndpointIpAddresses
newListResolverEndpointIpAddresses
  Text
pResolverEndpointId_ =
    ListResolverEndpointIpAddresses' :: Maybe Text
-> Maybe Natural -> Text -> ListResolverEndpointIpAddresses
ListResolverEndpointIpAddresses'
      { $sel:nextToken:ListResolverEndpointIpAddresses' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListResolverEndpointIpAddresses' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:resolverEndpointId:ListResolverEndpointIpAddresses' :: Text
resolverEndpointId = Text
pResolverEndpointId_
      }

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

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

-- | The ID of the Resolver endpoint that you want to get IP addresses for.
listResolverEndpointIpAddresses_resolverEndpointId :: Lens.Lens' ListResolverEndpointIpAddresses Prelude.Text
listResolverEndpointIpAddresses_resolverEndpointId :: (Text -> f Text)
-> ListResolverEndpointIpAddresses
-> f ListResolverEndpointIpAddresses
listResolverEndpointIpAddresses_resolverEndpointId = (ListResolverEndpointIpAddresses -> Text)
-> (ListResolverEndpointIpAddresses
    -> Text -> ListResolverEndpointIpAddresses)
-> Lens
     ListResolverEndpointIpAddresses
     ListResolverEndpointIpAddresses
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverEndpointIpAddresses' {Text
resolverEndpointId :: Text
$sel:resolverEndpointId:ListResolverEndpointIpAddresses' :: ListResolverEndpointIpAddresses -> Text
resolverEndpointId} -> Text
resolverEndpointId) (\s :: ListResolverEndpointIpAddresses
s@ListResolverEndpointIpAddresses' {} Text
a -> ListResolverEndpointIpAddresses
s {$sel:resolverEndpointId:ListResolverEndpointIpAddresses' :: Text
resolverEndpointId = Text
a} :: ListResolverEndpointIpAddresses)

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

instance
  Prelude.NFData
    ListResolverEndpointIpAddresses

instance
  Core.ToHeaders
    ListResolverEndpointIpAddresses
  where
  toHeaders :: ListResolverEndpointIpAddresses -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListResolverEndpointIpAddresses -> 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.ListResolverEndpointIpAddresses" ::
                          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 ListResolverEndpointIpAddresses where
  toJSON :: ListResolverEndpointIpAddresses -> Value
toJSON ListResolverEndpointIpAddresses' {Maybe Natural
Maybe Text
Text
resolverEndpointId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:resolverEndpointId:ListResolverEndpointIpAddresses' :: ListResolverEndpointIpAddresses -> Text
$sel:maxResults:ListResolverEndpointIpAddresses' :: ListResolverEndpointIpAddresses -> Maybe Natural
$sel:nextToken:ListResolverEndpointIpAddresses' :: ListResolverEndpointIpAddresses -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ResolverEndpointId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resolverEndpointId)
          ]
      )

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

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

-- | /See:/ 'newListResolverEndpointIpAddressesResponse' smart constructor.
data ListResolverEndpointIpAddressesResponse = ListResolverEndpointIpAddressesResponse'
  { -- | If the specified endpoint has more than @MaxResults@ IP addresses, you
    -- can submit another @ListResolverEndpointIpAddresses@ request to get the
    -- next group of IP addresses. In the next request, specify the value of
    -- @NextToken@ from the previous response.
    ListResolverEndpointIpAddressesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The value that you specified for @MaxResults@ in the request.
    ListResolverEndpointIpAddressesResponse -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Information about the IP addresses in your VPC that DNS queries
    -- originate from (for outbound endpoints) or that you forward DNS queries
    -- to (for inbound endpoints).
    ListResolverEndpointIpAddressesResponse
-> Maybe [IpAddressResponse]
ipAddresses :: Prelude.Maybe [IpAddressResponse],
    -- | The response's http status code.
    ListResolverEndpointIpAddressesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListResolverEndpointIpAddressesResponse
-> ListResolverEndpointIpAddressesResponse -> Bool
(ListResolverEndpointIpAddressesResponse
 -> ListResolverEndpointIpAddressesResponse -> Bool)
-> (ListResolverEndpointIpAddressesResponse
    -> ListResolverEndpointIpAddressesResponse -> Bool)
-> Eq ListResolverEndpointIpAddressesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListResolverEndpointIpAddressesResponse
-> ListResolverEndpointIpAddressesResponse -> Bool
$c/= :: ListResolverEndpointIpAddressesResponse
-> ListResolverEndpointIpAddressesResponse -> Bool
== :: ListResolverEndpointIpAddressesResponse
-> ListResolverEndpointIpAddressesResponse -> Bool
$c== :: ListResolverEndpointIpAddressesResponse
-> ListResolverEndpointIpAddressesResponse -> Bool
Prelude.Eq, ReadPrec [ListResolverEndpointIpAddressesResponse]
ReadPrec ListResolverEndpointIpAddressesResponse
Int -> ReadS ListResolverEndpointIpAddressesResponse
ReadS [ListResolverEndpointIpAddressesResponse]
(Int -> ReadS ListResolverEndpointIpAddressesResponse)
-> ReadS [ListResolverEndpointIpAddressesResponse]
-> ReadPrec ListResolverEndpointIpAddressesResponse
-> ReadPrec [ListResolverEndpointIpAddressesResponse]
-> Read ListResolverEndpointIpAddressesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListResolverEndpointIpAddressesResponse]
$creadListPrec :: ReadPrec [ListResolverEndpointIpAddressesResponse]
readPrec :: ReadPrec ListResolverEndpointIpAddressesResponse
$creadPrec :: ReadPrec ListResolverEndpointIpAddressesResponse
readList :: ReadS [ListResolverEndpointIpAddressesResponse]
$creadList :: ReadS [ListResolverEndpointIpAddressesResponse]
readsPrec :: Int -> ReadS ListResolverEndpointIpAddressesResponse
$creadsPrec :: Int -> ReadS ListResolverEndpointIpAddressesResponse
Prelude.Read, Int -> ListResolverEndpointIpAddressesResponse -> ShowS
[ListResolverEndpointIpAddressesResponse] -> ShowS
ListResolverEndpointIpAddressesResponse -> String
(Int -> ListResolverEndpointIpAddressesResponse -> ShowS)
-> (ListResolverEndpointIpAddressesResponse -> String)
-> ([ListResolverEndpointIpAddressesResponse] -> ShowS)
-> Show ListResolverEndpointIpAddressesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListResolverEndpointIpAddressesResponse] -> ShowS
$cshowList :: [ListResolverEndpointIpAddressesResponse] -> ShowS
show :: ListResolverEndpointIpAddressesResponse -> String
$cshow :: ListResolverEndpointIpAddressesResponse -> String
showsPrec :: Int -> ListResolverEndpointIpAddressesResponse -> ShowS
$cshowsPrec :: Int -> ListResolverEndpointIpAddressesResponse -> ShowS
Prelude.Show, (forall x.
 ListResolverEndpointIpAddressesResponse
 -> Rep ListResolverEndpointIpAddressesResponse x)
-> (forall x.
    Rep ListResolverEndpointIpAddressesResponse x
    -> ListResolverEndpointIpAddressesResponse)
-> Generic ListResolverEndpointIpAddressesResponse
forall x.
Rep ListResolverEndpointIpAddressesResponse x
-> ListResolverEndpointIpAddressesResponse
forall x.
ListResolverEndpointIpAddressesResponse
-> Rep ListResolverEndpointIpAddressesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListResolverEndpointIpAddressesResponse x
-> ListResolverEndpointIpAddressesResponse
$cfrom :: forall x.
ListResolverEndpointIpAddressesResponse
-> Rep ListResolverEndpointIpAddressesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListResolverEndpointIpAddressesResponse' 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', 'listResolverEndpointIpAddressesResponse_nextToken' - If the specified endpoint has more than @MaxResults@ IP addresses, you
-- can submit another @ListResolverEndpointIpAddresses@ request to get the
-- next group of IP addresses. In the next request, specify the value of
-- @NextToken@ from the previous response.
--
-- 'maxResults', 'listResolverEndpointIpAddressesResponse_maxResults' - The value that you specified for @MaxResults@ in the request.
--
-- 'ipAddresses', 'listResolverEndpointIpAddressesResponse_ipAddresses' - Information about the IP addresses in your VPC that DNS queries
-- originate from (for outbound endpoints) or that you forward DNS queries
-- to (for inbound endpoints).
--
-- 'httpStatus', 'listResolverEndpointIpAddressesResponse_httpStatus' - The response's http status code.
newListResolverEndpointIpAddressesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResolverEndpointIpAddressesResponse
newListResolverEndpointIpAddressesResponse :: Int -> ListResolverEndpointIpAddressesResponse
newListResolverEndpointIpAddressesResponse
  Int
pHttpStatus_ =
    ListResolverEndpointIpAddressesResponse' :: Maybe Text
-> Maybe Natural
-> Maybe [IpAddressResponse]
-> Int
-> ListResolverEndpointIpAddressesResponse
ListResolverEndpointIpAddressesResponse'
      { $sel:nextToken:ListResolverEndpointIpAddressesResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListResolverEndpointIpAddressesResponse' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:ipAddresses:ListResolverEndpointIpAddressesResponse' :: Maybe [IpAddressResponse]
ipAddresses = Maybe [IpAddressResponse]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListResolverEndpointIpAddressesResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

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

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

-- | Information about the IP addresses in your VPC that DNS queries
-- originate from (for outbound endpoints) or that you forward DNS queries
-- to (for inbound endpoints).
listResolverEndpointIpAddressesResponse_ipAddresses :: Lens.Lens' ListResolverEndpointIpAddressesResponse (Prelude.Maybe [IpAddressResponse])
listResolverEndpointIpAddressesResponse_ipAddresses :: (Maybe [IpAddressResponse] -> f (Maybe [IpAddressResponse]))
-> ListResolverEndpointIpAddressesResponse
-> f ListResolverEndpointIpAddressesResponse
listResolverEndpointIpAddressesResponse_ipAddresses = (ListResolverEndpointIpAddressesResponse
 -> Maybe [IpAddressResponse])
-> (ListResolverEndpointIpAddressesResponse
    -> Maybe [IpAddressResponse]
    -> ListResolverEndpointIpAddressesResponse)
-> Lens'
     ListResolverEndpointIpAddressesResponse (Maybe [IpAddressResponse])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverEndpointIpAddressesResponse' {Maybe [IpAddressResponse]
ipAddresses :: Maybe [IpAddressResponse]
$sel:ipAddresses:ListResolverEndpointIpAddressesResponse' :: ListResolverEndpointIpAddressesResponse
-> Maybe [IpAddressResponse]
ipAddresses} -> Maybe [IpAddressResponse]
ipAddresses) (\s :: ListResolverEndpointIpAddressesResponse
s@ListResolverEndpointIpAddressesResponse' {} Maybe [IpAddressResponse]
a -> ListResolverEndpointIpAddressesResponse
s {$sel:ipAddresses:ListResolverEndpointIpAddressesResponse' :: Maybe [IpAddressResponse]
ipAddresses = Maybe [IpAddressResponse]
a} :: ListResolverEndpointIpAddressesResponse) ((Maybe [IpAddressResponse] -> f (Maybe [IpAddressResponse]))
 -> ListResolverEndpointIpAddressesResponse
 -> f ListResolverEndpointIpAddressesResponse)
-> ((Maybe [IpAddressResponse] -> f (Maybe [IpAddressResponse]))
    -> Maybe [IpAddressResponse] -> f (Maybe [IpAddressResponse]))
-> (Maybe [IpAddressResponse] -> f (Maybe [IpAddressResponse]))
-> ListResolverEndpointIpAddressesResponse
-> f ListResolverEndpointIpAddressesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [IpAddressResponse]
  [IpAddressResponse]
  [IpAddressResponse]
  [IpAddressResponse]
-> Iso
     (Maybe [IpAddressResponse])
     (Maybe [IpAddressResponse])
     (Maybe [IpAddressResponse])
     (Maybe [IpAddressResponse])
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
  [IpAddressResponse]
  [IpAddressResponse]
  [IpAddressResponse]
  [IpAddressResponse]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListResolverEndpointIpAddressesResponse