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

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

-- | An entity that contains IAM policies.
--
-- /See:/ 'newPermissionSet' smart constructor.
data PermissionSet = PermissionSet'
  { -- | The date that the permission set was created.
    PermissionSet -> Maybe POSIX
createdDate :: Prelude.Maybe Data.POSIX,
    -- | The description of the PermissionSet.
    PermissionSet -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The name of the permission set.
    PermissionSet -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | 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 AWS Service Namespaces>
    -- in the /AWS General Reference/.
    PermissionSet -> Maybe Text
permissionSetArn :: Prelude.Maybe Prelude.Text,
    -- | 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
  }
  deriving (PermissionSet -> PermissionSet -> Bool
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]
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
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. 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:
--
-- 'createdDate', 'permissionSet_createdDate' - The date that the permission set was created.
--
-- 'description', 'permissionSet_description' - The description of the PermissionSet.
--
-- 'name', 'permissionSet_name' - The name of the permission set.
--
-- '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 AWS Service Namespaces>
-- in the /AWS General Reference/.
--
-- '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.
newPermissionSet ::
  PermissionSet
newPermissionSet :: PermissionSet
newPermissionSet =
  PermissionSet'
    { $sel:createdDate:PermissionSet' :: Maybe POSIX
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:PermissionSet' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:name:PermissionSet' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:permissionSetArn:PermissionSet' :: Maybe Text
permissionSetArn = forall a. Maybe a
Prelude.Nothing,
      $sel:relayState:PermissionSet' :: Maybe Text
relayState = forall a. Maybe a
Prelude.Nothing,
      $sel:sessionDuration:PermissionSet' :: Maybe Text
sessionDuration = forall a. Maybe a
Prelude.Nothing
    }

-- | The date that the permission set was created.
permissionSet_createdDate :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.UTCTime)
permissionSet_createdDate :: Lens' PermissionSet (Maybe UTCTime)
permissionSet_createdDate = 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) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The description of the PermissionSet.
permissionSet_description :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_description :: Lens' PermissionSet (Maybe Text)
permissionSet_description = 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)

-- | The name of the permission set.
permissionSet_name :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_name :: Lens' PermissionSet (Maybe Text)
permissionSet_name = 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 ARN of the permission set. For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and AWS Service Namespaces>
-- in the /AWS General Reference/.
permissionSet_permissionSetArn :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_permissionSetArn :: Lens' PermissionSet (Maybe Text)
permissionSet_permissionSetArn = 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)

-- | Used to redirect users within the application during the federation
-- authentication process.
permissionSet_relayState :: Lens.Lens' PermissionSet (Prelude.Maybe Prelude.Text)
permissionSet_relayState :: Lens' PermissionSet (Maybe Text)
permissionSet_relayState = 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 :: Lens' PermissionSet (Maybe Text)
permissionSet_sessionDuration = 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)

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

instance Prelude.Hashable PermissionSet where
  hashWithSalt :: Int -> PermissionSet -> Int
hashWithSalt Int
_salt PermissionSet' {Maybe Text
Maybe POSIX
sessionDuration :: Maybe Text
relayState :: Maybe Text
permissionSetArn :: Maybe Text
name :: Maybe Text
description :: Maybe Text
createdDate :: Maybe POSIX
$sel:sessionDuration:PermissionSet' :: PermissionSet -> Maybe Text
$sel:relayState:PermissionSet' :: PermissionSet -> Maybe Text
$sel:permissionSetArn:PermissionSet' :: PermissionSet -> Maybe Text
$sel:name:PermissionSet' :: PermissionSet -> Maybe Text
$sel:description:PermissionSet' :: PermissionSet -> Maybe Text
$sel:createdDate:PermissionSet' :: PermissionSet -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
permissionSetArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
relayState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sessionDuration

instance Prelude.NFData PermissionSet where
  rnf :: PermissionSet -> ()
rnf PermissionSet' {Maybe Text
Maybe POSIX
sessionDuration :: Maybe Text
relayState :: Maybe Text
permissionSetArn :: Maybe Text
name :: Maybe Text
description :: Maybe Text
createdDate :: Maybe POSIX
$sel:sessionDuration:PermissionSet' :: PermissionSet -> Maybe Text
$sel:relayState:PermissionSet' :: PermissionSet -> Maybe Text
$sel:permissionSetArn:PermissionSet' :: PermissionSet -> Maybe Text
$sel:name:PermissionSet' :: PermissionSet -> Maybe Text
$sel:description:PermissionSet' :: PermissionSet -> Maybe Text
$sel:createdDate:PermissionSet' :: PermissionSet -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      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 Text
permissionSetArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
relayState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sessionDuration