{-# 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.ListResolverRuleAssociations
-- 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 the associations that were created between Resolver rules and VPCs
-- using the current Amazon Web Services account.
--
-- This operation returns paginated results.
module Amazonka.Route53Resolver.ListResolverRuleAssociations
  ( -- * Creating a Request
    ListResolverRuleAssociations (..),
    newListResolverRuleAssociations,

    -- * Request Lenses
    listResolverRuleAssociations_filters,
    listResolverRuleAssociations_nextToken,
    listResolverRuleAssociations_maxResults,

    -- * Destructuring the Response
    ListResolverRuleAssociationsResponse (..),
    newListResolverRuleAssociationsResponse,

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

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

-- | An optional specification to return a subset of Resolver rules, such as
-- Resolver rules that are associated with the same VPC ID.
--
-- If you submit a second or subsequent @ListResolverRuleAssociations@
-- request and specify the @NextToken@ parameter, you must use the same
-- values for @Filters@, if any, as in the previous request.
listResolverRuleAssociations_filters :: Lens.Lens' ListResolverRuleAssociations (Prelude.Maybe [Filter])
listResolverRuleAssociations_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> ListResolverRuleAssociations -> f ListResolverRuleAssociations
listResolverRuleAssociations_filters = (ListResolverRuleAssociations -> Maybe [Filter])
-> (ListResolverRuleAssociations
    -> Maybe [Filter] -> ListResolverRuleAssociations)
-> Lens
     ListResolverRuleAssociations
     ListResolverRuleAssociations
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverRuleAssociations' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListResolverRuleAssociations' :: ListResolverRuleAssociations -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListResolverRuleAssociations
s@ListResolverRuleAssociations' {} Maybe [Filter]
a -> ListResolverRuleAssociations
s {$sel:filters:ListResolverRuleAssociations' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListResolverRuleAssociations) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> ListResolverRuleAssociations -> f ListResolverRuleAssociations)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> ListResolverRuleAssociations
-> f ListResolverRuleAssociations
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 @ListResolverRuleAssociation@ request, omit this value.
--
-- If you have more than @MaxResults@ rule associations, you can submit
-- another @ListResolverRuleAssociation@ request to get the next group of
-- rule associations. In the next request, specify the value of @NextToken@
-- from the previous response.
listResolverRuleAssociations_nextToken :: Lens.Lens' ListResolverRuleAssociations (Prelude.Maybe Prelude.Text)
listResolverRuleAssociations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListResolverRuleAssociations -> f ListResolverRuleAssociations
listResolverRuleAssociations_nextToken = (ListResolverRuleAssociations -> Maybe Text)
-> (ListResolverRuleAssociations
    -> Maybe Text -> ListResolverRuleAssociations)
-> Lens
     ListResolverRuleAssociations
     ListResolverRuleAssociations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListResolverRuleAssociations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListResolverRuleAssociations' :: ListResolverRuleAssociations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListResolverRuleAssociations
s@ListResolverRuleAssociations' {} Maybe Text
a -> ListResolverRuleAssociations
s {$sel:nextToken:ListResolverRuleAssociations' :: Maybe Text
nextToken = Maybe Text
a} :: ListResolverRuleAssociations)

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

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

instance Prelude.NFData ListResolverRuleAssociations

instance Core.ToHeaders ListResolverRuleAssociations where
  toHeaders :: ListResolverRuleAssociations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListResolverRuleAssociations -> 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.ListResolverRuleAssociations" ::
                          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 ListResolverRuleAssociations where
  toJSON :: ListResolverRuleAssociations -> Value
toJSON ListResolverRuleAssociations' {Maybe Natural
Maybe [Filter]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
filters :: Maybe [Filter]
$sel:maxResults:ListResolverRuleAssociations' :: ListResolverRuleAssociations -> Maybe Natural
$sel:nextToken:ListResolverRuleAssociations' :: ListResolverRuleAssociations -> Maybe Text
$sel:filters:ListResolverRuleAssociations' :: ListResolverRuleAssociations -> 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 ListResolverRuleAssociations where
  toPath :: ListResolverRuleAssociations -> ByteString
toPath = ByteString -> ListResolverRuleAssociations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'ListResolverRuleAssociationsResponse' 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:
--
-- 'resolverRuleAssociations', 'listResolverRuleAssociationsResponse_resolverRuleAssociations' - The associations that were created between Resolver rules and VPCs using
-- the current Amazon Web Services account, and that match the specified
-- filters, if any.
--
-- 'nextToken', 'listResolverRuleAssociationsResponse_nextToken' - If more than @MaxResults@ rule associations match the specified
-- criteria, you can submit another @ListResolverRuleAssociation@ request
-- to get the next group of results. In the next request, specify the value
-- of @NextToken@ from the previous response.
--
-- 'maxResults', 'listResolverRuleAssociationsResponse_maxResults' - The value that you specified for @MaxResults@ in the request.
--
-- 'httpStatus', 'listResolverRuleAssociationsResponse_httpStatus' - The response's http status code.
newListResolverRuleAssociationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListResolverRuleAssociationsResponse
newListResolverRuleAssociationsResponse :: Int -> ListResolverRuleAssociationsResponse
newListResolverRuleAssociationsResponse Int
pHttpStatus_ =
  ListResolverRuleAssociationsResponse' :: Maybe [ResolverRuleAssociation]
-> Maybe Text
-> Maybe Natural
-> Int
-> ListResolverRuleAssociationsResponse
ListResolverRuleAssociationsResponse'
    { $sel:resolverRuleAssociations:ListResolverRuleAssociationsResponse' :: Maybe [ResolverRuleAssociation]
resolverRuleAssociations =
        Maybe [ResolverRuleAssociation]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListResolverRuleAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListResolverRuleAssociationsResponse' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListResolverRuleAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

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

instance
  Prelude.NFData
    ListResolverRuleAssociationsResponse