{-# 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.SSOAdmin.Types.PermissionSet
-- 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.SSOAdmin.Types.PermissionSet where

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

-- | An entity that contains IAM policies.
--
-- /See:/ 'newPermissionSet' smart constructor.
data PermissionSet = PermissionSet'
  { -- | Used to redirect users within the application during the federation
    -- authentication process.
    PermissionSet -> Maybe Text
relayState :: Prelude.Maybe Prelude.Text,
    -- | The length of time that the application user sessions are valid for in
    -- the ISO-8601 standard.
    PermissionSet -> Maybe Text
sessionDuration :: Prelude.Maybe Prelude.Text,
    -- | The date that the permission set was created.
    PermissionSet -> Maybe POSIX
createdDate :: Prelude.Maybe Core.POSIX,
    -- | The ARN of the permission set. For more information about ARNs, see
    -- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
    -- in the /Amazon Web Services General Reference/.
    PermissionSet -> Maybe Text
permissionSetArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the permission set.
    PermissionSet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The description of the PermissionSet.
    PermissionSet -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (PermissionSet -> PermissionSet -> Bool
(PermissionSet -> PermissionSet -> Bool)
-> (PermissionSet -> PermissionSet -> Bool) -> Eq PermissionSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PermissionSet -> PermissionSet -> Bool
$c/= :: PermissionSet -> PermissionSet -> Bool
== :: PermissionSet -> PermissionSet -> Bool
$c== :: PermissionSet -> PermissionSet -> Bool
Prelude.Eq, ReadPrec [PermissionSet]
ReadPrec PermissionSet
Int -> ReadS PermissionSet
ReadS [PermissionSet]
(Int -> ReadS PermissionSet)
-> ReadS [PermissionSet]
-> ReadPrec PermissionSet
-> ReadPrec [PermissionSet]
-> Read PermissionSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PermissionSet]
$creadListPrec :: ReadPrec [PermissionSet]
readPrec :: ReadPrec PermissionSet
$creadPrec :: ReadPrec PermissionSet
readList :: ReadS [PermissionSet]
$creadList :: ReadS [PermissionSet]
readsPrec :: Int -> ReadS PermissionSet
$creadsPrec :: Int -> ReadS PermissionSet
Prelude.Read, Int -> PermissionSet -> ShowS
[PermissionSet] -> ShowS
PermissionSet -> String
(Int -> PermissionSet -> ShowS)
-> (PermissionSet -> String)
-> ([PermissionSet] -> ShowS)
-> Show PermissionSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PermissionSet] -> ShowS
$cshowList :: [PermissionSet] -> ShowS
show :: PermissionSet -> String
$cshow :: PermissionSet -> String
showsPrec :: Int -> PermissionSet -> ShowS
$cshowsPrec :: Int -> PermissionSet -> ShowS
Prelude.Show, (forall x. PermissionSet -> Rep PermissionSet x)
-> (forall x. Rep PermissionSet x -> PermissionSet)
-> Generic PermissionSet
forall x. Rep PermissionSet x -> PermissionSet
forall x. PermissionSet -> Rep PermissionSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PermissionSet x -> PermissionSet
$cfrom :: forall x. PermissionSet -> Rep PermissionSet x
Prelude.Generic)

-- |
-- Create a value of 'PermissionSet' 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:
--
-- 'relayState', 'permissionSet_relayState' - Used to redirect users within the application during the federation
-- authentication process.
--
-- 'sessionDuration', 'permissionSet_sessionDuration' - The length of time that the application user sessions are valid for in
-- the ISO-8601 standard.
--
-- 'createdDate', 'permissionSet_createdDate' - The date that the permission set was created.
--
-- 'permissionSetArn', 'permissionSet_permissionSetArn' - The ARN of the permission set. For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
--
-- 'name', 'permissionSet_name' - The name of the permission set.
--
-- 'description', 'permissionSet_description' - The description of the PermissionSet.
newPermissionSet ::
  PermissionSet
newPermissionSet :: PermissionSet
newPermissionSet =
  PermissionSet' :: Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PermissionSet
PermissionSet'
    { $sel:relayState:PermissionSet' :: Maybe Text
relayState = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sessionDuration:PermissionSet' :: Maybe Text
sessionDuration = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:PermissionSet' :: Maybe POSIX
createdDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:permissionSetArn:PermissionSet' :: Maybe Text
permissionSetArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:PermissionSet' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:PermissionSet' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Used to redirect users within the application during the federation
-- authentication process.
permissionSet_relayState :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_relayState :: (Maybe Text -> f (Maybe Text)) -> PermissionSet -> f PermissionSet
permissionSet_relayState = (PermissionSet -> Maybe Text)
-> (PermissionSet -> Maybe Text -> PermissionSet)
-> Lens PermissionSet PermissionSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PermissionSet' {Maybe Text
relayState :: Maybe Text
$sel:relayState:PermissionSet' :: PermissionSet -> Maybe Text
relayState} -> Maybe Text
relayState) (\s :: PermissionSet
s@PermissionSet' {} Maybe Text
a -> PermissionSet
s {$sel:relayState:PermissionSet' :: Maybe Text
relayState = Maybe Text
a} :: PermissionSet)

-- | The length of time that the application user sessions are valid for in
-- the ISO-8601 standard.
permissionSet_sessionDuration :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_sessionDuration :: (Maybe Text -> f (Maybe Text)) -> PermissionSet -> f PermissionSet
permissionSet_sessionDuration = (PermissionSet -> Maybe Text)
-> (PermissionSet -> Maybe Text -> PermissionSet)
-> Lens PermissionSet PermissionSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PermissionSet' {Maybe Text
sessionDuration :: Maybe Text
$sel:sessionDuration:PermissionSet' :: PermissionSet -> Maybe Text
sessionDuration} -> Maybe Text
sessionDuration) (\s :: PermissionSet
s@PermissionSet' {} Maybe Text
a -> PermissionSet
s {$sel:sessionDuration:PermissionSet' :: Maybe Text
sessionDuration = Maybe Text
a} :: PermissionSet)

-- | The date that the permission set was created.
permissionSet_createdDate :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.UTCTime)
permissionSet_createdDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> PermissionSet -> f PermissionSet
permissionSet_createdDate = (PermissionSet -> Maybe POSIX)
-> (PermissionSet -> Maybe POSIX -> PermissionSet)
-> Lens PermissionSet PermissionSet (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PermissionSet' {Maybe POSIX
createdDate :: Maybe POSIX
$sel:createdDate:PermissionSet' :: PermissionSet -> Maybe POSIX
createdDate} -> Maybe POSIX
createdDate) (\s :: PermissionSet
s@PermissionSet' {} Maybe POSIX
a -> PermissionSet
s {$sel:createdDate:PermissionSet' :: Maybe POSIX
createdDate = Maybe POSIX
a} :: PermissionSet) ((Maybe POSIX -> f (Maybe POSIX))
 -> PermissionSet -> f PermissionSet)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> PermissionSet
-> f PermissionSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The ARN of the permission set. For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
permissionSet_permissionSetArn :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_permissionSetArn :: (Maybe Text -> f (Maybe Text)) -> PermissionSet -> f PermissionSet
permissionSet_permissionSetArn = (PermissionSet -> Maybe Text)
-> (PermissionSet -> Maybe Text -> PermissionSet)
-> Lens PermissionSet PermissionSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PermissionSet' {Maybe Text
permissionSetArn :: Maybe Text
$sel:permissionSetArn:PermissionSet' :: PermissionSet -> Maybe Text
permissionSetArn} -> Maybe Text
permissionSetArn) (\s :: PermissionSet
s@PermissionSet' {} Maybe Text
a -> PermissionSet
s {$sel:permissionSetArn:PermissionSet' :: Maybe Text
permissionSetArn = Maybe Text
a} :: PermissionSet)

-- | The name of the permission set.
permissionSet_name :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_name :: (Maybe Text -> f (Maybe Text)) -> PermissionSet -> f PermissionSet
permissionSet_name = (PermissionSet -> Maybe Text)
-> (PermissionSet -> Maybe Text -> PermissionSet)
-> Lens PermissionSet PermissionSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PermissionSet' {Maybe Text
name :: Maybe Text
$sel:name:PermissionSet' :: PermissionSet -> Maybe Text
name} -> Maybe Text
name) (\s :: PermissionSet
s@PermissionSet' {} Maybe Text
a -> PermissionSet
s {$sel:name:PermissionSet' :: Maybe Text
name = Maybe Text
a} :: PermissionSet)

-- | The description of the PermissionSet.
permissionSet_description :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_description :: (Maybe Text -> f (Maybe Text)) -> PermissionSet -> f PermissionSet
permissionSet_description = (PermissionSet -> Maybe Text)
-> (PermissionSet -> Maybe Text -> PermissionSet)
-> Lens PermissionSet PermissionSet (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PermissionSet' {Maybe Text
description :: Maybe Text
$sel:description:PermissionSet' :: PermissionSet -> Maybe Text
description} -> Maybe Text
description) (\s :: PermissionSet
s@PermissionSet' {} Maybe Text
a -> PermissionSet
s {$sel:description:PermissionSet' :: Maybe Text
description = Maybe Text
a} :: PermissionSet)

instance Core.FromJSON PermissionSet where
  parseJSON :: Value -> Parser PermissionSet
parseJSON =
    String
-> (Object -> Parser PermissionSet)
-> Value
-> Parser PermissionSet
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PermissionSet"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> PermissionSet
PermissionSet'
            (Maybe Text
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> PermissionSet)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> PermissionSet)
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
"RelayState")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> PermissionSet)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe Text -> PermissionSet)
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
"SessionDuration")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe Text -> PermissionSet)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> PermissionSet)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CreatedDate")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> PermissionSet)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> PermissionSet)
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
"PermissionSetArn")
            Parser (Maybe Text -> Maybe Text -> PermissionSet)
-> Parser (Maybe Text) -> Parser (Maybe Text -> PermissionSet)
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 Text -> PermissionSet)
-> Parser (Maybe Text) -> Parser PermissionSet
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
"Description")
      )

instance Prelude.Hashable PermissionSet

instance Prelude.NFData PermissionSet