{-# 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.DAX.DescribeSubnetGroups
-- 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)
--
-- Returns a list of subnet group descriptions. If a subnet group name is
-- specified, the list will contain only the description of that group.
--
-- This operation returns paginated results.
module Amazonka.DAX.DescribeSubnetGroups
  ( -- * Creating a Request
    DescribeSubnetGroups (..),
    newDescribeSubnetGroups,

    -- * Request Lenses
    describeSubnetGroups_subnetGroupNames,
    describeSubnetGroups_nextToken,
    describeSubnetGroups_maxResults,

    -- * Destructuring the Response
    DescribeSubnetGroupsResponse (..),
    newDescribeSubnetGroupsResponse,

    -- * Response Lenses
    describeSubnetGroupsResponse_subnetGroups,
    describeSubnetGroupsResponse_nextToken,
    describeSubnetGroupsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeSubnetGroups' smart constructor.
data DescribeSubnetGroups = DescribeSubnetGroups'
  { -- | The name of the subnet group.
    DescribeSubnetGroups -> Maybe [Text]
subnetGroupNames :: Prelude.Maybe [Prelude.Text],
    -- | An optional token returned from a prior request. Use this token for
    -- pagination of results from this action. If this parameter is specified,
    -- the response includes only results beyond the token, up to the value
    -- specified by @MaxResults@.
    DescribeSubnetGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to include in the response. If more
    -- results exist than the specified @MaxResults@ value, a token is included
    -- in the response so that the remaining results can be retrieved.
    --
    -- The value for @MaxResults@ must be between 20 and 100.
    DescribeSubnetGroups -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeSubnetGroups -> DescribeSubnetGroups -> Bool
(DescribeSubnetGroups -> DescribeSubnetGroups -> Bool)
-> (DescribeSubnetGroups -> DescribeSubnetGroups -> Bool)
-> Eq DescribeSubnetGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSubnetGroups -> DescribeSubnetGroups -> Bool
$c/= :: DescribeSubnetGroups -> DescribeSubnetGroups -> Bool
== :: DescribeSubnetGroups -> DescribeSubnetGroups -> Bool
$c== :: DescribeSubnetGroups -> DescribeSubnetGroups -> Bool
Prelude.Eq, ReadPrec [DescribeSubnetGroups]
ReadPrec DescribeSubnetGroups
Int -> ReadS DescribeSubnetGroups
ReadS [DescribeSubnetGroups]
(Int -> ReadS DescribeSubnetGroups)
-> ReadS [DescribeSubnetGroups]
-> ReadPrec DescribeSubnetGroups
-> ReadPrec [DescribeSubnetGroups]
-> Read DescribeSubnetGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSubnetGroups]
$creadListPrec :: ReadPrec [DescribeSubnetGroups]
readPrec :: ReadPrec DescribeSubnetGroups
$creadPrec :: ReadPrec DescribeSubnetGroups
readList :: ReadS [DescribeSubnetGroups]
$creadList :: ReadS [DescribeSubnetGroups]
readsPrec :: Int -> ReadS DescribeSubnetGroups
$creadsPrec :: Int -> ReadS DescribeSubnetGroups
Prelude.Read, Int -> DescribeSubnetGroups -> ShowS
[DescribeSubnetGroups] -> ShowS
DescribeSubnetGroups -> String
(Int -> DescribeSubnetGroups -> ShowS)
-> (DescribeSubnetGroups -> String)
-> ([DescribeSubnetGroups] -> ShowS)
-> Show DescribeSubnetGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSubnetGroups] -> ShowS
$cshowList :: [DescribeSubnetGroups] -> ShowS
show :: DescribeSubnetGroups -> String
$cshow :: DescribeSubnetGroups -> String
showsPrec :: Int -> DescribeSubnetGroups -> ShowS
$cshowsPrec :: Int -> DescribeSubnetGroups -> ShowS
Prelude.Show, (forall x. DescribeSubnetGroups -> Rep DescribeSubnetGroups x)
-> (forall x. Rep DescribeSubnetGroups x -> DescribeSubnetGroups)
-> Generic DescribeSubnetGroups
forall x. Rep DescribeSubnetGroups x -> DescribeSubnetGroups
forall x. DescribeSubnetGroups -> Rep DescribeSubnetGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeSubnetGroups x -> DescribeSubnetGroups
$cfrom :: forall x. DescribeSubnetGroups -> Rep DescribeSubnetGroups x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSubnetGroups' 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:
--
-- 'subnetGroupNames', 'describeSubnetGroups_subnetGroupNames' - The name of the subnet group.
--
-- 'nextToken', 'describeSubnetGroups_nextToken' - An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response includes only results beyond the token, up to the value
-- specified by @MaxResults@.
--
-- 'maxResults', 'describeSubnetGroups_maxResults' - The maximum number of results to include in the response. If more
-- results exist than the specified @MaxResults@ value, a token is included
-- in the response so that the remaining results can be retrieved.
--
-- The value for @MaxResults@ must be between 20 and 100.
newDescribeSubnetGroups ::
  DescribeSubnetGroups
newDescribeSubnetGroups :: DescribeSubnetGroups
newDescribeSubnetGroups =
  DescribeSubnetGroups' :: Maybe [Text] -> Maybe Text -> Maybe Int -> DescribeSubnetGroups
DescribeSubnetGroups'
    { $sel:subnetGroupNames:DescribeSubnetGroups' :: Maybe [Text]
subnetGroupNames =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSubnetGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeSubnetGroups' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the subnet group.
describeSubnetGroups_subnetGroupNames :: Lens.Lens' DescribeSubnetGroups (Prelude.Maybe [Prelude.Text])
describeSubnetGroups_subnetGroupNames :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeSubnetGroups -> f DescribeSubnetGroups
describeSubnetGroups_subnetGroupNames = (DescribeSubnetGroups -> Maybe [Text])
-> (DescribeSubnetGroups -> Maybe [Text] -> DescribeSubnetGroups)
-> Lens
     DescribeSubnetGroups
     DescribeSubnetGroups
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubnetGroups' {Maybe [Text]
subnetGroupNames :: Maybe [Text]
$sel:subnetGroupNames:DescribeSubnetGroups' :: DescribeSubnetGroups -> Maybe [Text]
subnetGroupNames} -> Maybe [Text]
subnetGroupNames) (\s :: DescribeSubnetGroups
s@DescribeSubnetGroups' {} Maybe [Text]
a -> DescribeSubnetGroups
s {$sel:subnetGroupNames:DescribeSubnetGroups' :: Maybe [Text]
subnetGroupNames = Maybe [Text]
a} :: DescribeSubnetGroups) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeSubnetGroups -> f DescribeSubnetGroups)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeSubnetGroups
-> f DescribeSubnetGroups
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response includes only results beyond the token, up to the value
-- specified by @MaxResults@.
describeSubnetGroups_nextToken :: Lens.Lens' DescribeSubnetGroups (Prelude.Maybe Prelude.Text)
describeSubnetGroups_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSubnetGroups -> f DescribeSubnetGroups
describeSubnetGroups_nextToken = (DescribeSubnetGroups -> Maybe Text)
-> (DescribeSubnetGroups -> Maybe Text -> DescribeSubnetGroups)
-> Lens
     DescribeSubnetGroups DescribeSubnetGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubnetGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSubnetGroups' :: DescribeSubnetGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSubnetGroups
s@DescribeSubnetGroups' {} Maybe Text
a -> DescribeSubnetGroups
s {$sel:nextToken:DescribeSubnetGroups' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSubnetGroups)

-- | The maximum number of results to include in the response. If more
-- results exist than the specified @MaxResults@ value, a token is included
-- in the response so that the remaining results can be retrieved.
--
-- The value for @MaxResults@ must be between 20 and 100.
describeSubnetGroups_maxResults :: Lens.Lens' DescribeSubnetGroups (Prelude.Maybe Prelude.Int)
describeSubnetGroups_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribeSubnetGroups -> f DescribeSubnetGroups
describeSubnetGroups_maxResults = (DescribeSubnetGroups -> Maybe Int)
-> (DescribeSubnetGroups -> Maybe Int -> DescribeSubnetGroups)
-> Lens
     DescribeSubnetGroups DescribeSubnetGroups (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubnetGroups' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribeSubnetGroups' :: DescribeSubnetGroups -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribeSubnetGroups
s@DescribeSubnetGroups' {} Maybe Int
a -> DescribeSubnetGroups
s {$sel:maxResults:DescribeSubnetGroups' :: Maybe Int
maxResults = Maybe Int
a} :: DescribeSubnetGroups)

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

instance Prelude.NFData DescribeSubnetGroups

instance Core.ToHeaders DescribeSubnetGroups where
  toHeaders :: DescribeSubnetGroups -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeSubnetGroups -> 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
"AmazonDAXV3.DescribeSubnetGroups" ::
                          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 DescribeSubnetGroups where
  toJSON :: DescribeSubnetGroups -> Value
toJSON DescribeSubnetGroups' {Maybe Int
Maybe [Text]
Maybe Text
maxResults :: Maybe Int
nextToken :: Maybe Text
subnetGroupNames :: Maybe [Text]
$sel:maxResults:DescribeSubnetGroups' :: DescribeSubnetGroups -> Maybe Int
$sel:nextToken:DescribeSubnetGroups' :: DescribeSubnetGroups -> Maybe Text
$sel:subnetGroupNames:DescribeSubnetGroups' :: DescribeSubnetGroups -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SubnetGroupNames" 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]
subnetGroupNames,
            (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 -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults
          ]
      )

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

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

-- | /See:/ 'newDescribeSubnetGroupsResponse' smart constructor.
data DescribeSubnetGroupsResponse = DescribeSubnetGroupsResponse'
  { -- | An array of subnet groups. Each element in the array represents a single
    -- subnet group.
    DescribeSubnetGroupsResponse -> Maybe [SubnetGroup]
subnetGroups :: Prelude.Maybe [SubnetGroup],
    -- | Provides an identifier to allow retrieval of paginated results.
    DescribeSubnetGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeSubnetGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSubnetGroupsResponse
-> DescribeSubnetGroupsResponse -> Bool
(DescribeSubnetGroupsResponse
 -> DescribeSubnetGroupsResponse -> Bool)
-> (DescribeSubnetGroupsResponse
    -> DescribeSubnetGroupsResponse -> Bool)
-> Eq DescribeSubnetGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSubnetGroupsResponse
-> DescribeSubnetGroupsResponse -> Bool
$c/= :: DescribeSubnetGroupsResponse
-> DescribeSubnetGroupsResponse -> Bool
== :: DescribeSubnetGroupsResponse
-> DescribeSubnetGroupsResponse -> Bool
$c== :: DescribeSubnetGroupsResponse
-> DescribeSubnetGroupsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeSubnetGroupsResponse]
ReadPrec DescribeSubnetGroupsResponse
Int -> ReadS DescribeSubnetGroupsResponse
ReadS [DescribeSubnetGroupsResponse]
(Int -> ReadS DescribeSubnetGroupsResponse)
-> ReadS [DescribeSubnetGroupsResponse]
-> ReadPrec DescribeSubnetGroupsResponse
-> ReadPrec [DescribeSubnetGroupsResponse]
-> Read DescribeSubnetGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSubnetGroupsResponse]
$creadListPrec :: ReadPrec [DescribeSubnetGroupsResponse]
readPrec :: ReadPrec DescribeSubnetGroupsResponse
$creadPrec :: ReadPrec DescribeSubnetGroupsResponse
readList :: ReadS [DescribeSubnetGroupsResponse]
$creadList :: ReadS [DescribeSubnetGroupsResponse]
readsPrec :: Int -> ReadS DescribeSubnetGroupsResponse
$creadsPrec :: Int -> ReadS DescribeSubnetGroupsResponse
Prelude.Read, Int -> DescribeSubnetGroupsResponse -> ShowS
[DescribeSubnetGroupsResponse] -> ShowS
DescribeSubnetGroupsResponse -> String
(Int -> DescribeSubnetGroupsResponse -> ShowS)
-> (DescribeSubnetGroupsResponse -> String)
-> ([DescribeSubnetGroupsResponse] -> ShowS)
-> Show DescribeSubnetGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSubnetGroupsResponse] -> ShowS
$cshowList :: [DescribeSubnetGroupsResponse] -> ShowS
show :: DescribeSubnetGroupsResponse -> String
$cshow :: DescribeSubnetGroupsResponse -> String
showsPrec :: Int -> DescribeSubnetGroupsResponse -> ShowS
$cshowsPrec :: Int -> DescribeSubnetGroupsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeSubnetGroupsResponse -> Rep DescribeSubnetGroupsResponse x)
-> (forall x.
    Rep DescribeSubnetGroupsResponse x -> DescribeSubnetGroupsResponse)
-> Generic DescribeSubnetGroupsResponse
forall x.
Rep DescribeSubnetGroupsResponse x -> DescribeSubnetGroupsResponse
forall x.
DescribeSubnetGroupsResponse -> Rep DescribeSubnetGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSubnetGroupsResponse x -> DescribeSubnetGroupsResponse
$cfrom :: forall x.
DescribeSubnetGroupsResponse -> Rep DescribeSubnetGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSubnetGroupsResponse' 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:
--
-- 'subnetGroups', 'describeSubnetGroupsResponse_subnetGroups' - An array of subnet groups. Each element in the array represents a single
-- subnet group.
--
-- 'nextToken', 'describeSubnetGroupsResponse_nextToken' - Provides an identifier to allow retrieval of paginated results.
--
-- 'httpStatus', 'describeSubnetGroupsResponse_httpStatus' - The response's http status code.
newDescribeSubnetGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSubnetGroupsResponse
newDescribeSubnetGroupsResponse :: Int -> DescribeSubnetGroupsResponse
newDescribeSubnetGroupsResponse Int
pHttpStatus_ =
  DescribeSubnetGroupsResponse' :: Maybe [SubnetGroup]
-> Maybe Text -> Int -> DescribeSubnetGroupsResponse
DescribeSubnetGroupsResponse'
    { $sel:subnetGroups:DescribeSubnetGroupsResponse' :: Maybe [SubnetGroup]
subnetGroups =
        Maybe [SubnetGroup]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSubnetGroupsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSubnetGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of subnet groups. Each element in the array represents a single
-- subnet group.
describeSubnetGroupsResponse_subnetGroups :: Lens.Lens' DescribeSubnetGroupsResponse (Prelude.Maybe [SubnetGroup])
describeSubnetGroupsResponse_subnetGroups :: (Maybe [SubnetGroup] -> f (Maybe [SubnetGroup]))
-> DescribeSubnetGroupsResponse -> f DescribeSubnetGroupsResponse
describeSubnetGroupsResponse_subnetGroups = (DescribeSubnetGroupsResponse -> Maybe [SubnetGroup])
-> (DescribeSubnetGroupsResponse
    -> Maybe [SubnetGroup] -> DescribeSubnetGroupsResponse)
-> Lens' DescribeSubnetGroupsResponse (Maybe [SubnetGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubnetGroupsResponse' {Maybe [SubnetGroup]
subnetGroups :: Maybe [SubnetGroup]
$sel:subnetGroups:DescribeSubnetGroupsResponse' :: DescribeSubnetGroupsResponse -> Maybe [SubnetGroup]
subnetGroups} -> Maybe [SubnetGroup]
subnetGroups) (\s :: DescribeSubnetGroupsResponse
s@DescribeSubnetGroupsResponse' {} Maybe [SubnetGroup]
a -> DescribeSubnetGroupsResponse
s {$sel:subnetGroups:DescribeSubnetGroupsResponse' :: Maybe [SubnetGroup]
subnetGroups = Maybe [SubnetGroup]
a} :: DescribeSubnetGroupsResponse) ((Maybe [SubnetGroup] -> f (Maybe [SubnetGroup]))
 -> DescribeSubnetGroupsResponse -> f DescribeSubnetGroupsResponse)
-> ((Maybe [SubnetGroup] -> f (Maybe [SubnetGroup]))
    -> Maybe [SubnetGroup] -> f (Maybe [SubnetGroup]))
-> (Maybe [SubnetGroup] -> f (Maybe [SubnetGroup]))
-> DescribeSubnetGroupsResponse
-> f DescribeSubnetGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [SubnetGroup] [SubnetGroup] [SubnetGroup] [SubnetGroup]
-> Iso
     (Maybe [SubnetGroup])
     (Maybe [SubnetGroup])
     (Maybe [SubnetGroup])
     (Maybe [SubnetGroup])
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 [SubnetGroup] [SubnetGroup] [SubnetGroup] [SubnetGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Provides an identifier to allow retrieval of paginated results.
describeSubnetGroupsResponse_nextToken :: Lens.Lens' DescribeSubnetGroupsResponse (Prelude.Maybe Prelude.Text)
describeSubnetGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSubnetGroupsResponse -> f DescribeSubnetGroupsResponse
describeSubnetGroupsResponse_nextToken = (DescribeSubnetGroupsResponse -> Maybe Text)
-> (DescribeSubnetGroupsResponse
    -> Maybe Text -> DescribeSubnetGroupsResponse)
-> Lens' DescribeSubnetGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSubnetGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSubnetGroupsResponse' :: DescribeSubnetGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSubnetGroupsResponse
s@DescribeSubnetGroupsResponse' {} Maybe Text
a -> DescribeSubnetGroupsResponse
s {$sel:nextToken:DescribeSubnetGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSubnetGroupsResponse)

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

instance Prelude.NFData DescribeSubnetGroupsResponse