{-# 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.MemoryDb.Types.SecurityGroupMembership
-- 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.MemoryDb.Types.SecurityGroupMembership where

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

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

-- |
-- Create a value of 'SecurityGroupMembership' 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', 'securityGroupMembership_status' - The status of the security group membership. The status changes whenever
-- a security group is modified, or when the security groups assigned to a
-- cluster are modified.
--
-- 'securityGroupId', 'securityGroupMembership_securityGroupId' - The identifier of the security group.
newSecurityGroupMembership ::
  SecurityGroupMembership
newSecurityGroupMembership :: SecurityGroupMembership
newSecurityGroupMembership =
  SecurityGroupMembership' :: Maybe Text -> Maybe Text -> SecurityGroupMembership
SecurityGroupMembership'
    { $sel:status:SecurityGroupMembership' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroupId:SecurityGroupMembership' :: Maybe Text
securityGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The identifier of the security group.
securityGroupMembership_securityGroupId :: Lens.Lens' SecurityGroupMembership (Prelude.Maybe Prelude.Text)
securityGroupMembership_securityGroupId :: (Maybe Text -> f (Maybe Text))
-> SecurityGroupMembership -> f SecurityGroupMembership
securityGroupMembership_securityGroupId = (SecurityGroupMembership -> Maybe Text)
-> (SecurityGroupMembership
    -> Maybe Text -> SecurityGroupMembership)
-> Lens
     SecurityGroupMembership
     SecurityGroupMembership
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityGroupMembership' {Maybe Text
securityGroupId :: Maybe Text
$sel:securityGroupId:SecurityGroupMembership' :: SecurityGroupMembership -> Maybe Text
securityGroupId} -> Maybe Text
securityGroupId) (\s :: SecurityGroupMembership
s@SecurityGroupMembership' {} Maybe Text
a -> SecurityGroupMembership
s {$sel:securityGroupId:SecurityGroupMembership' :: Maybe Text
securityGroupId = Maybe Text
a} :: SecurityGroupMembership)

instance Core.FromJSON SecurityGroupMembership where
  parseJSON :: Value -> Parser SecurityGroupMembership
parseJSON =
    String
-> (Object -> Parser SecurityGroupMembership)
-> Value
-> Parser SecurityGroupMembership
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"SecurityGroupMembership"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> SecurityGroupMembership
SecurityGroupMembership'
            (Maybe Text -> Maybe Text -> SecurityGroupMembership)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SecurityGroupMembership)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Status")
            Parser (Maybe Text -> SecurityGroupMembership)
-> Parser (Maybe Text) -> Parser SecurityGroupMembership
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SecurityGroupId")
      )

instance Prelude.Hashable SecurityGroupMembership

instance Prelude.NFData SecurityGroupMembership