{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MemoryDb.Types.ACL where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | The Amazon Resource Name (ARN) of the ACL
    ACL -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | A list of clusters associated with the ACL.
    ACL -> Maybe [Text]
clusters :: Prelude.Maybe [Prelude.Text],
    -- | The minimum engine version supported for the ACL
    ACL -> Maybe Text
minimumEngineVersion :: 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,
    -- | 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]
  }
  deriving (ACL -> ACL -> Bool
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]
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
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. 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:
--
-- 'arn', 'acl_arn' - The Amazon Resource Name (ARN) of the ACL
--
-- 'clusters', 'acl_clusters' - A list of clusters associated with the ACL.
--
-- 'minimumEngineVersion', 'acl_minimumEngineVersion' - The minimum engine version supported for the ACL
--
-- 'name', 'acl_name' - The name of the Access Control List
--
-- 'pendingChanges', 'acl_pendingChanges' - A list of updates being applied to the ACL.
--
-- '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.
newACL ::
  ACL
newACL :: ACL
newACL =
  ACL'
    { $sel:arn:ACL' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:clusters:ACL' :: Maybe [Text]
clusters = forall a. Maybe a
Prelude.Nothing,
      $sel:minimumEngineVersion:ACL' :: Maybe Text
minimumEngineVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:name:ACL' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:pendingChanges:ACL' :: Maybe ACLPendingChanges
pendingChanges = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ACL' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing,
      $sel:userNames:ACL' :: Maybe [Text]
userNames = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the ACL
acl_arn :: Lens.Lens' ACL (Prelude.Maybe Prelude.Text)
acl_arn :: Lens' ACL (Maybe Text)
acl_arn = 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)

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

-- | The minimum engine version supported for the ACL
acl_minimumEngineVersion :: Lens.Lens' ACL (Prelude.Maybe Prelude.Text)
acl_minimumEngineVersion :: Lens' ACL (Maybe Text)
acl_minimumEngineVersion = 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)

-- | The name of the Access Control List
acl_name :: Lens.Lens' ACL (Prelude.Maybe Prelude.Text)
acl_name :: Lens' ACL (Maybe Text)
acl_name = 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 :: Lens' ACL (Maybe ACLPendingChanges)
acl_pendingChanges = 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)

-- | Indicates ACL status. Can be \"creating\", \"active\", \"modifying\",
-- \"deleting\".
acl_status :: Lens.Lens' ACL (Prelude.Maybe Prelude.Text)
acl_status :: Lens' ACL (Maybe Text)
acl_status = 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 :: Lens' ACL (Maybe [Text])
acl_userNames = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable ACL where
  hashWithSalt :: Int -> ACL -> Int
hashWithSalt Int
_salt ACL' {Maybe [Text]
Maybe Text
Maybe ACLPendingChanges
userNames :: Maybe [Text]
status :: Maybe Text
pendingChanges :: Maybe ACLPendingChanges
name :: Maybe Text
minimumEngineVersion :: Maybe Text
clusters :: Maybe [Text]
arn :: Maybe Text
$sel:userNames:ACL' :: ACL -> Maybe [Text]
$sel:status:ACL' :: ACL -> Maybe Text
$sel:pendingChanges:ACL' :: ACL -> Maybe ACLPendingChanges
$sel:name:ACL' :: ACL -> Maybe Text
$sel:minimumEngineVersion:ACL' :: ACL -> Maybe Text
$sel:clusters:ACL' :: ACL -> Maybe [Text]
$sel:arn:ACL' :: ACL -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
clusters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
minimumEngineVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ACLPendingChanges
pendingChanges
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
userNames

instance Prelude.NFData ACL where
  rnf :: ACL -> ()
rnf ACL' {Maybe [Text]
Maybe Text
Maybe ACLPendingChanges
userNames :: Maybe [Text]
status :: Maybe Text
pendingChanges :: Maybe ACLPendingChanges
name :: Maybe Text
minimumEngineVersion :: Maybe Text
clusters :: Maybe [Text]
arn :: Maybe Text
$sel:userNames:ACL' :: ACL -> Maybe [Text]
$sel:status:ACL' :: ACL -> Maybe Text
$sel:pendingChanges:ACL' :: ACL -> Maybe ACLPendingChanges
$sel:name:ACL' :: ACL -> Maybe Text
$sel:minimumEngineVersion:ACL' :: ACL -> Maybe Text
$sel:clusters:ACL' :: ACL -> Maybe [Text]
$sel:arn:ACL' :: ACL -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
clusters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
minimumEngineVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ACLPendingChanges
pendingChanges
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
userNames