{-# 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.Organizations.Types.PolicySummary
-- 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.Organizations.Types.PolicySummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Organizations.Types.PolicyType
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a policy, but does not include the content.
-- To see the content of a policy, see DescribePolicy.
--
-- /See:/ 'newPolicySummary' smart constructor.
data PolicySummary = PolicySummary'
  { -- | The Amazon Resource Name (ARN) of the policy.
    --
    -- For more information about ARNs in Organizations, see
    -- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsorganizations.html#awsorganizations-resources-for-iam-policies ARN Formats Supported by Organizations>
    -- in the /Amazon Web Services Service Authorization Reference/.
    PolicySummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | A boolean value that indicates whether the specified policy is an Amazon
    -- Web Services managed policy. If true, then you can attach the policy to
    -- roots, OUs, or accounts, but you cannot edit it.
    PolicySummary -> Maybe Bool
awsManaged :: Prelude.Maybe Prelude.Bool,
    -- | The description of the policy.
    PolicySummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier (ID) of the policy.
    --
    -- The <http://wikipedia.org/wiki/regex regex pattern> for a policy ID
    -- string requires \"p-\" followed by from 8 to 128 lowercase or uppercase
    -- letters, digits, or the underscore character (_).
    PolicySummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The friendly name of the policy.
    --
    -- The <http://wikipedia.org/wiki/regex regex pattern> that is used to
    -- validate this parameter is a string of any of the characters in the
    -- ASCII character range.
    PolicySummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The type of policy.
    PolicySummary -> Maybe PolicyType
type' :: Prelude.Maybe PolicyType
  }
  deriving (PolicySummary -> PolicySummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicySummary -> PolicySummary -> Bool
$c/= :: PolicySummary -> PolicySummary -> Bool
== :: PolicySummary -> PolicySummary -> Bool
$c== :: PolicySummary -> PolicySummary -> Bool
Prelude.Eq, ReadPrec [PolicySummary]
ReadPrec PolicySummary
Int -> ReadS PolicySummary
ReadS [PolicySummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicySummary]
$creadListPrec :: ReadPrec [PolicySummary]
readPrec :: ReadPrec PolicySummary
$creadPrec :: ReadPrec PolicySummary
readList :: ReadS [PolicySummary]
$creadList :: ReadS [PolicySummary]
readsPrec :: Int -> ReadS PolicySummary
$creadsPrec :: Int -> ReadS PolicySummary
Prelude.Read, Int -> PolicySummary -> ShowS
[PolicySummary] -> ShowS
PolicySummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicySummary] -> ShowS
$cshowList :: [PolicySummary] -> ShowS
show :: PolicySummary -> String
$cshow :: PolicySummary -> String
showsPrec :: Int -> PolicySummary -> ShowS
$cshowsPrec :: Int -> PolicySummary -> ShowS
Prelude.Show, forall x. Rep PolicySummary x -> PolicySummary
forall x. PolicySummary -> Rep PolicySummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicySummary x -> PolicySummary
$cfrom :: forall x. PolicySummary -> Rep PolicySummary x
Prelude.Generic)

-- |
-- Create a value of 'PolicySummary' 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:
--
-- 'arn', 'policySummary_arn' - The Amazon Resource Name (ARN) of the policy.
--
-- For more information about ARNs in Organizations, see
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsorganizations.html#awsorganizations-resources-for-iam-policies ARN Formats Supported by Organizations>
-- in the /Amazon Web Services Service Authorization Reference/.
--
-- 'awsManaged', 'policySummary_awsManaged' - A boolean value that indicates whether the specified policy is an Amazon
-- Web Services managed policy. If true, then you can attach the policy to
-- roots, OUs, or accounts, but you cannot edit it.
--
-- 'description', 'policySummary_description' - The description of the policy.
--
-- 'id', 'policySummary_id' - The unique identifier (ID) of the policy.
--
-- The <http://wikipedia.org/wiki/regex regex pattern> for a policy ID
-- string requires \"p-\" followed by from 8 to 128 lowercase or uppercase
-- letters, digits, or the underscore character (_).
--
-- 'name', 'policySummary_name' - The friendly name of the policy.
--
-- The <http://wikipedia.org/wiki/regex regex pattern> that is used to
-- validate this parameter is a string of any of the characters in the
-- ASCII character range.
--
-- 'type'', 'policySummary_type' - The type of policy.
newPolicySummary ::
  PolicySummary
newPolicySummary :: PolicySummary
newPolicySummary =
  PolicySummary'
    { $sel:arn:PolicySummary' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:awsManaged:PolicySummary' :: Maybe Bool
awsManaged = forall a. Maybe a
Prelude.Nothing,
      $sel:description:PolicySummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:PolicySummary' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:PolicySummary' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:type':PolicySummary' :: Maybe PolicyType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the policy.
--
-- For more information about ARNs in Organizations, see
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsorganizations.html#awsorganizations-resources-for-iam-policies ARN Formats Supported by Organizations>
-- in the /Amazon Web Services Service Authorization Reference/.
policySummary_arn :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_arn :: Lens' PolicySummary (Maybe Text)
policySummary_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Text
arn :: Maybe Text
$sel:arn:PolicySummary' :: PolicySummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: PolicySummary
s@PolicySummary' {} Maybe Text
a -> PolicySummary
s {$sel:arn:PolicySummary' :: Maybe Text
arn = Maybe Text
a} :: PolicySummary)

-- | A boolean value that indicates whether the specified policy is an Amazon
-- Web Services managed policy. If true, then you can attach the policy to
-- roots, OUs, or accounts, but you cannot edit it.
policySummary_awsManaged :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Bool)
policySummary_awsManaged :: Lens' PolicySummary (Maybe Bool)
policySummary_awsManaged = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Bool
awsManaged :: Maybe Bool
$sel:awsManaged:PolicySummary' :: PolicySummary -> Maybe Bool
awsManaged} -> Maybe Bool
awsManaged) (\s :: PolicySummary
s@PolicySummary' {} Maybe Bool
a -> PolicySummary
s {$sel:awsManaged:PolicySummary' :: Maybe Bool
awsManaged = Maybe Bool
a} :: PolicySummary)

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

-- | The unique identifier (ID) of the policy.
--
-- The <http://wikipedia.org/wiki/regex regex pattern> for a policy ID
-- string requires \"p-\" followed by from 8 to 128 lowercase or uppercase
-- letters, digits, or the underscore character (_).
policySummary_id :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_id :: Lens' PolicySummary (Maybe Text)
policySummary_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Text
id :: Maybe Text
$sel:id:PolicySummary' :: PolicySummary -> Maybe Text
id} -> Maybe Text
id) (\s :: PolicySummary
s@PolicySummary' {} Maybe Text
a -> PolicySummary
s {$sel:id:PolicySummary' :: Maybe Text
id = Maybe Text
a} :: PolicySummary)

-- | The friendly name of the policy.
--
-- The <http://wikipedia.org/wiki/regex regex pattern> that is used to
-- validate this parameter is a string of any of the characters in the
-- ASCII character range.
policySummary_name :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_name :: Lens' PolicySummary (Maybe Text)
policySummary_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicySummary' {Maybe Text
name :: Maybe Text
$sel:name:PolicySummary' :: PolicySummary -> Maybe Text
name} -> Maybe Text
name) (\s :: PolicySummary
s@PolicySummary' {} Maybe Text
a -> PolicySummary
s {$sel:name:PolicySummary' :: Maybe Text
name = Maybe Text
a} :: PolicySummary)

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

instance Data.FromJSON PolicySummary where
  parseJSON :: Value -> Parser PolicySummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PolicySummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe PolicyType
-> PolicySummary
PolicySummary'
            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
"Arn")
            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
"AwsManaged")
            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
"Id")
            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
"Type")
      )

instance Prelude.Hashable PolicySummary where
  hashWithSalt :: Int -> PolicySummary -> Int
hashWithSalt Int
_salt PolicySummary' {Maybe Bool
Maybe Text
Maybe PolicyType
type' :: Maybe PolicyType
name :: Maybe Text
id :: Maybe Text
description :: Maybe Text
awsManaged :: Maybe Bool
arn :: Maybe Text
$sel:type':PolicySummary' :: PolicySummary -> Maybe PolicyType
$sel:name:PolicySummary' :: PolicySummary -> Maybe Text
$sel:id:PolicySummary' :: PolicySummary -> Maybe Text
$sel:description:PolicySummary' :: PolicySummary -> Maybe Text
$sel:awsManaged:PolicySummary' :: PolicySummary -> Maybe Bool
$sel:arn:PolicySummary' :: PolicySummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
awsManaged
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PolicyType
type'

instance Prelude.NFData PolicySummary where
  rnf :: PolicySummary -> ()
rnf PolicySummary' {Maybe Bool
Maybe Text
Maybe PolicyType
type' :: Maybe PolicyType
name :: Maybe Text
id :: Maybe Text
description :: Maybe Text
awsManaged :: Maybe Bool
arn :: Maybe Text
$sel:type':PolicySummary' :: PolicySummary -> Maybe PolicyType
$sel:name:PolicySummary' :: PolicySummary -> Maybe Text
$sel:id:PolicySummary' :: PolicySummary -> Maybe Text
$sel:description:PolicySummary' :: PolicySummary -> Maybe Text
$sel:awsManaged:PolicySummary' :: PolicySummary -> Maybe Bool
$sel:arn:PolicySummary' :: PolicySummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
awsManaged
      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
id
      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 PolicyType
type'