{-# 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.CacheSecurityGroupMembership
-- 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.CacheSecurityGroupMembership where

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

-- | Represents a cluster\'s status within a particular cache security group.
--
-- /See:/ 'newCacheSecurityGroupMembership' smart constructor.
data CacheSecurityGroupMembership = CacheSecurityGroupMembership'
  { -- | The membership status in the cache security group. The status changes
    -- when a cache security group is modified, or when the cache security
    -- groups assigned to a cluster are modified.
    CacheSecurityGroupMembership -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The name of the cache security group.
    CacheSecurityGroupMembership -> Maybe Text
cacheSecurityGroupName :: Prelude.Maybe Prelude.Text
  }
  deriving (CacheSecurityGroupMembership
-> CacheSecurityGroupMembership -> Bool
(CacheSecurityGroupMembership
 -> CacheSecurityGroupMembership -> Bool)
-> (CacheSecurityGroupMembership
    -> CacheSecurityGroupMembership -> Bool)
-> Eq CacheSecurityGroupMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CacheSecurityGroupMembership
-> CacheSecurityGroupMembership -> Bool
$c/= :: CacheSecurityGroupMembership
-> CacheSecurityGroupMembership -> Bool
== :: CacheSecurityGroupMembership
-> CacheSecurityGroupMembership -> Bool
$c== :: CacheSecurityGroupMembership
-> CacheSecurityGroupMembership -> Bool
Prelude.Eq, ReadPrec [CacheSecurityGroupMembership]
ReadPrec CacheSecurityGroupMembership
Int -> ReadS CacheSecurityGroupMembership
ReadS [CacheSecurityGroupMembership]
(Int -> ReadS CacheSecurityGroupMembership)
-> ReadS [CacheSecurityGroupMembership]
-> ReadPrec CacheSecurityGroupMembership
-> ReadPrec [CacheSecurityGroupMembership]
-> Read CacheSecurityGroupMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CacheSecurityGroupMembership]
$creadListPrec :: ReadPrec [CacheSecurityGroupMembership]
readPrec :: ReadPrec CacheSecurityGroupMembership
$creadPrec :: ReadPrec CacheSecurityGroupMembership
readList :: ReadS [CacheSecurityGroupMembership]
$creadList :: ReadS [CacheSecurityGroupMembership]
readsPrec :: Int -> ReadS CacheSecurityGroupMembership
$creadsPrec :: Int -> ReadS CacheSecurityGroupMembership
Prelude.Read, Int -> CacheSecurityGroupMembership -> ShowS
[CacheSecurityGroupMembership] -> ShowS
CacheSecurityGroupMembership -> String
(Int -> CacheSecurityGroupMembership -> ShowS)
-> (CacheSecurityGroupMembership -> String)
-> ([CacheSecurityGroupMembership] -> ShowS)
-> Show CacheSecurityGroupMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CacheSecurityGroupMembership] -> ShowS
$cshowList :: [CacheSecurityGroupMembership] -> ShowS
show :: CacheSecurityGroupMembership -> String
$cshow :: CacheSecurityGroupMembership -> String
showsPrec :: Int -> CacheSecurityGroupMembership -> ShowS
$cshowsPrec :: Int -> CacheSecurityGroupMembership -> ShowS
Prelude.Show, (forall x.
 CacheSecurityGroupMembership -> Rep CacheSecurityGroupMembership x)
-> (forall x.
    Rep CacheSecurityGroupMembership x -> CacheSecurityGroupMembership)
-> Generic CacheSecurityGroupMembership
forall x.
Rep CacheSecurityGroupMembership x -> CacheSecurityGroupMembership
forall x.
CacheSecurityGroupMembership -> Rep CacheSecurityGroupMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CacheSecurityGroupMembership x -> CacheSecurityGroupMembership
$cfrom :: forall x.
CacheSecurityGroupMembership -> Rep CacheSecurityGroupMembership x
Prelude.Generic)

-- |
-- Create a value of 'CacheSecurityGroupMembership' 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:
--
-- 'status', 'cacheSecurityGroupMembership_status' - The membership status in the cache security group. The status changes
-- when a cache security group is modified, or when the cache security
-- groups assigned to a cluster are modified.
--
-- 'cacheSecurityGroupName', 'cacheSecurityGroupMembership_cacheSecurityGroupName' - The name of the cache security group.
newCacheSecurityGroupMembership ::
  CacheSecurityGroupMembership
newCacheSecurityGroupMembership :: CacheSecurityGroupMembership
newCacheSecurityGroupMembership =
  CacheSecurityGroupMembership' :: Maybe Text -> Maybe Text -> CacheSecurityGroupMembership
CacheSecurityGroupMembership'
    { $sel:status:CacheSecurityGroupMembership' :: Maybe Text
status =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:cacheSecurityGroupName:CacheSecurityGroupMembership' :: Maybe Text
cacheSecurityGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The membership status in the cache security group. The status changes
-- when a cache security group is modified, or when the cache security
-- groups assigned to a cluster are modified.
cacheSecurityGroupMembership_status :: Lens.Lens' CacheSecurityGroupMembership (Prelude.Maybe Prelude.Text)
cacheSecurityGroupMembership_status :: (Maybe Text -> f (Maybe Text))
-> CacheSecurityGroupMembership -> f CacheSecurityGroupMembership
cacheSecurityGroupMembership_status = (CacheSecurityGroupMembership -> Maybe Text)
-> (CacheSecurityGroupMembership
    -> Maybe Text -> CacheSecurityGroupMembership)
-> Lens
     CacheSecurityGroupMembership
     CacheSecurityGroupMembership
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CacheSecurityGroupMembership' {Maybe Text
status :: Maybe Text
$sel:status:CacheSecurityGroupMembership' :: CacheSecurityGroupMembership -> Maybe Text
status} -> Maybe Text
status) (\s :: CacheSecurityGroupMembership
s@CacheSecurityGroupMembership' {} Maybe Text
a -> CacheSecurityGroupMembership
s {$sel:status:CacheSecurityGroupMembership' :: Maybe Text
status = Maybe Text
a} :: CacheSecurityGroupMembership)

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

instance Core.FromXML CacheSecurityGroupMembership where
  parseXML :: [Node] -> Either String CacheSecurityGroupMembership
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> CacheSecurityGroupMembership
CacheSecurityGroupMembership'
      (Maybe Text -> Maybe Text -> CacheSecurityGroupMembership)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> CacheSecurityGroupMembership)
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
"Status")
      Either String (Maybe Text -> CacheSecurityGroupMembership)
-> Either String (Maybe Text)
-> Either String CacheSecurityGroupMembership
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
"CacheSecurityGroupName")

instance
  Prelude.Hashable
    CacheSecurityGroupMembership

instance Prelude.NFData CacheSecurityGroupMembership