{-# 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.Rekognition.Types.ProjectPolicy
-- 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.Rekognition.Types.ProjectPolicy 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

-- | Describes a project policy in the response from ListProjectPolicies.
--
-- /See:/ 'newProjectPolicy' smart constructor.
data ProjectPolicy = ProjectPolicy'
  { -- | The Unix datetime for the creation of the project policy.
    ProjectPolicy -> Maybe POSIX
creationTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The Unix datetime for when the project policy was last updated.
    ProjectPolicy -> Maybe POSIX
lastUpdatedTimestamp :: Prelude.Maybe Data.POSIX,
    -- | The JSON document for the project policy.
    ProjectPolicy -> Maybe Text
policyDocument :: Prelude.Maybe Prelude.Text,
    -- | The name of the project policy.
    ProjectPolicy -> Maybe Text
policyName :: Prelude.Maybe Prelude.Text,
    -- | The revision ID of the project policy.
    ProjectPolicy -> Maybe Text
policyRevisionId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the project to which the project
    -- policy is attached.
    ProjectPolicy -> Maybe Text
projectArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ProjectPolicy -> ProjectPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectPolicy -> ProjectPolicy -> Bool
$c/= :: ProjectPolicy -> ProjectPolicy -> Bool
== :: ProjectPolicy -> ProjectPolicy -> Bool
$c== :: ProjectPolicy -> ProjectPolicy -> Bool
Prelude.Eq, ReadPrec [ProjectPolicy]
ReadPrec ProjectPolicy
Int -> ReadS ProjectPolicy
ReadS [ProjectPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectPolicy]
$creadListPrec :: ReadPrec [ProjectPolicy]
readPrec :: ReadPrec ProjectPolicy
$creadPrec :: ReadPrec ProjectPolicy
readList :: ReadS [ProjectPolicy]
$creadList :: ReadS [ProjectPolicy]
readsPrec :: Int -> ReadS ProjectPolicy
$creadsPrec :: Int -> ReadS ProjectPolicy
Prelude.Read, Int -> ProjectPolicy -> ShowS
[ProjectPolicy] -> ShowS
ProjectPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectPolicy] -> ShowS
$cshowList :: [ProjectPolicy] -> ShowS
show :: ProjectPolicy -> String
$cshow :: ProjectPolicy -> String
showsPrec :: Int -> ProjectPolicy -> ShowS
$cshowsPrec :: Int -> ProjectPolicy -> ShowS
Prelude.Show, forall x. Rep ProjectPolicy x -> ProjectPolicy
forall x. ProjectPolicy -> Rep ProjectPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectPolicy x -> ProjectPolicy
$cfrom :: forall x. ProjectPolicy -> Rep ProjectPolicy x
Prelude.Generic)

-- |
-- Create a value of 'ProjectPolicy' 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:
--
-- 'creationTimestamp', 'projectPolicy_creationTimestamp' - The Unix datetime for the creation of the project policy.
--
-- 'lastUpdatedTimestamp', 'projectPolicy_lastUpdatedTimestamp' - The Unix datetime for when the project policy was last updated.
--
-- 'policyDocument', 'projectPolicy_policyDocument' - The JSON document for the project policy.
--
-- 'policyName', 'projectPolicy_policyName' - The name of the project policy.
--
-- 'policyRevisionId', 'projectPolicy_policyRevisionId' - The revision ID of the project policy.
--
-- 'projectArn', 'projectPolicy_projectArn' - The Amazon Resource Name (ARN) of the project to which the project
-- policy is attached.
newProjectPolicy ::
  ProjectPolicy
newProjectPolicy :: ProjectPolicy
newProjectPolicy =
  ProjectPolicy'
    { $sel:creationTimestamp:ProjectPolicy' :: Maybe POSIX
creationTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:ProjectPolicy' :: Maybe POSIX
lastUpdatedTimestamp = forall a. Maybe a
Prelude.Nothing,
      $sel:policyDocument:ProjectPolicy' :: Maybe Text
policyDocument = forall a. Maybe a
Prelude.Nothing,
      $sel:policyName:ProjectPolicy' :: Maybe Text
policyName = forall a. Maybe a
Prelude.Nothing,
      $sel:policyRevisionId:ProjectPolicy' :: Maybe Text
policyRevisionId = forall a. Maybe a
Prelude.Nothing,
      $sel:projectArn:ProjectPolicy' :: Maybe Text
projectArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The Unix datetime for the creation of the project policy.
projectPolicy_creationTimestamp :: Lens.Lens' ProjectPolicy (Prelude.Maybe Prelude.UTCTime)
projectPolicy_creationTimestamp :: Lens' ProjectPolicy (Maybe UTCTime)
projectPolicy_creationTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectPolicy' {Maybe POSIX
creationTimestamp :: Maybe POSIX
$sel:creationTimestamp:ProjectPolicy' :: ProjectPolicy -> Maybe POSIX
creationTimestamp} -> Maybe POSIX
creationTimestamp) (\s :: ProjectPolicy
s@ProjectPolicy' {} Maybe POSIX
a -> ProjectPolicy
s {$sel:creationTimestamp:ProjectPolicy' :: Maybe POSIX
creationTimestamp = Maybe POSIX
a} :: ProjectPolicy) 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 Unix datetime for when the project policy was last updated.
projectPolicy_lastUpdatedTimestamp :: Lens.Lens' ProjectPolicy (Prelude.Maybe Prelude.UTCTime)
projectPolicy_lastUpdatedTimestamp :: Lens' ProjectPolicy (Maybe UTCTime)
projectPolicy_lastUpdatedTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectPolicy' {Maybe POSIX
lastUpdatedTimestamp :: Maybe POSIX
$sel:lastUpdatedTimestamp:ProjectPolicy' :: ProjectPolicy -> Maybe POSIX
lastUpdatedTimestamp} -> Maybe POSIX
lastUpdatedTimestamp) (\s :: ProjectPolicy
s@ProjectPolicy' {} Maybe POSIX
a -> ProjectPolicy
s {$sel:lastUpdatedTimestamp:ProjectPolicy' :: Maybe POSIX
lastUpdatedTimestamp = Maybe POSIX
a} :: ProjectPolicy) 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 JSON document for the project policy.
projectPolicy_policyDocument :: Lens.Lens' ProjectPolicy (Prelude.Maybe Prelude.Text)
projectPolicy_policyDocument :: Lens' ProjectPolicy (Maybe Text)
projectPolicy_policyDocument = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectPolicy' {Maybe Text
policyDocument :: Maybe Text
$sel:policyDocument:ProjectPolicy' :: ProjectPolicy -> Maybe Text
policyDocument} -> Maybe Text
policyDocument) (\s :: ProjectPolicy
s@ProjectPolicy' {} Maybe Text
a -> ProjectPolicy
s {$sel:policyDocument:ProjectPolicy' :: Maybe Text
policyDocument = Maybe Text
a} :: ProjectPolicy)

-- | The name of the project policy.
projectPolicy_policyName :: Lens.Lens' ProjectPolicy (Prelude.Maybe Prelude.Text)
projectPolicy_policyName :: Lens' ProjectPolicy (Maybe Text)
projectPolicy_policyName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectPolicy' {Maybe Text
policyName :: Maybe Text
$sel:policyName:ProjectPolicy' :: ProjectPolicy -> Maybe Text
policyName} -> Maybe Text
policyName) (\s :: ProjectPolicy
s@ProjectPolicy' {} Maybe Text
a -> ProjectPolicy
s {$sel:policyName:ProjectPolicy' :: Maybe Text
policyName = Maybe Text
a} :: ProjectPolicy)

-- | The revision ID of the project policy.
projectPolicy_policyRevisionId :: Lens.Lens' ProjectPolicy (Prelude.Maybe Prelude.Text)
projectPolicy_policyRevisionId :: Lens' ProjectPolicy (Maybe Text)
projectPolicy_policyRevisionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectPolicy' {Maybe Text
policyRevisionId :: Maybe Text
$sel:policyRevisionId:ProjectPolicy' :: ProjectPolicy -> Maybe Text
policyRevisionId} -> Maybe Text
policyRevisionId) (\s :: ProjectPolicy
s@ProjectPolicy' {} Maybe Text
a -> ProjectPolicy
s {$sel:policyRevisionId:ProjectPolicy' :: Maybe Text
policyRevisionId = Maybe Text
a} :: ProjectPolicy)

-- | The Amazon Resource Name (ARN) of the project to which the project
-- policy is attached.
projectPolicy_projectArn :: Lens.Lens' ProjectPolicy (Prelude.Maybe Prelude.Text)
projectPolicy_projectArn :: Lens' ProjectPolicy (Maybe Text)
projectPolicy_projectArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectPolicy' {Maybe Text
projectArn :: Maybe Text
$sel:projectArn:ProjectPolicy' :: ProjectPolicy -> Maybe Text
projectArn} -> Maybe Text
projectArn) (\s :: ProjectPolicy
s@ProjectPolicy' {} Maybe Text
a -> ProjectPolicy
s {$sel:projectArn:ProjectPolicy' :: Maybe Text
projectArn = Maybe Text
a} :: ProjectPolicy)

instance Data.FromJSON ProjectPolicy where
  parseJSON :: Value -> Parser ProjectPolicy
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ProjectPolicy"
      ( \Object
x ->
          Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ProjectPolicy
ProjectPolicy'
            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
"CreationTimestamp")
            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
"LastUpdatedTimestamp")
            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
"PolicyDocument")
            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
"PolicyName")
            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
"PolicyRevisionId")
            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
"ProjectArn")
      )

instance Prelude.Hashable ProjectPolicy where
  hashWithSalt :: Int -> ProjectPolicy -> Int
hashWithSalt Int
_salt ProjectPolicy' {Maybe Text
Maybe POSIX
projectArn :: Maybe Text
policyRevisionId :: Maybe Text
policyName :: Maybe Text
policyDocument :: Maybe Text
lastUpdatedTimestamp :: Maybe POSIX
creationTimestamp :: Maybe POSIX
$sel:projectArn:ProjectPolicy' :: ProjectPolicy -> Maybe Text
$sel:policyRevisionId:ProjectPolicy' :: ProjectPolicy -> Maybe Text
$sel:policyName:ProjectPolicy' :: ProjectPolicy -> Maybe Text
$sel:policyDocument:ProjectPolicy' :: ProjectPolicy -> Maybe Text
$sel:lastUpdatedTimestamp:ProjectPolicy' :: ProjectPolicy -> Maybe POSIX
$sel:creationTimestamp:ProjectPolicy' :: ProjectPolicy -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
policyDocument
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
policyName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
policyRevisionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
projectArn

instance Prelude.NFData ProjectPolicy where
  rnf :: ProjectPolicy -> ()
rnf ProjectPolicy' {Maybe Text
Maybe POSIX
projectArn :: Maybe Text
policyRevisionId :: Maybe Text
policyName :: Maybe Text
policyDocument :: Maybe Text
lastUpdatedTimestamp :: Maybe POSIX
creationTimestamp :: Maybe POSIX
$sel:projectArn:ProjectPolicy' :: ProjectPolicy -> Maybe Text
$sel:policyRevisionId:ProjectPolicy' :: ProjectPolicy -> Maybe Text
$sel:policyName:ProjectPolicy' :: ProjectPolicy -> Maybe Text
$sel:policyDocument:ProjectPolicy' :: ProjectPolicy -> Maybe Text
$sel:lastUpdatedTimestamp:ProjectPolicy' :: ProjectPolicy -> Maybe POSIX
$sel:creationTimestamp:ProjectPolicy' :: ProjectPolicy -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
policyDocument
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
policyName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
policyRevisionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
projectArn