{-# 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.ElastiCache.DescribeCacheSubnetGroups
-- 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 cache subnet group descriptions. If a subnet group
-- name is specified, the list contains only the description of that group.
-- This is applicable only when you have ElastiCache in VPC setup. All
-- ElastiCache clusters now launch in VPC by default.
--
-- This operation returns paginated results.
module Amazonka.ElastiCache.DescribeCacheSubnetGroups
  ( -- * Creating a Request
    DescribeCacheSubnetGroups (..),
    newDescribeCacheSubnetGroups,

    -- * Request Lenses
    describeCacheSubnetGroups_cacheSubnetGroupName,
    describeCacheSubnetGroups_marker,
    describeCacheSubnetGroups_maxRecords,

    -- * Destructuring the Response
    DescribeCacheSubnetGroupsResponse (..),
    newDescribeCacheSubnetGroupsResponse,

    -- * Response Lenses
    describeCacheSubnetGroupsResponse_marker,
    describeCacheSubnetGroupsResponse_cacheSubnetGroups,
    describeCacheSubnetGroupsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ElastiCache.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

-- | Represents the input of a @DescribeCacheSubnetGroups@ operation.
--
-- /See:/ 'newDescribeCacheSubnetGroups' smart constructor.
data DescribeCacheSubnetGroups = DescribeCacheSubnetGroups'
  { -- | The name of the cache subnet group to return details for.
    DescribeCacheSubnetGroups -> Maybe Text
cacheSubnetGroupName :: Prelude.Maybe Prelude.Text,
    -- | An optional marker returned from a prior request. Use this marker for
    -- pagination of results from this operation. If this parameter is
    -- specified, the response includes only records beyond the marker, up to
    -- the value specified by @MaxRecords@.
    DescribeCacheSubnetGroups -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of records to include in the response. If more
    -- records exist than the specified @MaxRecords@ value, a marker is
    -- included in the response so that the remaining results can be retrieved.
    --
    -- Default: 100
    --
    -- Constraints: minimum 20; maximum 100.
    DescribeCacheSubnetGroups -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeCacheSubnetGroups -> DescribeCacheSubnetGroups -> Bool
(DescribeCacheSubnetGroups -> DescribeCacheSubnetGroups -> Bool)
-> (DescribeCacheSubnetGroups -> DescribeCacheSubnetGroups -> Bool)
-> Eq DescribeCacheSubnetGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCacheSubnetGroups -> DescribeCacheSubnetGroups -> Bool
$c/= :: DescribeCacheSubnetGroups -> DescribeCacheSubnetGroups -> Bool
== :: DescribeCacheSubnetGroups -> DescribeCacheSubnetGroups -> Bool
$c== :: DescribeCacheSubnetGroups -> DescribeCacheSubnetGroups -> Bool
Prelude.Eq, ReadPrec [DescribeCacheSubnetGroups]
ReadPrec DescribeCacheSubnetGroups
Int -> ReadS DescribeCacheSubnetGroups
ReadS [DescribeCacheSubnetGroups]
(Int -> ReadS DescribeCacheSubnetGroups)
-> ReadS [DescribeCacheSubnetGroups]
-> ReadPrec DescribeCacheSubnetGroups
-> ReadPrec [DescribeCacheSubnetGroups]
-> Read DescribeCacheSubnetGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCacheSubnetGroups]
$creadListPrec :: ReadPrec [DescribeCacheSubnetGroups]
readPrec :: ReadPrec DescribeCacheSubnetGroups
$creadPrec :: ReadPrec DescribeCacheSubnetGroups
readList :: ReadS [DescribeCacheSubnetGroups]
$creadList :: ReadS [DescribeCacheSubnetGroups]
readsPrec :: Int -> ReadS DescribeCacheSubnetGroups
$creadsPrec :: Int -> ReadS DescribeCacheSubnetGroups
Prelude.Read, Int -> DescribeCacheSubnetGroups -> ShowS
[DescribeCacheSubnetGroups] -> ShowS
DescribeCacheSubnetGroups -> String
(Int -> DescribeCacheSubnetGroups -> ShowS)
-> (DescribeCacheSubnetGroups -> String)
-> ([DescribeCacheSubnetGroups] -> ShowS)
-> Show DescribeCacheSubnetGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCacheSubnetGroups] -> ShowS
$cshowList :: [DescribeCacheSubnetGroups] -> ShowS
show :: DescribeCacheSubnetGroups -> String
$cshow :: DescribeCacheSubnetGroups -> String
showsPrec :: Int -> DescribeCacheSubnetGroups -> ShowS
$cshowsPrec :: Int -> DescribeCacheSubnetGroups -> ShowS
Prelude.Show, (forall x.
 DescribeCacheSubnetGroups -> Rep DescribeCacheSubnetGroups x)
-> (forall x.
    Rep DescribeCacheSubnetGroups x -> DescribeCacheSubnetGroups)
-> Generic DescribeCacheSubnetGroups
forall x.
Rep DescribeCacheSubnetGroups x -> DescribeCacheSubnetGroups
forall x.
DescribeCacheSubnetGroups -> Rep DescribeCacheSubnetGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCacheSubnetGroups x -> DescribeCacheSubnetGroups
$cfrom :: forall x.
DescribeCacheSubnetGroups -> Rep DescribeCacheSubnetGroups x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCacheSubnetGroups' 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:
--
-- 'cacheSubnetGroupName', 'describeCacheSubnetGroups_cacheSubnetGroupName' - The name of the cache subnet group to return details for.
--
-- 'marker', 'describeCacheSubnetGroups_marker' - An optional marker returned from a prior request. Use this marker for
-- pagination of results from this operation. If this parameter is
-- specified, the response includes only records beyond the marker, up to
-- the value specified by @MaxRecords@.
--
-- 'maxRecords', 'describeCacheSubnetGroups_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a marker is
-- included in the response so that the remaining results can be retrieved.
--
-- Default: 100
--
-- Constraints: minimum 20; maximum 100.
newDescribeCacheSubnetGroups ::
  DescribeCacheSubnetGroups
newDescribeCacheSubnetGroups :: DescribeCacheSubnetGroups
newDescribeCacheSubnetGroups =
  DescribeCacheSubnetGroups' :: Maybe Text -> Maybe Text -> Maybe Int -> DescribeCacheSubnetGroups
DescribeCacheSubnetGroups'
    { $sel:cacheSubnetGroupName:DescribeCacheSubnetGroups' :: Maybe Text
cacheSubnetGroupName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeCacheSubnetGroups' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeCacheSubnetGroups' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the cache subnet group to return details for.
describeCacheSubnetGroups_cacheSubnetGroupName :: Lens.Lens' DescribeCacheSubnetGroups (Prelude.Maybe Prelude.Text)
describeCacheSubnetGroups_cacheSubnetGroupName :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheSubnetGroups -> f DescribeCacheSubnetGroups
describeCacheSubnetGroups_cacheSubnetGroupName = (DescribeCacheSubnetGroups -> Maybe Text)
-> (DescribeCacheSubnetGroups
    -> Maybe Text -> DescribeCacheSubnetGroups)
-> Lens
     DescribeCacheSubnetGroups
     DescribeCacheSubnetGroups
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheSubnetGroups' {Maybe Text
cacheSubnetGroupName :: Maybe Text
$sel:cacheSubnetGroupName:DescribeCacheSubnetGroups' :: DescribeCacheSubnetGroups -> Maybe Text
cacheSubnetGroupName} -> Maybe Text
cacheSubnetGroupName) (\s :: DescribeCacheSubnetGroups
s@DescribeCacheSubnetGroups' {} Maybe Text
a -> DescribeCacheSubnetGroups
s {$sel:cacheSubnetGroupName:DescribeCacheSubnetGroups' :: Maybe Text
cacheSubnetGroupName = Maybe Text
a} :: DescribeCacheSubnetGroups)

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

-- | The maximum number of records to include in the response. If more
-- records exist than the specified @MaxRecords@ value, a marker is
-- included in the response so that the remaining results can be retrieved.
--
-- Default: 100
--
-- Constraints: minimum 20; maximum 100.
describeCacheSubnetGroups_maxRecords :: Lens.Lens' DescribeCacheSubnetGroups (Prelude.Maybe Prelude.Int)
describeCacheSubnetGroups_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeCacheSubnetGroups -> f DescribeCacheSubnetGroups
describeCacheSubnetGroups_maxRecords = (DescribeCacheSubnetGroups -> Maybe Int)
-> (DescribeCacheSubnetGroups
    -> Maybe Int -> DescribeCacheSubnetGroups)
-> Lens
     DescribeCacheSubnetGroups
     DescribeCacheSubnetGroups
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheSubnetGroups' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeCacheSubnetGroups' :: DescribeCacheSubnetGroups -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeCacheSubnetGroups
s@DescribeCacheSubnetGroups' {} Maybe Int
a -> DescribeCacheSubnetGroups
s {$sel:maxRecords:DescribeCacheSubnetGroups' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeCacheSubnetGroups)

instance Core.AWSPager DescribeCacheSubnetGroups where
  page :: DescribeCacheSubnetGroups
-> AWSResponse DescribeCacheSubnetGroups
-> Maybe DescribeCacheSubnetGroups
page DescribeCacheSubnetGroups
rq AWSResponse DescribeCacheSubnetGroups
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeCacheSubnetGroups
DescribeCacheSubnetGroupsResponse
rs
            DescribeCacheSubnetGroupsResponse
-> Getting (First Text) DescribeCacheSubnetGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeCacheSubnetGroupsResponse
-> Const (First Text) DescribeCacheSubnetGroupsResponse
Lens' DescribeCacheSubnetGroupsResponse (Maybe Text)
describeCacheSubnetGroupsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeCacheSubnetGroupsResponse
 -> Const (First Text) DescribeCacheSubnetGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeCacheSubnetGroupsResponse 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 DescribeCacheSubnetGroups
forall a. Maybe a
Prelude.Nothing
    | Maybe [CacheSubnetGroup] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeCacheSubnetGroups
DescribeCacheSubnetGroupsResponse
rs
            DescribeCacheSubnetGroupsResponse
-> Getting
     (First [CacheSubnetGroup])
     DescribeCacheSubnetGroupsResponse
     [CacheSubnetGroup]
-> Maybe [CacheSubnetGroup]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [CacheSubnetGroup]
 -> Const (First [CacheSubnetGroup]) (Maybe [CacheSubnetGroup]))
-> DescribeCacheSubnetGroupsResponse
-> Const
     (First [CacheSubnetGroup]) DescribeCacheSubnetGroupsResponse
Lens' DescribeCacheSubnetGroupsResponse (Maybe [CacheSubnetGroup])
describeCacheSubnetGroupsResponse_cacheSubnetGroups
              ((Maybe [CacheSubnetGroup]
  -> Const (First [CacheSubnetGroup]) (Maybe [CacheSubnetGroup]))
 -> DescribeCacheSubnetGroupsResponse
 -> Const
      (First [CacheSubnetGroup]) DescribeCacheSubnetGroupsResponse)
-> (([CacheSubnetGroup]
     -> Const (First [CacheSubnetGroup]) [CacheSubnetGroup])
    -> Maybe [CacheSubnetGroup]
    -> Const (First [CacheSubnetGroup]) (Maybe [CacheSubnetGroup]))
-> Getting
     (First [CacheSubnetGroup])
     DescribeCacheSubnetGroupsResponse
     [CacheSubnetGroup]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CacheSubnetGroup]
 -> Const (First [CacheSubnetGroup]) [CacheSubnetGroup])
-> Maybe [CacheSubnetGroup]
-> Const (First [CacheSubnetGroup]) (Maybe [CacheSubnetGroup])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeCacheSubnetGroups
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeCacheSubnetGroups -> Maybe DescribeCacheSubnetGroups
forall a. a -> Maybe a
Prelude.Just (DescribeCacheSubnetGroups -> Maybe DescribeCacheSubnetGroups)
-> DescribeCacheSubnetGroups -> Maybe DescribeCacheSubnetGroups
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeCacheSubnetGroups
rq
          DescribeCacheSubnetGroups
-> (DescribeCacheSubnetGroups -> DescribeCacheSubnetGroups)
-> DescribeCacheSubnetGroups
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeCacheSubnetGroups -> Identity DescribeCacheSubnetGroups
Lens
  DescribeCacheSubnetGroups
  DescribeCacheSubnetGroups
  (Maybe Text)
  (Maybe Text)
describeCacheSubnetGroups_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeCacheSubnetGroups -> Identity DescribeCacheSubnetGroups)
-> Maybe Text
-> DescribeCacheSubnetGroups
-> DescribeCacheSubnetGroups
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeCacheSubnetGroups
DescribeCacheSubnetGroupsResponse
rs
          DescribeCacheSubnetGroupsResponse
-> Getting (First Text) DescribeCacheSubnetGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeCacheSubnetGroupsResponse
-> Const (First Text) DescribeCacheSubnetGroupsResponse
Lens' DescribeCacheSubnetGroupsResponse (Maybe Text)
describeCacheSubnetGroupsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeCacheSubnetGroupsResponse
 -> Const (First Text) DescribeCacheSubnetGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeCacheSubnetGroupsResponse 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 DescribeCacheSubnetGroups where
  type
    AWSResponse DescribeCacheSubnetGroups =
      DescribeCacheSubnetGroupsResponse
  request :: DescribeCacheSubnetGroups -> Request DescribeCacheSubnetGroups
request = Service
-> DescribeCacheSubnetGroups -> Request DescribeCacheSubnetGroups
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeCacheSubnetGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCacheSubnetGroups)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeCacheSubnetGroups))
-> Logger
-> Service
-> Proxy DescribeCacheSubnetGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCacheSubnetGroups)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeCacheSubnetGroupsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe [CacheSubnetGroup]
-> Int
-> DescribeCacheSubnetGroupsResponse
DescribeCacheSubnetGroupsResponse'
            (Maybe Text
 -> Maybe [CacheSubnetGroup]
 -> Int
 -> DescribeCacheSubnetGroupsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [CacheSubnetGroup]
      -> Int -> DescribeCacheSubnetGroupsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either
  String
  (Maybe [CacheSubnetGroup]
   -> Int -> DescribeCacheSubnetGroupsResponse)
-> Either String (Maybe [CacheSubnetGroup])
-> Either String (Int -> DescribeCacheSubnetGroupsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CacheSubnetGroups"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [CacheSubnetGroup]))
-> Either String (Maybe [CacheSubnetGroup])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [CacheSubnetGroup])
-> [Node] -> Either String (Maybe [CacheSubnetGroup])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [CacheSubnetGroup]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"CacheSubnetGroup")
                        )
            Either String (Int -> DescribeCacheSubnetGroupsResponse)
-> Either String Int
-> Either String DescribeCacheSubnetGroupsResponse
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 DescribeCacheSubnetGroups

instance Prelude.NFData DescribeCacheSubnetGroups

instance Core.ToHeaders DescribeCacheSubnetGroups where
  toHeaders :: DescribeCacheSubnetGroups -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeCacheSubnetGroups -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery DescribeCacheSubnetGroups where
  toQuery :: DescribeCacheSubnetGroups -> QueryString
toQuery DescribeCacheSubnetGroups' {Maybe Int
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
cacheSubnetGroupName :: Maybe Text
$sel:maxRecords:DescribeCacheSubnetGroups' :: DescribeCacheSubnetGroups -> Maybe Int
$sel:marker:DescribeCacheSubnetGroups' :: DescribeCacheSubnetGroups -> Maybe Text
$sel:cacheSubnetGroupName:DescribeCacheSubnetGroups' :: DescribeCacheSubnetGroups -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeCacheSubnetGroups" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"CacheSubnetGroupName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
cacheSubnetGroupName,
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords
      ]

-- | Represents the output of a @DescribeCacheSubnetGroups@ operation.
--
-- /See:/ 'newDescribeCacheSubnetGroupsResponse' smart constructor.
data DescribeCacheSubnetGroupsResponse = DescribeCacheSubnetGroupsResponse'
  { -- | Provides an identifier to allow retrieval of paginated results.
    DescribeCacheSubnetGroupsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of cache subnet groups. Each element in the list contains
    -- detailed information about one group.
    DescribeCacheSubnetGroupsResponse -> Maybe [CacheSubnetGroup]
cacheSubnetGroups :: Prelude.Maybe [CacheSubnetGroup],
    -- | The response's http status code.
    DescribeCacheSubnetGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCacheSubnetGroupsResponse
-> DescribeCacheSubnetGroupsResponse -> Bool
(DescribeCacheSubnetGroupsResponse
 -> DescribeCacheSubnetGroupsResponse -> Bool)
-> (DescribeCacheSubnetGroupsResponse
    -> DescribeCacheSubnetGroupsResponse -> Bool)
-> Eq DescribeCacheSubnetGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCacheSubnetGroupsResponse
-> DescribeCacheSubnetGroupsResponse -> Bool
$c/= :: DescribeCacheSubnetGroupsResponse
-> DescribeCacheSubnetGroupsResponse -> Bool
== :: DescribeCacheSubnetGroupsResponse
-> DescribeCacheSubnetGroupsResponse -> Bool
$c== :: DescribeCacheSubnetGroupsResponse
-> DescribeCacheSubnetGroupsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCacheSubnetGroupsResponse]
ReadPrec DescribeCacheSubnetGroupsResponse
Int -> ReadS DescribeCacheSubnetGroupsResponse
ReadS [DescribeCacheSubnetGroupsResponse]
(Int -> ReadS DescribeCacheSubnetGroupsResponse)
-> ReadS [DescribeCacheSubnetGroupsResponse]
-> ReadPrec DescribeCacheSubnetGroupsResponse
-> ReadPrec [DescribeCacheSubnetGroupsResponse]
-> Read DescribeCacheSubnetGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCacheSubnetGroupsResponse]
$creadListPrec :: ReadPrec [DescribeCacheSubnetGroupsResponse]
readPrec :: ReadPrec DescribeCacheSubnetGroupsResponse
$creadPrec :: ReadPrec DescribeCacheSubnetGroupsResponse
readList :: ReadS [DescribeCacheSubnetGroupsResponse]
$creadList :: ReadS [DescribeCacheSubnetGroupsResponse]
readsPrec :: Int -> ReadS DescribeCacheSubnetGroupsResponse
$creadsPrec :: Int -> ReadS DescribeCacheSubnetGroupsResponse
Prelude.Read, Int -> DescribeCacheSubnetGroupsResponse -> ShowS
[DescribeCacheSubnetGroupsResponse] -> ShowS
DescribeCacheSubnetGroupsResponse -> String
(Int -> DescribeCacheSubnetGroupsResponse -> ShowS)
-> (DescribeCacheSubnetGroupsResponse -> String)
-> ([DescribeCacheSubnetGroupsResponse] -> ShowS)
-> Show DescribeCacheSubnetGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCacheSubnetGroupsResponse] -> ShowS
$cshowList :: [DescribeCacheSubnetGroupsResponse] -> ShowS
show :: DescribeCacheSubnetGroupsResponse -> String
$cshow :: DescribeCacheSubnetGroupsResponse -> String
showsPrec :: Int -> DescribeCacheSubnetGroupsResponse -> ShowS
$cshowsPrec :: Int -> DescribeCacheSubnetGroupsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeCacheSubnetGroupsResponse
 -> Rep DescribeCacheSubnetGroupsResponse x)
-> (forall x.
    Rep DescribeCacheSubnetGroupsResponse x
    -> DescribeCacheSubnetGroupsResponse)
-> Generic DescribeCacheSubnetGroupsResponse
forall x.
Rep DescribeCacheSubnetGroupsResponse x
-> DescribeCacheSubnetGroupsResponse
forall x.
DescribeCacheSubnetGroupsResponse
-> Rep DescribeCacheSubnetGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCacheSubnetGroupsResponse x
-> DescribeCacheSubnetGroupsResponse
$cfrom :: forall x.
DescribeCacheSubnetGroupsResponse
-> Rep DescribeCacheSubnetGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCacheSubnetGroupsResponse' 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:
--
-- 'marker', 'describeCacheSubnetGroupsResponse_marker' - Provides an identifier to allow retrieval of paginated results.
--
-- 'cacheSubnetGroups', 'describeCacheSubnetGroupsResponse_cacheSubnetGroups' - A list of cache subnet groups. Each element in the list contains
-- detailed information about one group.
--
-- 'httpStatus', 'describeCacheSubnetGroupsResponse_httpStatus' - The response's http status code.
newDescribeCacheSubnetGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCacheSubnetGroupsResponse
newDescribeCacheSubnetGroupsResponse :: Int -> DescribeCacheSubnetGroupsResponse
newDescribeCacheSubnetGroupsResponse Int
pHttpStatus_ =
  DescribeCacheSubnetGroupsResponse' :: Maybe Text
-> Maybe [CacheSubnetGroup]
-> Int
-> DescribeCacheSubnetGroupsResponse
DescribeCacheSubnetGroupsResponse'
    { $sel:marker:DescribeCacheSubnetGroupsResponse' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheSubnetGroups:DescribeCacheSubnetGroupsResponse' :: Maybe [CacheSubnetGroup]
cacheSubnetGroups = Maybe [CacheSubnetGroup]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCacheSubnetGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | A list of cache subnet groups. Each element in the list contains
-- detailed information about one group.
describeCacheSubnetGroupsResponse_cacheSubnetGroups :: Lens.Lens' DescribeCacheSubnetGroupsResponse (Prelude.Maybe [CacheSubnetGroup])
describeCacheSubnetGroupsResponse_cacheSubnetGroups :: (Maybe [CacheSubnetGroup] -> f (Maybe [CacheSubnetGroup]))
-> DescribeCacheSubnetGroupsResponse
-> f DescribeCacheSubnetGroupsResponse
describeCacheSubnetGroupsResponse_cacheSubnetGroups = (DescribeCacheSubnetGroupsResponse -> Maybe [CacheSubnetGroup])
-> (DescribeCacheSubnetGroupsResponse
    -> Maybe [CacheSubnetGroup] -> DescribeCacheSubnetGroupsResponse)
-> Lens'
     DescribeCacheSubnetGroupsResponse (Maybe [CacheSubnetGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheSubnetGroupsResponse' {Maybe [CacheSubnetGroup]
cacheSubnetGroups :: Maybe [CacheSubnetGroup]
$sel:cacheSubnetGroups:DescribeCacheSubnetGroupsResponse' :: DescribeCacheSubnetGroupsResponse -> Maybe [CacheSubnetGroup]
cacheSubnetGroups} -> Maybe [CacheSubnetGroup]
cacheSubnetGroups) (\s :: DescribeCacheSubnetGroupsResponse
s@DescribeCacheSubnetGroupsResponse' {} Maybe [CacheSubnetGroup]
a -> DescribeCacheSubnetGroupsResponse
s {$sel:cacheSubnetGroups:DescribeCacheSubnetGroupsResponse' :: Maybe [CacheSubnetGroup]
cacheSubnetGroups = Maybe [CacheSubnetGroup]
a} :: DescribeCacheSubnetGroupsResponse) ((Maybe [CacheSubnetGroup] -> f (Maybe [CacheSubnetGroup]))
 -> DescribeCacheSubnetGroupsResponse
 -> f DescribeCacheSubnetGroupsResponse)
-> ((Maybe [CacheSubnetGroup] -> f (Maybe [CacheSubnetGroup]))
    -> Maybe [CacheSubnetGroup] -> f (Maybe [CacheSubnetGroup]))
-> (Maybe [CacheSubnetGroup] -> f (Maybe [CacheSubnetGroup]))
-> DescribeCacheSubnetGroupsResponse
-> f DescribeCacheSubnetGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CacheSubnetGroup]
  [CacheSubnetGroup]
  [CacheSubnetGroup]
  [CacheSubnetGroup]
-> Iso
     (Maybe [CacheSubnetGroup])
     (Maybe [CacheSubnetGroup])
     (Maybe [CacheSubnetGroup])
     (Maybe [CacheSubnetGroup])
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
  [CacheSubnetGroup]
  [CacheSubnetGroup]
  [CacheSubnetGroup]
  [CacheSubnetGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeCacheSubnetGroupsResponse