{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Organizations.Types.PolicySummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 /AWS Service Authorization Reference/.
    PolicySummary -> Maybe Text
arn :: 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 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,
    -- | A boolean value that indicates whether the specified policy is an AWS
    -- 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 type of policy.
    PolicySummary -> Maybe PolicyType
type' :: Prelude.Maybe PolicyType,
    -- | The description of the policy.
    PolicySummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (PolicySummary -> PolicySummary -> Bool
(PolicySummary -> PolicySummary -> Bool)
-> (PolicySummary -> PolicySummary -> Bool) -> Eq PolicySummary
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]
(Int -> ReadS PolicySummary)
-> ReadS [PolicySummary]
-> ReadPrec PolicySummary
-> ReadPrec [PolicySummary]
-> Read 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
(Int -> PolicySummary -> ShowS)
-> (PolicySummary -> String)
-> ([PolicySummary] -> ShowS)
-> Show PolicySummary
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. PolicySummary -> Rep PolicySummary x)
-> (forall x. Rep PolicySummary x -> PolicySummary)
-> Generic PolicySummary
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 /AWS Service Authorization Reference/.
--
-- '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.
--
-- '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 (_).
--
-- 'awsManaged', 'policySummary_awsManaged' - A boolean value that indicates whether the specified policy is an AWS
-- managed policy. If true, then you can attach the policy to roots, OUs,
-- or accounts, but you cannot edit it.
--
-- 'type'', 'policySummary_type' - The type of policy.
--
-- 'description', 'policySummary_description' - The description of the policy.
newPolicySummary ::
  PolicySummary
newPolicySummary :: PolicySummary
newPolicySummary =
  PolicySummary' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe PolicyType
-> Maybe Text
-> PolicySummary
PolicySummary'
    { $sel:arn:PolicySummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:PolicySummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:PolicySummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:awsManaged:PolicySummary' :: Maybe Bool
awsManaged = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:type':PolicySummary' :: Maybe PolicyType
type' = Maybe PolicyType
forall a. Maybe a
Prelude.Nothing,
      $sel:description:PolicySummary' :: Maybe Text
description = Maybe Text
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 /AWS Service Authorization Reference/.
policySummary_arn :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_arn :: (Maybe Text -> f (Maybe Text)) -> PolicySummary -> f PolicySummary
policySummary_arn = (PolicySummary -> Maybe Text)
-> (PolicySummary -> Maybe Text -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> PolicySummary -> f PolicySummary
policySummary_name = (PolicySummary -> Maybe Text)
-> (PolicySummary -> Maybe Text -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Text) (Maybe Text)
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 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 :: (Maybe Text -> f (Maybe Text)) -> PolicySummary -> f PolicySummary
policySummary_id = (PolicySummary -> Maybe Text)
-> (PolicySummary -> Maybe Text -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Text) (Maybe Text)
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)

-- | A boolean value that indicates whether the specified policy is an AWS
-- 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 :: (Maybe Bool -> f (Maybe Bool)) -> PolicySummary -> f PolicySummary
policySummary_awsManaged = (PolicySummary -> Maybe Bool)
-> (PolicySummary -> Maybe Bool -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Bool) (Maybe Bool)
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 type of policy.
policySummary_type :: Lens.Lens' PolicySummary (Prelude.Maybe PolicyType)
policySummary_type :: (Maybe PolicyType -> f (Maybe PolicyType))
-> PolicySummary -> f PolicySummary
policySummary_type = (PolicySummary -> Maybe PolicyType)
-> (PolicySummary -> Maybe PolicyType -> PolicySummary)
-> Lens
     PolicySummary PolicySummary (Maybe PolicyType) (Maybe PolicyType)
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)

-- | The description of the policy.
policySummary_description :: Lens.Lens' PolicySummary (Prelude.Maybe Prelude.Text)
policySummary_description :: (Maybe Text -> f (Maybe Text)) -> PolicySummary -> f PolicySummary
policySummary_description = (PolicySummary -> Maybe Text)
-> (PolicySummary -> Maybe Text -> PolicySummary)
-> Lens PolicySummary PolicySummary (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON PolicySummary where
  parseJSON :: Value -> Parser PolicySummary
parseJSON =
    String
-> (Object -> Parser PolicySummary)
-> Value
-> Parser PolicySummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PolicySummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Bool
-> Maybe PolicyType
-> Maybe Text
-> PolicySummary
PolicySummary'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Bool
 -> Maybe PolicyType
 -> Maybe Text
 -> PolicySummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Bool
      -> Maybe PolicyType
      -> Maybe Text
      -> PolicySummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Arn")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Bool
   -> Maybe PolicyType
   -> Maybe Text
   -> PolicySummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Bool -> Maybe PolicyType -> Maybe Text -> PolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
            Parser
  (Maybe Text
   -> Maybe Bool -> Maybe PolicyType -> Maybe Text -> PolicySummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe PolicyType -> Maybe Text -> PolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
            Parser
  (Maybe Bool -> Maybe PolicyType -> Maybe Text -> PolicySummary)
-> Parser (Maybe Bool)
-> Parser (Maybe PolicyType -> Maybe Text -> PolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AwsManaged")
            Parser (Maybe PolicyType -> Maybe Text -> PolicySummary)
-> Parser (Maybe PolicyType)
-> Parser (Maybe Text -> PolicySummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe PolicyType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
            Parser (Maybe Text -> PolicySummary)
-> Parser (Maybe Text) -> Parser PolicySummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
      )

instance Prelude.Hashable PolicySummary

instance Prelude.NFData PolicySummary