{-# 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.OpenSearchServerless.Types.AccessPolicySummary
-- 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.OpenSearchServerless.Types.AccessPolicySummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpenSearchServerless.Types.AccessPolicyType
import qualified Amazonka.Prelude as Prelude

-- | A summary of the data access policy.
--
-- /See:/ 'newAccessPolicySummary' smart constructor.
data AccessPolicySummary = AccessPolicySummary'
  { -- | The Epoch time when the access policy was created.
    AccessPolicySummary -> Maybe Integer
createdDate :: Prelude.Maybe Prelude.Integer,
    -- | The description of the access policy.
    AccessPolicySummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The date and time when the collection was last modified.
    AccessPolicySummary -> Maybe Integer
lastModifiedDate :: Prelude.Maybe Prelude.Integer,
    -- | The name of the access policy.
    AccessPolicySummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The version of the policy.
    AccessPolicySummary -> Maybe Text
policyVersion :: Prelude.Maybe Prelude.Text,
    -- | The type of access policy. Currently the only available type is @data@.
    AccessPolicySummary -> Maybe AccessPolicyType
type' :: Prelude.Maybe AccessPolicyType
  }
  deriving (AccessPolicySummary -> AccessPolicySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessPolicySummary -> AccessPolicySummary -> Bool
$c/= :: AccessPolicySummary -> AccessPolicySummary -> Bool
== :: AccessPolicySummary -> AccessPolicySummary -> Bool
$c== :: AccessPolicySummary -> AccessPolicySummary -> Bool
Prelude.Eq, ReadPrec [AccessPolicySummary]
ReadPrec AccessPolicySummary
Int -> ReadS AccessPolicySummary
ReadS [AccessPolicySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessPolicySummary]
$creadListPrec :: ReadPrec [AccessPolicySummary]
readPrec :: ReadPrec AccessPolicySummary
$creadPrec :: ReadPrec AccessPolicySummary
readList :: ReadS [AccessPolicySummary]
$creadList :: ReadS [AccessPolicySummary]
readsPrec :: Int -> ReadS AccessPolicySummary
$creadsPrec :: Int -> ReadS AccessPolicySummary
Prelude.Read, Int -> AccessPolicySummary -> ShowS
[AccessPolicySummary] -> ShowS
AccessPolicySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessPolicySummary] -> ShowS
$cshowList :: [AccessPolicySummary] -> ShowS
show :: AccessPolicySummary -> String
$cshow :: AccessPolicySummary -> String
showsPrec :: Int -> AccessPolicySummary -> ShowS
$cshowsPrec :: Int -> AccessPolicySummary -> ShowS
Prelude.Show, forall x. Rep AccessPolicySummary x -> AccessPolicySummary
forall x. AccessPolicySummary -> Rep AccessPolicySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessPolicySummary x -> AccessPolicySummary
$cfrom :: forall x. AccessPolicySummary -> Rep AccessPolicySummary x
Prelude.Generic)

-- |
-- Create a value of 'AccessPolicySummary' 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', 'accessPolicySummary_createdDate' - The Epoch time when the access policy was created.
--
-- 'description', 'accessPolicySummary_description' - The description of the access policy.
--
-- 'lastModifiedDate', 'accessPolicySummary_lastModifiedDate' - The date and time when the collection was last modified.
--
-- 'name', 'accessPolicySummary_name' - The name of the access policy.
--
-- 'policyVersion', 'accessPolicySummary_policyVersion' - The version of the policy.
--
-- 'type'', 'accessPolicySummary_type' - The type of access policy. Currently the only available type is @data@.
newAccessPolicySummary ::
  AccessPolicySummary
newAccessPolicySummary :: AccessPolicySummary
newAccessPolicySummary =
  AccessPolicySummary'
    { $sel:createdDate:AccessPolicySummary' :: Maybe Integer
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:description:AccessPolicySummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:AccessPolicySummary' :: Maybe Integer
lastModifiedDate = forall a. Maybe a
Prelude.Nothing,
      $sel:name:AccessPolicySummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:policyVersion:AccessPolicySummary' :: Maybe Text
policyVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:type':AccessPolicySummary' :: Maybe AccessPolicyType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The Epoch time when the access policy was created.
accessPolicySummary_createdDate :: Lens.Lens' AccessPolicySummary (Prelude.Maybe Prelude.Integer)
accessPolicySummary_createdDate :: Lens' AccessPolicySummary (Maybe Integer)
accessPolicySummary_createdDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessPolicySummary' {Maybe Integer
createdDate :: Maybe Integer
$sel:createdDate:AccessPolicySummary' :: AccessPolicySummary -> Maybe Integer
createdDate} -> Maybe Integer
createdDate) (\s :: AccessPolicySummary
s@AccessPolicySummary' {} Maybe Integer
a -> AccessPolicySummary
s {$sel:createdDate:AccessPolicySummary' :: Maybe Integer
createdDate = Maybe Integer
a} :: AccessPolicySummary)

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

-- | The date and time when the collection was last modified.
accessPolicySummary_lastModifiedDate :: Lens.Lens' AccessPolicySummary (Prelude.Maybe Prelude.Integer)
accessPolicySummary_lastModifiedDate :: Lens' AccessPolicySummary (Maybe Integer)
accessPolicySummary_lastModifiedDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessPolicySummary' {Maybe Integer
lastModifiedDate :: Maybe Integer
$sel:lastModifiedDate:AccessPolicySummary' :: AccessPolicySummary -> Maybe Integer
lastModifiedDate} -> Maybe Integer
lastModifiedDate) (\s :: AccessPolicySummary
s@AccessPolicySummary' {} Maybe Integer
a -> AccessPolicySummary
s {$sel:lastModifiedDate:AccessPolicySummary' :: Maybe Integer
lastModifiedDate = Maybe Integer
a} :: AccessPolicySummary)

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

-- | The version of the policy.
accessPolicySummary_policyVersion :: Lens.Lens' AccessPolicySummary (Prelude.Maybe Prelude.Text)
accessPolicySummary_policyVersion :: Lens' AccessPolicySummary (Maybe Text)
accessPolicySummary_policyVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessPolicySummary' {Maybe Text
policyVersion :: Maybe Text
$sel:policyVersion:AccessPolicySummary' :: AccessPolicySummary -> Maybe Text
policyVersion} -> Maybe Text
policyVersion) (\s :: AccessPolicySummary
s@AccessPolicySummary' {} Maybe Text
a -> AccessPolicySummary
s {$sel:policyVersion:AccessPolicySummary' :: Maybe Text
policyVersion = Maybe Text
a} :: AccessPolicySummary)

-- | The type of access policy. Currently the only available type is @data@.
accessPolicySummary_type :: Lens.Lens' AccessPolicySummary (Prelude.Maybe AccessPolicyType)
accessPolicySummary_type :: Lens' AccessPolicySummary (Maybe AccessPolicyType)
accessPolicySummary_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessPolicySummary' {Maybe AccessPolicyType
type' :: Maybe AccessPolicyType
$sel:type':AccessPolicySummary' :: AccessPolicySummary -> Maybe AccessPolicyType
type'} -> Maybe AccessPolicyType
type') (\s :: AccessPolicySummary
s@AccessPolicySummary' {} Maybe AccessPolicyType
a -> AccessPolicySummary
s {$sel:type':AccessPolicySummary' :: Maybe AccessPolicyType
type' = Maybe AccessPolicyType
a} :: AccessPolicySummary)

instance Data.FromJSON AccessPolicySummary where
  parseJSON :: Value -> Parser AccessPolicySummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccessPolicySummary"
      ( \Object
x ->
          Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe AccessPolicyType
-> AccessPolicySummary
AccessPolicySummary'
            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
"lastModifiedDate")
            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
"policyVersion")
            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
"type")
      )

instance Prelude.Hashable AccessPolicySummary where
  hashWithSalt :: Int -> AccessPolicySummary -> Int
hashWithSalt Int
_salt AccessPolicySummary' {Maybe Integer
Maybe Text
Maybe AccessPolicyType
type' :: Maybe AccessPolicyType
policyVersion :: Maybe Text
name :: Maybe Text
lastModifiedDate :: Maybe Integer
description :: Maybe Text
createdDate :: Maybe Integer
$sel:type':AccessPolicySummary' :: AccessPolicySummary -> Maybe AccessPolicyType
$sel:policyVersion:AccessPolicySummary' :: AccessPolicySummary -> Maybe Text
$sel:name:AccessPolicySummary' :: AccessPolicySummary -> Maybe Text
$sel:lastModifiedDate:AccessPolicySummary' :: AccessPolicySummary -> Maybe Integer
$sel:description:AccessPolicySummary' :: AccessPolicySummary -> Maybe Text
$sel:createdDate:AccessPolicySummary' :: AccessPolicySummary -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
createdDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
lastModifiedDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
policyVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AccessPolicyType
type'

instance Prelude.NFData AccessPolicySummary where
  rnf :: AccessPolicySummary -> ()
rnf AccessPolicySummary' {Maybe Integer
Maybe Text
Maybe AccessPolicyType
type' :: Maybe AccessPolicyType
policyVersion :: Maybe Text
name :: Maybe Text
lastModifiedDate :: Maybe Integer
description :: Maybe Text
createdDate :: Maybe Integer
$sel:type':AccessPolicySummary' :: AccessPolicySummary -> Maybe AccessPolicyType
$sel:policyVersion:AccessPolicySummary' :: AccessPolicySummary -> Maybe Text
$sel:name:AccessPolicySummary' :: AccessPolicySummary -> Maybe Text
$sel:lastModifiedDate:AccessPolicySummary' :: AccessPolicySummary -> Maybe Integer
$sel:description:AccessPolicySummary' :: AccessPolicySummary -> Maybe Text
$sel:createdDate:AccessPolicySummary' :: AccessPolicySummary -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
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 Integer
lastModifiedDate
      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
policyVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AccessPolicyType
type'