{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.CacheParameterGroup
-- 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)
module Amazonka.ElastiCache.Types.CacheParameterGroup where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the output of a @CreateCacheParameterGroup@ operation.
--
-- /See:/ 'newCacheParameterGroup' smart constructor.
data CacheParameterGroup = CacheParameterGroup'
  { -- | The name of the cache parameter group family that this cache parameter
    -- group is compatible with.
    --
    -- Valid values are: @memcached1.4@ | @memcached1.5@ | @memcached1.6@ |
    -- @redis2.6@ | @redis2.8@ | @redis3.2@ | @redis4.0@ | @redis5.0@ |
    -- @redis6.x@ |
    CacheParameterGroup -> Maybe Text
cacheParameterGroupFamily :: Prelude.Maybe Prelude.Text,
    -- | The ARN (Amazon Resource Name) of the cache parameter group.
    CacheParameterGroup -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the cache parameter group.
    CacheParameterGroup -> Maybe Text
cacheParameterGroupName :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the parameter group is associated with a Global
    -- datastore
    CacheParameterGroup -> Maybe Bool
isGlobal :: Prelude.Maybe Prelude.Bool,
    -- | The description for this cache parameter group.
    CacheParameterGroup -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (CacheParameterGroup -> CacheParameterGroup -> Bool
(CacheParameterGroup -> CacheParameterGroup -> Bool)
-> (CacheParameterGroup -> CacheParameterGroup -> Bool)
-> Eq CacheParameterGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CacheParameterGroup -> CacheParameterGroup -> Bool
$c/= :: CacheParameterGroup -> CacheParameterGroup -> Bool
== :: CacheParameterGroup -> CacheParameterGroup -> Bool
$c== :: CacheParameterGroup -> CacheParameterGroup -> Bool
Prelude.Eq, ReadPrec [CacheParameterGroup]
ReadPrec CacheParameterGroup
Int -> ReadS CacheParameterGroup
ReadS [CacheParameterGroup]
(Int -> ReadS CacheParameterGroup)
-> ReadS [CacheParameterGroup]
-> ReadPrec CacheParameterGroup
-> ReadPrec [CacheParameterGroup]
-> Read CacheParameterGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CacheParameterGroup]
$creadListPrec :: ReadPrec [CacheParameterGroup]
readPrec :: ReadPrec CacheParameterGroup
$creadPrec :: ReadPrec CacheParameterGroup
readList :: ReadS [CacheParameterGroup]
$creadList :: ReadS [CacheParameterGroup]
readsPrec :: Int -> ReadS CacheParameterGroup
$creadsPrec :: Int -> ReadS CacheParameterGroup
Prelude.Read, Int -> CacheParameterGroup -> ShowS
[CacheParameterGroup] -> ShowS
CacheParameterGroup -> String
(Int -> CacheParameterGroup -> ShowS)
-> (CacheParameterGroup -> String)
-> ([CacheParameterGroup] -> ShowS)
-> Show CacheParameterGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CacheParameterGroup] -> ShowS
$cshowList :: [CacheParameterGroup] -> ShowS
show :: CacheParameterGroup -> String
$cshow :: CacheParameterGroup -> String
showsPrec :: Int -> CacheParameterGroup -> ShowS
$cshowsPrec :: Int -> CacheParameterGroup -> ShowS
Prelude.Show, (forall x. CacheParameterGroup -> Rep CacheParameterGroup x)
-> (forall x. Rep CacheParameterGroup x -> CacheParameterGroup)
-> Generic CacheParameterGroup
forall x. Rep CacheParameterGroup x -> CacheParameterGroup
forall x. CacheParameterGroup -> Rep CacheParameterGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CacheParameterGroup x -> CacheParameterGroup
$cfrom :: forall x. CacheParameterGroup -> Rep CacheParameterGroup x
Prelude.Generic)

-- |
-- Create a value of 'CacheParameterGroup' 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:
--
-- 'cacheParameterGroupFamily', 'cacheParameterGroup_cacheParameterGroupFamily' - The name of the cache parameter group family that this cache parameter
-- group is compatible with.
--
-- Valid values are: @memcached1.4@ | @memcached1.5@ | @memcached1.6@ |
-- @redis2.6@ | @redis2.8@ | @redis3.2@ | @redis4.0@ | @redis5.0@ |
-- @redis6.x@ |
--
-- 'arn', 'cacheParameterGroup_arn' - The ARN (Amazon Resource Name) of the cache parameter group.
--
-- 'cacheParameterGroupName', 'cacheParameterGroup_cacheParameterGroupName' - The name of the cache parameter group.
--
-- 'isGlobal', 'cacheParameterGroup_isGlobal' - Indicates whether the parameter group is associated with a Global
-- datastore
--
-- 'description', 'cacheParameterGroup_description' - The description for this cache parameter group.
newCacheParameterGroup ::
  CacheParameterGroup
newCacheParameterGroup :: CacheParameterGroup
newCacheParameterGroup =
  CacheParameterGroup' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> CacheParameterGroup
CacheParameterGroup'
    { $sel:cacheParameterGroupFamily:CacheParameterGroup' :: Maybe Text
cacheParameterGroupFamily =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CacheParameterGroup' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheParameterGroupName:CacheParameterGroup' :: Maybe Text
cacheParameterGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isGlobal:CacheParameterGroup' :: Maybe Bool
isGlobal = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CacheParameterGroup' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the cache parameter group family that this cache parameter
-- group is compatible with.
--
-- Valid values are: @memcached1.4@ | @memcached1.5@ | @memcached1.6@ |
-- @redis2.6@ | @redis2.8@ | @redis3.2@ | @redis4.0@ | @redis5.0@ |
-- @redis6.x@ |
cacheParameterGroup_cacheParameterGroupFamily :: Lens.Lens' CacheParameterGroup (Prelude.Maybe Prelude.Text)
cacheParameterGroup_cacheParameterGroupFamily :: (Maybe Text -> f (Maybe Text))
-> CacheParameterGroup -> f CacheParameterGroup
cacheParameterGroup_cacheParameterGroupFamily = (CacheParameterGroup -> Maybe Text)
-> (CacheParameterGroup -> Maybe Text -> CacheParameterGroup)
-> Lens
     CacheParameterGroup CacheParameterGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheParameterGroup' {Maybe Text
cacheParameterGroupFamily :: Maybe Text
$sel:cacheParameterGroupFamily:CacheParameterGroup' :: CacheParameterGroup -> Maybe Text
cacheParameterGroupFamily} -> Maybe Text
cacheParameterGroupFamily) (\s :: CacheParameterGroup
s@CacheParameterGroup' {} Maybe Text
a -> CacheParameterGroup
s {$sel:cacheParameterGroupFamily:CacheParameterGroup' :: Maybe Text
cacheParameterGroupFamily = Maybe Text
a} :: CacheParameterGroup)

-- | The ARN (Amazon Resource Name) of the cache parameter group.
cacheParameterGroup_arn :: Lens.Lens' CacheParameterGroup (Prelude.Maybe Prelude.Text)
cacheParameterGroup_arn :: (Maybe Text -> f (Maybe Text))
-> CacheParameterGroup -> f CacheParameterGroup
cacheParameterGroup_arn = (CacheParameterGroup -> Maybe Text)
-> (CacheParameterGroup -> Maybe Text -> CacheParameterGroup)
-> Lens
     CacheParameterGroup CacheParameterGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheParameterGroup' {Maybe Text
arn :: Maybe Text
$sel:arn:CacheParameterGroup' :: CacheParameterGroup -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CacheParameterGroup
s@CacheParameterGroup' {} Maybe Text
a -> CacheParameterGroup
s {$sel:arn:CacheParameterGroup' :: Maybe Text
arn = Maybe Text
a} :: CacheParameterGroup)

-- | The name of the cache parameter group.
cacheParameterGroup_cacheParameterGroupName :: Lens.Lens' CacheParameterGroup (Prelude.Maybe Prelude.Text)
cacheParameterGroup_cacheParameterGroupName :: (Maybe Text -> f (Maybe Text))
-> CacheParameterGroup -> f CacheParameterGroup
cacheParameterGroup_cacheParameterGroupName = (CacheParameterGroup -> Maybe Text)
-> (CacheParameterGroup -> Maybe Text -> CacheParameterGroup)
-> Lens
     CacheParameterGroup CacheParameterGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheParameterGroup' {Maybe Text
cacheParameterGroupName :: Maybe Text
$sel:cacheParameterGroupName:CacheParameterGroup' :: CacheParameterGroup -> Maybe Text
cacheParameterGroupName} -> Maybe Text
cacheParameterGroupName) (\s :: CacheParameterGroup
s@CacheParameterGroup' {} Maybe Text
a -> CacheParameterGroup
s {$sel:cacheParameterGroupName:CacheParameterGroup' :: Maybe Text
cacheParameterGroupName = Maybe Text
a} :: CacheParameterGroup)

-- | Indicates whether the parameter group is associated with a Global
-- datastore
cacheParameterGroup_isGlobal :: Lens.Lens' CacheParameterGroup (Prelude.Maybe Prelude.Bool)
cacheParameterGroup_isGlobal :: (Maybe Bool -> f (Maybe Bool))
-> CacheParameterGroup -> f CacheParameterGroup
cacheParameterGroup_isGlobal = (CacheParameterGroup -> Maybe Bool)
-> (CacheParameterGroup -> Maybe Bool -> CacheParameterGroup)
-> Lens
     CacheParameterGroup CacheParameterGroup (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheParameterGroup' {Maybe Bool
isGlobal :: Maybe Bool
$sel:isGlobal:CacheParameterGroup' :: CacheParameterGroup -> Maybe Bool
isGlobal} -> Maybe Bool
isGlobal) (\s :: CacheParameterGroup
s@CacheParameterGroup' {} Maybe Bool
a -> CacheParameterGroup
s {$sel:isGlobal:CacheParameterGroup' :: Maybe Bool
isGlobal = Maybe Bool
a} :: CacheParameterGroup)

-- | The description for this cache parameter group.
cacheParameterGroup_description :: Lens.Lens' CacheParameterGroup (Prelude.Maybe Prelude.Text)
cacheParameterGroup_description :: (Maybe Text -> f (Maybe Text))
-> CacheParameterGroup -> f CacheParameterGroup
cacheParameterGroup_description = (CacheParameterGroup -> Maybe Text)
-> (CacheParameterGroup -> Maybe Text -> CacheParameterGroup)
-> Lens
     CacheParameterGroup CacheParameterGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheParameterGroup' {Maybe Text
description :: Maybe Text
$sel:description:CacheParameterGroup' :: CacheParameterGroup -> Maybe Text
description} -> Maybe Text
description) (\s :: CacheParameterGroup
s@CacheParameterGroup' {} Maybe Text
a -> CacheParameterGroup
s {$sel:description:CacheParameterGroup' :: Maybe Text
description = Maybe Text
a} :: CacheParameterGroup)

instance Core.FromXML CacheParameterGroup where
  parseXML :: [Node] -> Either String CacheParameterGroup
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe Text
-> CacheParameterGroup
CacheParameterGroup'
      (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> CacheParameterGroup)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Bool -> Maybe Text -> CacheParameterGroup)
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
"CacheParameterGroupFamily")
      Either
  String
  (Maybe Text
   -> Maybe Text -> Maybe Bool -> Maybe Text -> CacheParameterGroup)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Bool -> Maybe Text -> CacheParameterGroup)
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
"ARN")
      Either
  String
  (Maybe Text -> Maybe Bool -> Maybe Text -> CacheParameterGroup)
-> Either String (Maybe Text)
-> Either String (Maybe Bool -> Maybe Text -> CacheParameterGroup)
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
"CacheParameterGroupName")
      Either String (Maybe Bool -> Maybe Text -> CacheParameterGroup)
-> Either String (Maybe Bool)
-> Either String (Maybe Text -> CacheParameterGroup)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsGlobal")
      Either String (Maybe Text -> CacheParameterGroup)
-> Either String (Maybe Text) -> Either String CacheParameterGroup
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
"Description")

instance Prelude.Hashable CacheParameterGroup

instance Prelude.NFData CacheParameterGroup