{-# 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.SecurityPolicySummary
-- 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.SecurityPolicySummary 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.SecurityPolicyType
import qualified Amazonka.Prelude as Prelude

-- | A summary of a security policy for OpenSearch Serverless.
--
-- /See:/ 'newSecurityPolicySummary' smart constructor.
data SecurityPolicySummary = SecurityPolicySummary'
  { -- | The date the policy was created.
    SecurityPolicySummary -> Maybe Integer
createdDate :: Prelude.Maybe Prelude.Integer,
    -- | The description of the security policy.
    SecurityPolicySummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The timestamp of when the policy was last modified.
    SecurityPolicySummary -> Maybe Integer
lastModifiedDate :: Prelude.Maybe Prelude.Integer,
    -- | The name of the policy.
    SecurityPolicySummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The version of the policy.
    SecurityPolicySummary -> Maybe Text
policyVersion :: Prelude.Maybe Prelude.Text,
    -- | The type of security policy.
    SecurityPolicySummary -> Maybe SecurityPolicyType
type' :: Prelude.Maybe SecurityPolicyType
  }
  deriving (SecurityPolicySummary -> SecurityPolicySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityPolicySummary -> SecurityPolicySummary -> Bool
$c/= :: SecurityPolicySummary -> SecurityPolicySummary -> Bool
== :: SecurityPolicySummary -> SecurityPolicySummary -> Bool
$c== :: SecurityPolicySummary -> SecurityPolicySummary -> Bool
Prelude.Eq, ReadPrec [SecurityPolicySummary]
ReadPrec SecurityPolicySummary
Int -> ReadS SecurityPolicySummary
ReadS [SecurityPolicySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityPolicySummary]
$creadListPrec :: ReadPrec [SecurityPolicySummary]
readPrec :: ReadPrec SecurityPolicySummary
$creadPrec :: ReadPrec SecurityPolicySummary
readList :: ReadS [SecurityPolicySummary]
$creadList :: ReadS [SecurityPolicySummary]
readsPrec :: Int -> ReadS SecurityPolicySummary
$creadsPrec :: Int -> ReadS SecurityPolicySummary
Prelude.Read, Int -> SecurityPolicySummary -> ShowS
[SecurityPolicySummary] -> ShowS
SecurityPolicySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityPolicySummary] -> ShowS
$cshowList :: [SecurityPolicySummary] -> ShowS
show :: SecurityPolicySummary -> String
$cshow :: SecurityPolicySummary -> String
showsPrec :: Int -> SecurityPolicySummary -> ShowS
$cshowsPrec :: Int -> SecurityPolicySummary -> ShowS
Prelude.Show, forall x. Rep SecurityPolicySummary x -> SecurityPolicySummary
forall x. SecurityPolicySummary -> Rep SecurityPolicySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SecurityPolicySummary x -> SecurityPolicySummary
$cfrom :: forall x. SecurityPolicySummary -> Rep SecurityPolicySummary x
Prelude.Generic)

-- |
-- Create a value of 'SecurityPolicySummary' 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', 'securityPolicySummary_createdDate' - The date the policy was created.
--
-- 'description', 'securityPolicySummary_description' - The description of the security policy.
--
-- 'lastModifiedDate', 'securityPolicySummary_lastModifiedDate' - The timestamp of when the policy was last modified.
--
-- 'name', 'securityPolicySummary_name' - The name of the policy.
--
-- 'policyVersion', 'securityPolicySummary_policyVersion' - The version of the policy.
--
-- 'type'', 'securityPolicySummary_type' - The type of security policy.
newSecurityPolicySummary ::
  SecurityPolicySummary
newSecurityPolicySummary :: SecurityPolicySummary
newSecurityPolicySummary =
  SecurityPolicySummary'
    { $sel:createdDate:SecurityPolicySummary' :: Maybe Integer
createdDate =
        forall a. Maybe a
Prelude.Nothing,
      $sel:description:SecurityPolicySummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:lastModifiedDate:SecurityPolicySummary' :: Maybe Integer
lastModifiedDate = forall a. Maybe a
Prelude.Nothing,
      $sel:name:SecurityPolicySummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:policyVersion:SecurityPolicySummary' :: Maybe Text
policyVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:type':SecurityPolicySummary' :: Maybe SecurityPolicyType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The date the policy was created.
securityPolicySummary_createdDate :: Lens.Lens' SecurityPolicySummary (Prelude.Maybe Prelude.Integer)
securityPolicySummary_createdDate :: Lens' SecurityPolicySummary (Maybe Integer)
securityPolicySummary_createdDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityPolicySummary' {Maybe Integer
createdDate :: Maybe Integer
$sel:createdDate:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Integer
createdDate} -> Maybe Integer
createdDate) (\s :: SecurityPolicySummary
s@SecurityPolicySummary' {} Maybe Integer
a -> SecurityPolicySummary
s {$sel:createdDate:SecurityPolicySummary' :: Maybe Integer
createdDate = Maybe Integer
a} :: SecurityPolicySummary)

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

-- | The timestamp of when the policy was last modified.
securityPolicySummary_lastModifiedDate :: Lens.Lens' SecurityPolicySummary (Prelude.Maybe Prelude.Integer)
securityPolicySummary_lastModifiedDate :: Lens' SecurityPolicySummary (Maybe Integer)
securityPolicySummary_lastModifiedDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityPolicySummary' {Maybe Integer
lastModifiedDate :: Maybe Integer
$sel:lastModifiedDate:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Integer
lastModifiedDate} -> Maybe Integer
lastModifiedDate) (\s :: SecurityPolicySummary
s@SecurityPolicySummary' {} Maybe Integer
a -> SecurityPolicySummary
s {$sel:lastModifiedDate:SecurityPolicySummary' :: Maybe Integer
lastModifiedDate = Maybe Integer
a} :: SecurityPolicySummary)

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

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

-- | The type of security policy.
securityPolicySummary_type :: Lens.Lens' SecurityPolicySummary (Prelude.Maybe SecurityPolicyType)
securityPolicySummary_type :: Lens' SecurityPolicySummary (Maybe SecurityPolicyType)
securityPolicySummary_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityPolicySummary' {Maybe SecurityPolicyType
type' :: Maybe SecurityPolicyType
$sel:type':SecurityPolicySummary' :: SecurityPolicySummary -> Maybe SecurityPolicyType
type'} -> Maybe SecurityPolicyType
type') (\s :: SecurityPolicySummary
s@SecurityPolicySummary' {} Maybe SecurityPolicyType
a -> SecurityPolicySummary
s {$sel:type':SecurityPolicySummary' :: Maybe SecurityPolicyType
type' = Maybe SecurityPolicyType
a} :: SecurityPolicySummary)

instance Data.FromJSON SecurityPolicySummary where
  parseJSON :: Value -> Parser SecurityPolicySummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"SecurityPolicySummary"
      ( \Object
x ->
          Maybe Integer
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe SecurityPolicyType
-> SecurityPolicySummary
SecurityPolicySummary'
            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 SecurityPolicySummary where
  hashWithSalt :: Int -> SecurityPolicySummary -> Int
hashWithSalt Int
_salt SecurityPolicySummary' {Maybe Integer
Maybe Text
Maybe SecurityPolicyType
type' :: Maybe SecurityPolicyType
policyVersion :: Maybe Text
name :: Maybe Text
lastModifiedDate :: Maybe Integer
description :: Maybe Text
createdDate :: Maybe Integer
$sel:type':SecurityPolicySummary' :: SecurityPolicySummary -> Maybe SecurityPolicyType
$sel:policyVersion:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Text
$sel:name:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Text
$sel:lastModifiedDate:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Integer
$sel:description:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Text
$sel:createdDate:SecurityPolicySummary' :: SecurityPolicySummary -> 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 SecurityPolicyType
type'

instance Prelude.NFData SecurityPolicySummary where
  rnf :: SecurityPolicySummary -> ()
rnf SecurityPolicySummary' {Maybe Integer
Maybe Text
Maybe SecurityPolicyType
type' :: Maybe SecurityPolicyType
policyVersion :: Maybe Text
name :: Maybe Text
lastModifiedDate :: Maybe Integer
description :: Maybe Text
createdDate :: Maybe Integer
$sel:type':SecurityPolicySummary' :: SecurityPolicySummary -> Maybe SecurityPolicyType
$sel:policyVersion:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Text
$sel:name:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Text
$sel:lastModifiedDate:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Integer
$sel:description:SecurityPolicySummary' :: SecurityPolicySummary -> Maybe Text
$sel:createdDate:SecurityPolicySummary' :: SecurityPolicySummary -> 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 SecurityPolicyType
type'