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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MemoryDb.Types.ACLPendingChanges
import qualified Amazonka.Prelude as Prelude

-- | An Access Control List. You can authenticate users with Access Contol
-- Lists. ACLs enable you to control cluster access by grouping users.
-- These Access control lists are designed as a way to organize access to
-- clusters.
--
-- /See:/ 'newACL' smart constructor.
data ACL = ACL'
  { -- | Indicates ACL status. Can be \"creating\", \"active\", \"modifying\",
    -- \"deleting\".
    ACL -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The list of user names that belong to the ACL.
    ACL -> Maybe [Text]
userNames :: Prelude.Maybe [Prelude.Text],
    -- | The Amazon Resource Name (ARN) of the ACL
    ACL -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the Access Control List
    ACL -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A list of updates being applied to the ACL.
    ACL -> Maybe ACLPendingChanges
pendingChanges :: Prelude.Maybe ACLPendingChanges,
    -- | The minimum engine version supported for the ACL
    ACL -> Maybe Text
minimumEngineVersion :: Prelude.Maybe Prelude.Text,
    -- | A list of clusters associated with the ACL.
    ACL -> Maybe [Text]
clusters :: Prelude.Maybe [Prelude.Text]
  }
  deriving (ACL -> ACL -> Bool
(ACL -> ACL -> Bool) -> (ACL -> ACL -> Bool) -> Eq ACL
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ACL -> ACL -> Bool
$c/= :: ACL -> ACL -> Bool
== :: ACL -> ACL -> Bool
$c== :: ACL -> ACL -> Bool
Prelude.Eq, ReadPrec [ACL]
ReadPrec ACL
Int -> ReadS ACL
ReadS [ACL]
(Int -> ReadS ACL)
-> ReadS [ACL] -> ReadPrec ACL -> ReadPrec [ACL] -> Read ACL
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ACL]
$creadListPrec :: ReadPrec [ACL]
readPrec :: ReadPrec ACL
$creadPrec :: ReadPrec ACL
readList :: ReadS [ACL]
$creadList :: ReadS [ACL]
readsPrec :: Int -> ReadS ACL
$creadsPrec :: Int -> ReadS ACL
Prelude.Read, Int -> ACL -> ShowS
[ACL] -> ShowS
ACL -> String
(Int -> ACL -> ShowS)
-> (ACL -> String) -> ([ACL] -> ShowS) -> Show ACL
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ACL] -> ShowS
$cshowList :: [ACL] -> ShowS
show :: ACL -> String
$cshow :: ACL -> String
showsPrec :: Int -> ACL -> ShowS
$cshowsPrec :: Int -> ACL -> ShowS
Prelude.Show, (forall x. ACL -> Rep ACL x)
-> (forall x. Rep ACL x -> ACL) -> Generic ACL
forall x. Rep ACL x -> ACL
forall x. ACL -> Rep ACL x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ACL x -> ACL
$cfrom :: forall x. ACL -> Rep ACL x
Prelude.Generic)

-- |
-- Create a value of 'ACL' 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', 'acl_status' - Indicates ACL status. Can be \"creating\", \"active\", \"modifying\",
-- \"deleting\".
--
-- 'userNames', 'acl_userNames' - The list of user names that belong to the ACL.
--
-- 'arn', 'acl_arn' - The Amazon Resource Name (ARN) of the ACL
--
-- 'name', 'acl_name' - The name of the Access Control List
--
-- 'pendingChanges', 'acl_pendingChanges' - A list of updates being applied to the ACL.
--
-- 'minimumEngineVersion', 'acl_minimumEngineVersion' - The minimum engine version supported for the ACL
--
-- 'clusters', 'acl_clusters' - A list of clusters associated with the ACL.
newACL ::
  ACL
newACL :: ACL
newACL =
  ACL' :: Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe ACLPendingChanges
-> Maybe Text
-> Maybe [Text]
-> ACL
ACL'
    { $sel:status:ACL' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:userNames:ACL' :: Maybe [Text]
userNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ACL' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ACL' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pendingChanges:ACL' :: Maybe ACLPendingChanges
pendingChanges = Maybe ACLPendingChanges
forall a. Maybe a
Prelude.Nothing,
      $sel:minimumEngineVersion:ACL' :: Maybe Text
minimumEngineVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusters:ACL' :: Maybe [Text]
clusters = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates ACL status. Can be \"creating\", \"active\", \"modifying\",
-- \"deleting\".
acl_status :: Lens.Lens' ACL (Prelude.Maybe Prelude.Text)
acl_status :: (Maybe Text -> f (Maybe Text)) -> ACL -> f ACL
acl_status = (ACL -> Maybe Text)
-> (ACL -> Maybe Text -> ACL)
-> Lens ACL ACL (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ACL' {Maybe Text
status :: Maybe Text
$sel:status:ACL' :: ACL -> Maybe Text
status} -> Maybe Text
status) (\s :: ACL
s@ACL' {} Maybe Text
a -> ACL
s {$sel:status:ACL' :: Maybe Text
status = Maybe Text
a} :: ACL)

-- | The list of user names that belong to the ACL.
acl_userNames :: Lens.Lens' ACL (Prelude.Maybe [Prelude.Text])
acl_userNames :: (Maybe [Text] -> f (Maybe [Text])) -> ACL -> f ACL
acl_userNames = (ACL -> Maybe [Text])
-> (ACL -> Maybe [Text] -> ACL)
-> Lens ACL ACL (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ACL' {Maybe [Text]
userNames :: Maybe [Text]
$sel:userNames:ACL' :: ACL -> Maybe [Text]
userNames} -> Maybe [Text]
userNames) (\s :: ACL
s@ACL' {} Maybe [Text]
a -> ACL
s {$sel:userNames:ACL' :: Maybe [Text]
userNames = Maybe [Text]
a} :: ACL) ((Maybe [Text] -> f (Maybe [Text])) -> ACL -> f ACL)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ACL
-> f ACL
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The name of the Access Control List
acl_name :: Lens.Lens' ACL (Prelude.Maybe Prelude.Text)
acl_name :: (Maybe Text -> f (Maybe Text)) -> ACL -> f ACL
acl_name = (ACL -> Maybe Text)
-> (ACL -> Maybe Text -> ACL)
-> Lens ACL ACL (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ACL' {Maybe Text
name :: Maybe Text
$sel:name:ACL' :: ACL -> Maybe Text
name} -> Maybe Text
name) (\s :: ACL
s@ACL' {} Maybe Text
a -> ACL
s {$sel:name:ACL' :: Maybe Text
name = Maybe Text
a} :: ACL)

-- | A list of updates being applied to the ACL.
acl_pendingChanges :: Lens.Lens' ACL (Prelude.Maybe ACLPendingChanges)
acl_pendingChanges :: (Maybe ACLPendingChanges -> f (Maybe ACLPendingChanges))
-> ACL -> f ACL
acl_pendingChanges = (ACL -> Maybe ACLPendingChanges)
-> (ACL -> Maybe ACLPendingChanges -> ACL)
-> Lens ACL ACL (Maybe ACLPendingChanges) (Maybe ACLPendingChanges)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ACL' {Maybe ACLPendingChanges
pendingChanges :: Maybe ACLPendingChanges
$sel:pendingChanges:ACL' :: ACL -> Maybe ACLPendingChanges
pendingChanges} -> Maybe ACLPendingChanges
pendingChanges) (\s :: ACL
s@ACL' {} Maybe ACLPendingChanges
a -> ACL
s {$sel:pendingChanges:ACL' :: Maybe ACLPendingChanges
pendingChanges = Maybe ACLPendingChanges
a} :: ACL)

-- | The minimum engine version supported for the ACL
acl_minimumEngineVersion :: Lens.Lens' ACL (Prelude.Maybe Prelude.Text)
acl_minimumEngineVersion :: (Maybe Text -> f (Maybe Text)) -> ACL -> f ACL
acl_minimumEngineVersion = (ACL -> Maybe Text)
-> (ACL -> Maybe Text -> ACL)
-> Lens ACL ACL (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ACL' {Maybe Text
minimumEngineVersion :: Maybe Text
$sel:minimumEngineVersion:ACL' :: ACL -> Maybe Text
minimumEngineVersion} -> Maybe Text
minimumEngineVersion) (\s :: ACL
s@ACL' {} Maybe Text
a -> ACL
s {$sel:minimumEngineVersion:ACL' :: Maybe Text
minimumEngineVersion = Maybe Text
a} :: ACL)

-- | A list of clusters associated with the ACL.
acl_clusters :: Lens.Lens' ACL (Prelude.Maybe [Prelude.Text])
acl_clusters :: (Maybe [Text] -> f (Maybe [Text])) -> ACL -> f ACL
acl_clusters = (ACL -> Maybe [Text])
-> (ACL -> Maybe [Text] -> ACL)
-> Lens ACL ACL (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ACL' {Maybe [Text]
clusters :: Maybe [Text]
$sel:clusters:ACL' :: ACL -> Maybe [Text]
clusters} -> Maybe [Text]
clusters) (\s :: ACL
s@ACL' {} Maybe [Text]
a -> ACL
s {$sel:clusters:ACL' :: Maybe [Text]
clusters = Maybe [Text]
a} :: ACL) ((Maybe [Text] -> f (Maybe [Text])) -> ACL -> f ACL)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ACL
-> f ACL
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ACL where
  parseJSON :: Value -> Parser ACL
parseJSON =
    String -> (Object -> Parser ACL) -> Value -> Parser ACL
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ACL"
      ( \Object
x ->
          Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe ACLPendingChanges
-> Maybe Text
-> Maybe [Text]
-> ACL
ACL'
            (Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Text
 -> Maybe ACLPendingChanges
 -> Maybe Text
 -> Maybe [Text]
 -> ACL)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe ACLPendingChanges
      -> Maybe Text
      -> Maybe [Text]
      -> ACL)
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]
   -> Maybe Text
   -> Maybe Text
   -> Maybe ACLPendingChanges
   -> Maybe Text
   -> Maybe [Text]
   -> ACL)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe ACLPendingChanges
      -> Maybe Text
      -> Maybe [Text]
      -> ACL)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UserNames" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe ACLPendingChanges
   -> Maybe Text
   -> Maybe [Text]
   -> ACL)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe ACLPendingChanges -> Maybe Text -> Maybe [Text] -> ACL)
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
"ARN")
            Parser
  (Maybe Text
   -> Maybe ACLPendingChanges -> Maybe Text -> Maybe [Text] -> ACL)
-> Parser (Maybe Text)
-> Parser
     (Maybe ACLPendingChanges -> Maybe Text -> Maybe [Text] -> ACL)
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
"Name")
            Parser
  (Maybe ACLPendingChanges -> Maybe Text -> Maybe [Text] -> ACL)
-> Parser (Maybe ACLPendingChanges)
-> Parser (Maybe Text -> Maybe [Text] -> ACL)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ACLPendingChanges)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PendingChanges")
            Parser (Maybe Text -> Maybe [Text] -> ACL)
-> Parser (Maybe Text) -> Parser (Maybe [Text] -> ACL)
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
"MinimumEngineVersion")
            Parser (Maybe [Text] -> ACL) -> Parser (Maybe [Text]) -> Parser ACL
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Clusters" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ACL

instance Prelude.NFData ACL