{-# 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.DescribeCacheSecurityGroups
-- 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 security group descriptions. If a cache security
-- group name is specified, the list contains only the description of that
-- group. This applicable only when you have ElastiCache in Classic setup
--
-- This operation returns paginated results.
module Amazonka.ElastiCache.DescribeCacheSecurityGroups
  ( -- * Creating a Request
    DescribeCacheSecurityGroups (..),
    newDescribeCacheSecurityGroups,

    -- * Request Lenses
    describeCacheSecurityGroups_cacheSecurityGroupName,
    describeCacheSecurityGroups_marker,
    describeCacheSecurityGroups_maxRecords,

    -- * Destructuring the Response
    DescribeCacheSecurityGroupsResponse (..),
    newDescribeCacheSecurityGroupsResponse,

    -- * Response Lenses
    describeCacheSecurityGroupsResponse_cacheSecurityGroups,
    describeCacheSecurityGroupsResponse_marker,
    describeCacheSecurityGroupsResponse_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 @DescribeCacheSecurityGroups@ operation.
--
-- /See:/ 'newDescribeCacheSecurityGroups' smart constructor.
data DescribeCacheSecurityGroups = DescribeCacheSecurityGroups'
  { -- | The name of the cache security group to return details for.
    DescribeCacheSecurityGroups -> Maybe Text
cacheSecurityGroupName :: 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@.
    DescribeCacheSecurityGroups -> 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.
    DescribeCacheSecurityGroups -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeCacheSecurityGroups -> DescribeCacheSecurityGroups -> Bool
(DescribeCacheSecurityGroups
 -> DescribeCacheSecurityGroups -> Bool)
-> (DescribeCacheSecurityGroups
    -> DescribeCacheSecurityGroups -> Bool)
-> Eq DescribeCacheSecurityGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCacheSecurityGroups -> DescribeCacheSecurityGroups -> Bool
$c/= :: DescribeCacheSecurityGroups -> DescribeCacheSecurityGroups -> Bool
== :: DescribeCacheSecurityGroups -> DescribeCacheSecurityGroups -> Bool
$c== :: DescribeCacheSecurityGroups -> DescribeCacheSecurityGroups -> Bool
Prelude.Eq, ReadPrec [DescribeCacheSecurityGroups]
ReadPrec DescribeCacheSecurityGroups
Int -> ReadS DescribeCacheSecurityGroups
ReadS [DescribeCacheSecurityGroups]
(Int -> ReadS DescribeCacheSecurityGroups)
-> ReadS [DescribeCacheSecurityGroups]
-> ReadPrec DescribeCacheSecurityGroups
-> ReadPrec [DescribeCacheSecurityGroups]
-> Read DescribeCacheSecurityGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCacheSecurityGroups]
$creadListPrec :: ReadPrec [DescribeCacheSecurityGroups]
readPrec :: ReadPrec DescribeCacheSecurityGroups
$creadPrec :: ReadPrec DescribeCacheSecurityGroups
readList :: ReadS [DescribeCacheSecurityGroups]
$creadList :: ReadS [DescribeCacheSecurityGroups]
readsPrec :: Int -> ReadS DescribeCacheSecurityGroups
$creadsPrec :: Int -> ReadS DescribeCacheSecurityGroups
Prelude.Read, Int -> DescribeCacheSecurityGroups -> ShowS
[DescribeCacheSecurityGroups] -> ShowS
DescribeCacheSecurityGroups -> String
(Int -> DescribeCacheSecurityGroups -> ShowS)
-> (DescribeCacheSecurityGroups -> String)
-> ([DescribeCacheSecurityGroups] -> ShowS)
-> Show DescribeCacheSecurityGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCacheSecurityGroups] -> ShowS
$cshowList :: [DescribeCacheSecurityGroups] -> ShowS
show :: DescribeCacheSecurityGroups -> String
$cshow :: DescribeCacheSecurityGroups -> String
showsPrec :: Int -> DescribeCacheSecurityGroups -> ShowS
$cshowsPrec :: Int -> DescribeCacheSecurityGroups -> ShowS
Prelude.Show, (forall x.
 DescribeCacheSecurityGroups -> Rep DescribeCacheSecurityGroups x)
-> (forall x.
    Rep DescribeCacheSecurityGroups x -> DescribeCacheSecurityGroups)
-> Generic DescribeCacheSecurityGroups
forall x.
Rep DescribeCacheSecurityGroups x -> DescribeCacheSecurityGroups
forall x.
DescribeCacheSecurityGroups -> Rep DescribeCacheSecurityGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCacheSecurityGroups x -> DescribeCacheSecurityGroups
$cfrom :: forall x.
DescribeCacheSecurityGroups -> Rep DescribeCacheSecurityGroups x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCacheSecurityGroups' 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:
--
-- 'cacheSecurityGroupName', 'describeCacheSecurityGroups_cacheSecurityGroupName' - The name of the cache security group to return details for.
--
-- 'marker', 'describeCacheSecurityGroups_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', 'describeCacheSecurityGroups_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.
newDescribeCacheSecurityGroups ::
  DescribeCacheSecurityGroups
newDescribeCacheSecurityGroups :: DescribeCacheSecurityGroups
newDescribeCacheSecurityGroups =
  DescribeCacheSecurityGroups' :: Maybe Text
-> Maybe Text -> Maybe Int -> DescribeCacheSecurityGroups
DescribeCacheSecurityGroups'
    { $sel:cacheSecurityGroupName:DescribeCacheSecurityGroups' :: Maybe Text
cacheSecurityGroupName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeCacheSecurityGroups' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeCacheSecurityGroups' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

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

-- | 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@.
describeCacheSecurityGroups_marker :: Lens.Lens' DescribeCacheSecurityGroups (Prelude.Maybe Prelude.Text)
describeCacheSecurityGroups_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheSecurityGroups -> f DescribeCacheSecurityGroups
describeCacheSecurityGroups_marker = (DescribeCacheSecurityGroups -> Maybe Text)
-> (DescribeCacheSecurityGroups
    -> Maybe Text -> DescribeCacheSecurityGroups)
-> Lens
     DescribeCacheSecurityGroups
     DescribeCacheSecurityGroups
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheSecurityGroups' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeCacheSecurityGroups' :: DescribeCacheSecurityGroups -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeCacheSecurityGroups
s@DescribeCacheSecurityGroups' {} Maybe Text
a -> DescribeCacheSecurityGroups
s {$sel:marker:DescribeCacheSecurityGroups' :: Maybe Text
marker = Maybe Text
a} :: DescribeCacheSecurityGroups)

-- | 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.
describeCacheSecurityGroups_maxRecords :: Lens.Lens' DescribeCacheSecurityGroups (Prelude.Maybe Prelude.Int)
describeCacheSecurityGroups_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeCacheSecurityGroups -> f DescribeCacheSecurityGroups
describeCacheSecurityGroups_maxRecords = (DescribeCacheSecurityGroups -> Maybe Int)
-> (DescribeCacheSecurityGroups
    -> Maybe Int -> DescribeCacheSecurityGroups)
-> Lens
     DescribeCacheSecurityGroups
     DescribeCacheSecurityGroups
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheSecurityGroups' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeCacheSecurityGroups' :: DescribeCacheSecurityGroups -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeCacheSecurityGroups
s@DescribeCacheSecurityGroups' {} Maybe Int
a -> DescribeCacheSecurityGroups
s {$sel:maxRecords:DescribeCacheSecurityGroups' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeCacheSecurityGroups)

instance Core.AWSPager DescribeCacheSecurityGroups where
  page :: DescribeCacheSecurityGroups
-> AWSResponse DescribeCacheSecurityGroups
-> Maybe DescribeCacheSecurityGroups
page DescribeCacheSecurityGroups
rq AWSResponse DescribeCacheSecurityGroups
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeCacheSecurityGroups
DescribeCacheSecurityGroupsResponse
rs
            DescribeCacheSecurityGroupsResponse
-> Getting (First Text) DescribeCacheSecurityGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeCacheSecurityGroupsResponse
-> Const (First Text) DescribeCacheSecurityGroupsResponse
Lens' DescribeCacheSecurityGroupsResponse (Maybe Text)
describeCacheSecurityGroupsResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeCacheSecurityGroupsResponse
 -> Const (First Text) DescribeCacheSecurityGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeCacheSecurityGroupsResponse 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 DescribeCacheSecurityGroups
forall a. Maybe a
Prelude.Nothing
    | Maybe [CacheSecurityGroup] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeCacheSecurityGroups
DescribeCacheSecurityGroupsResponse
rs
            DescribeCacheSecurityGroupsResponse
-> Getting
     (First [CacheSecurityGroup])
     DescribeCacheSecurityGroupsResponse
     [CacheSecurityGroup]
-> Maybe [CacheSecurityGroup]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [CacheSecurityGroup]
 -> Const (First [CacheSecurityGroup]) (Maybe [CacheSecurityGroup]))
-> DescribeCacheSecurityGroupsResponse
-> Const
     (First [CacheSecurityGroup]) DescribeCacheSecurityGroupsResponse
Lens'
  DescribeCacheSecurityGroupsResponse (Maybe [CacheSecurityGroup])
describeCacheSecurityGroupsResponse_cacheSecurityGroups
              ((Maybe [CacheSecurityGroup]
  -> Const (First [CacheSecurityGroup]) (Maybe [CacheSecurityGroup]))
 -> DescribeCacheSecurityGroupsResponse
 -> Const
      (First [CacheSecurityGroup]) DescribeCacheSecurityGroupsResponse)
-> (([CacheSecurityGroup]
     -> Const (First [CacheSecurityGroup]) [CacheSecurityGroup])
    -> Maybe [CacheSecurityGroup]
    -> Const (First [CacheSecurityGroup]) (Maybe [CacheSecurityGroup]))
-> Getting
     (First [CacheSecurityGroup])
     DescribeCacheSecurityGroupsResponse
     [CacheSecurityGroup]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CacheSecurityGroup]
 -> Const (First [CacheSecurityGroup]) [CacheSecurityGroup])
-> Maybe [CacheSecurityGroup]
-> Const (First [CacheSecurityGroup]) (Maybe [CacheSecurityGroup])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeCacheSecurityGroups
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeCacheSecurityGroups -> Maybe DescribeCacheSecurityGroups
forall a. a -> Maybe a
Prelude.Just (DescribeCacheSecurityGroups -> Maybe DescribeCacheSecurityGroups)
-> DescribeCacheSecurityGroups -> Maybe DescribeCacheSecurityGroups
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeCacheSecurityGroups
rq
          DescribeCacheSecurityGroups
-> (DescribeCacheSecurityGroups -> DescribeCacheSecurityGroups)
-> DescribeCacheSecurityGroups
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeCacheSecurityGroups
-> Identity DescribeCacheSecurityGroups
Lens
  DescribeCacheSecurityGroups
  DescribeCacheSecurityGroups
  (Maybe Text)
  (Maybe Text)
describeCacheSecurityGroups_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeCacheSecurityGroups
 -> Identity DescribeCacheSecurityGroups)
-> Maybe Text
-> DescribeCacheSecurityGroups
-> DescribeCacheSecurityGroups
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeCacheSecurityGroups
DescribeCacheSecurityGroupsResponse
rs
          DescribeCacheSecurityGroupsResponse
-> Getting (First Text) DescribeCacheSecurityGroupsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeCacheSecurityGroupsResponse
-> Const (First Text) DescribeCacheSecurityGroupsResponse
Lens' DescribeCacheSecurityGroupsResponse (Maybe Text)
describeCacheSecurityGroupsResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeCacheSecurityGroupsResponse
 -> Const (First Text) DescribeCacheSecurityGroupsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeCacheSecurityGroupsResponse 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 DescribeCacheSecurityGroups where
  type
    AWSResponse DescribeCacheSecurityGroups =
      DescribeCacheSecurityGroupsResponse
  request :: DescribeCacheSecurityGroups -> Request DescribeCacheSecurityGroups
request = Service
-> DescribeCacheSecurityGroups
-> Request DescribeCacheSecurityGroups
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeCacheSecurityGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCacheSecurityGroups)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeCacheSecurityGroups))
-> Logger
-> Service
-> Proxy DescribeCacheSecurityGroups
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeCacheSecurityGroups)))
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
"DescribeCacheSecurityGroupsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [CacheSecurityGroup]
-> Maybe Text -> Int -> DescribeCacheSecurityGroupsResponse
DescribeCacheSecurityGroupsResponse'
            (Maybe [CacheSecurityGroup]
 -> Maybe Text -> Int -> DescribeCacheSecurityGroupsResponse)
-> Either String (Maybe [CacheSecurityGroup])
-> Either
     String (Maybe Text -> Int -> DescribeCacheSecurityGroupsResponse)
forall (f :: * -> *) a b. Functor 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
"CacheSecurityGroups"
                            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 [CacheSecurityGroup]))
-> Either String (Maybe [CacheSecurityGroup])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [CacheSecurityGroup])
-> [Node] -> Either String (Maybe [CacheSecurityGroup])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [CacheSecurityGroup]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"CacheSecurityGroup")
                        )
            Either
  String (Maybe Text -> Int -> DescribeCacheSecurityGroupsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeCacheSecurityGroupsResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> DescribeCacheSecurityGroupsResponse)
-> Either String Int
-> Either String DescribeCacheSecurityGroupsResponse
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 DescribeCacheSecurityGroups

instance Prelude.NFData DescribeCacheSecurityGroups

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

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

instance Core.ToQuery DescribeCacheSecurityGroups where
  toQuery :: DescribeCacheSecurityGroups -> QueryString
toQuery DescribeCacheSecurityGroups' {Maybe Int
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
cacheSecurityGroupName :: Maybe Text
$sel:maxRecords:DescribeCacheSecurityGroups' :: DescribeCacheSecurityGroups -> Maybe Int
$sel:marker:DescribeCacheSecurityGroups' :: DescribeCacheSecurityGroups -> Maybe Text
$sel:cacheSecurityGroupName:DescribeCacheSecurityGroups' :: DescribeCacheSecurityGroups -> 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
"DescribeCacheSecurityGroups" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"CacheSecurityGroupName"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
cacheSecurityGroupName,
        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 @DescribeCacheSecurityGroups@ operation.
--
-- /See:/ 'newDescribeCacheSecurityGroupsResponse' smart constructor.
data DescribeCacheSecurityGroupsResponse = DescribeCacheSecurityGroupsResponse'
  { -- | A list of cache security groups. Each element in the list contains
    -- detailed information about one group.
    DescribeCacheSecurityGroupsResponse -> Maybe [CacheSecurityGroup]
cacheSecurityGroups :: Prelude.Maybe [CacheSecurityGroup],
    -- | Provides an identifier to allow retrieval of paginated results.
    DescribeCacheSecurityGroupsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeCacheSecurityGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeCacheSecurityGroupsResponse
-> DescribeCacheSecurityGroupsResponse -> Bool
(DescribeCacheSecurityGroupsResponse
 -> DescribeCacheSecurityGroupsResponse -> Bool)
-> (DescribeCacheSecurityGroupsResponse
    -> DescribeCacheSecurityGroupsResponse -> Bool)
-> Eq DescribeCacheSecurityGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCacheSecurityGroupsResponse
-> DescribeCacheSecurityGroupsResponse -> Bool
$c/= :: DescribeCacheSecurityGroupsResponse
-> DescribeCacheSecurityGroupsResponse -> Bool
== :: DescribeCacheSecurityGroupsResponse
-> DescribeCacheSecurityGroupsResponse -> Bool
$c== :: DescribeCacheSecurityGroupsResponse
-> DescribeCacheSecurityGroupsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeCacheSecurityGroupsResponse]
ReadPrec DescribeCacheSecurityGroupsResponse
Int -> ReadS DescribeCacheSecurityGroupsResponse
ReadS [DescribeCacheSecurityGroupsResponse]
(Int -> ReadS DescribeCacheSecurityGroupsResponse)
-> ReadS [DescribeCacheSecurityGroupsResponse]
-> ReadPrec DescribeCacheSecurityGroupsResponse
-> ReadPrec [DescribeCacheSecurityGroupsResponse]
-> Read DescribeCacheSecurityGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCacheSecurityGroupsResponse]
$creadListPrec :: ReadPrec [DescribeCacheSecurityGroupsResponse]
readPrec :: ReadPrec DescribeCacheSecurityGroupsResponse
$creadPrec :: ReadPrec DescribeCacheSecurityGroupsResponse
readList :: ReadS [DescribeCacheSecurityGroupsResponse]
$creadList :: ReadS [DescribeCacheSecurityGroupsResponse]
readsPrec :: Int -> ReadS DescribeCacheSecurityGroupsResponse
$creadsPrec :: Int -> ReadS DescribeCacheSecurityGroupsResponse
Prelude.Read, Int -> DescribeCacheSecurityGroupsResponse -> ShowS
[DescribeCacheSecurityGroupsResponse] -> ShowS
DescribeCacheSecurityGroupsResponse -> String
(Int -> DescribeCacheSecurityGroupsResponse -> ShowS)
-> (DescribeCacheSecurityGroupsResponse -> String)
-> ([DescribeCacheSecurityGroupsResponse] -> ShowS)
-> Show DescribeCacheSecurityGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCacheSecurityGroupsResponse] -> ShowS
$cshowList :: [DescribeCacheSecurityGroupsResponse] -> ShowS
show :: DescribeCacheSecurityGroupsResponse -> String
$cshow :: DescribeCacheSecurityGroupsResponse -> String
showsPrec :: Int -> DescribeCacheSecurityGroupsResponse -> ShowS
$cshowsPrec :: Int -> DescribeCacheSecurityGroupsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeCacheSecurityGroupsResponse
 -> Rep DescribeCacheSecurityGroupsResponse x)
-> (forall x.
    Rep DescribeCacheSecurityGroupsResponse x
    -> DescribeCacheSecurityGroupsResponse)
-> Generic DescribeCacheSecurityGroupsResponse
forall x.
Rep DescribeCacheSecurityGroupsResponse x
-> DescribeCacheSecurityGroupsResponse
forall x.
DescribeCacheSecurityGroupsResponse
-> Rep DescribeCacheSecurityGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeCacheSecurityGroupsResponse x
-> DescribeCacheSecurityGroupsResponse
$cfrom :: forall x.
DescribeCacheSecurityGroupsResponse
-> Rep DescribeCacheSecurityGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCacheSecurityGroupsResponse' 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:
--
-- 'cacheSecurityGroups', 'describeCacheSecurityGroupsResponse_cacheSecurityGroups' - A list of cache security groups. Each element in the list contains
-- detailed information about one group.
--
-- 'marker', 'describeCacheSecurityGroupsResponse_marker' - Provides an identifier to allow retrieval of paginated results.
--
-- 'httpStatus', 'describeCacheSecurityGroupsResponse_httpStatus' - The response's http status code.
newDescribeCacheSecurityGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCacheSecurityGroupsResponse
newDescribeCacheSecurityGroupsResponse :: Int -> DescribeCacheSecurityGroupsResponse
newDescribeCacheSecurityGroupsResponse Int
pHttpStatus_ =
  DescribeCacheSecurityGroupsResponse' :: Maybe [CacheSecurityGroup]
-> Maybe Text -> Int -> DescribeCacheSecurityGroupsResponse
DescribeCacheSecurityGroupsResponse'
    { $sel:cacheSecurityGroups:DescribeCacheSecurityGroupsResponse' :: Maybe [CacheSecurityGroup]
cacheSecurityGroups =
        Maybe [CacheSecurityGroup]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeCacheSecurityGroupsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCacheSecurityGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of cache security groups. Each element in the list contains
-- detailed information about one group.
describeCacheSecurityGroupsResponse_cacheSecurityGroups :: Lens.Lens' DescribeCacheSecurityGroupsResponse (Prelude.Maybe [CacheSecurityGroup])
describeCacheSecurityGroupsResponse_cacheSecurityGroups :: (Maybe [CacheSecurityGroup] -> f (Maybe [CacheSecurityGroup]))
-> DescribeCacheSecurityGroupsResponse
-> f DescribeCacheSecurityGroupsResponse
describeCacheSecurityGroupsResponse_cacheSecurityGroups = (DescribeCacheSecurityGroupsResponse -> Maybe [CacheSecurityGroup])
-> (DescribeCacheSecurityGroupsResponse
    -> Maybe [CacheSecurityGroup]
    -> DescribeCacheSecurityGroupsResponse)
-> Lens'
     DescribeCacheSecurityGroupsResponse (Maybe [CacheSecurityGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheSecurityGroupsResponse' {Maybe [CacheSecurityGroup]
cacheSecurityGroups :: Maybe [CacheSecurityGroup]
$sel:cacheSecurityGroups:DescribeCacheSecurityGroupsResponse' :: DescribeCacheSecurityGroupsResponse -> Maybe [CacheSecurityGroup]
cacheSecurityGroups} -> Maybe [CacheSecurityGroup]
cacheSecurityGroups) (\s :: DescribeCacheSecurityGroupsResponse
s@DescribeCacheSecurityGroupsResponse' {} Maybe [CacheSecurityGroup]
a -> DescribeCacheSecurityGroupsResponse
s {$sel:cacheSecurityGroups:DescribeCacheSecurityGroupsResponse' :: Maybe [CacheSecurityGroup]
cacheSecurityGroups = Maybe [CacheSecurityGroup]
a} :: DescribeCacheSecurityGroupsResponse) ((Maybe [CacheSecurityGroup] -> f (Maybe [CacheSecurityGroup]))
 -> DescribeCacheSecurityGroupsResponse
 -> f DescribeCacheSecurityGroupsResponse)
-> ((Maybe [CacheSecurityGroup] -> f (Maybe [CacheSecurityGroup]))
    -> Maybe [CacheSecurityGroup] -> f (Maybe [CacheSecurityGroup]))
-> (Maybe [CacheSecurityGroup] -> f (Maybe [CacheSecurityGroup]))
-> DescribeCacheSecurityGroupsResponse
-> f DescribeCacheSecurityGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CacheSecurityGroup]
  [CacheSecurityGroup]
  [CacheSecurityGroup]
  [CacheSecurityGroup]
-> Iso
     (Maybe [CacheSecurityGroup])
     (Maybe [CacheSecurityGroup])
     (Maybe [CacheSecurityGroup])
     (Maybe [CacheSecurityGroup])
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
  [CacheSecurityGroup]
  [CacheSecurityGroup]
  [CacheSecurityGroup]
  [CacheSecurityGroup]
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.
describeCacheSecurityGroupsResponse_marker :: Lens.Lens' DescribeCacheSecurityGroupsResponse (Prelude.Maybe Prelude.Text)
describeCacheSecurityGroupsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeCacheSecurityGroupsResponse
-> f DescribeCacheSecurityGroupsResponse
describeCacheSecurityGroupsResponse_marker = (DescribeCacheSecurityGroupsResponse -> Maybe Text)
-> (DescribeCacheSecurityGroupsResponse
    -> Maybe Text -> DescribeCacheSecurityGroupsResponse)
-> Lens' DescribeCacheSecurityGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCacheSecurityGroupsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeCacheSecurityGroupsResponse' :: DescribeCacheSecurityGroupsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeCacheSecurityGroupsResponse
s@DescribeCacheSecurityGroupsResponse' {} Maybe Text
a -> DescribeCacheSecurityGroupsResponse
s {$sel:marker:DescribeCacheSecurityGroupsResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeCacheSecurityGroupsResponse)

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

instance
  Prelude.NFData
    DescribeCacheSecurityGroupsResponse