{-# 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.SecurityHub.Types.AwsIamPolicyDetails
-- 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.SecurityHub.Types.AwsIamPolicyDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsIamPolicyVersion

-- | Represents an IAM permissions policy.
--
-- /See:/ 'newAwsIamPolicyDetails' smart constructor.
data AwsIamPolicyDetails = AwsIamPolicyDetails'
  { -- | The name of the policy.
    AwsIamPolicyDetails -> Maybe Text
policyName :: Prelude.Maybe Prelude.Text,
    -- | When the policy was most recently updated.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsIamPolicyDetails -> Maybe Text
updateDate :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier of the policy.
    AwsIamPolicyDetails -> Maybe Text
policyId :: Prelude.Maybe Prelude.Text,
    -- | The path to the policy.
    AwsIamPolicyDetails -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | List of versions of the policy.
    AwsIamPolicyDetails -> Maybe [AwsIamPolicyVersion]
policyVersionList :: Prelude.Maybe [AwsIamPolicyVersion],
    -- | When the policy was created.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsIamPolicyDetails -> Maybe Text
createDate :: Prelude.Maybe Prelude.Text,
    -- | Whether the policy can be attached to a user, group, or role.
    AwsIamPolicyDetails -> Maybe Bool
isAttachable :: Prelude.Maybe Prelude.Bool,
    -- | The number of users and roles that use the policy to set the permissions
    -- boundary.
    AwsIamPolicyDetails -> Maybe Int
permissionsBoundaryUsageCount :: Prelude.Maybe Prelude.Int,
    -- | The identifier of the default version of the policy.
    AwsIamPolicyDetails -> Maybe Text
defaultVersionId :: Prelude.Maybe Prelude.Text,
    -- | The number of users, groups, and roles that the policy is attached to.
    AwsIamPolicyDetails -> Maybe Int
attachmentCount :: Prelude.Maybe Prelude.Int,
    -- | A description of the policy.
    AwsIamPolicyDetails -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsIamPolicyDetails -> AwsIamPolicyDetails -> Bool
(AwsIamPolicyDetails -> AwsIamPolicyDetails -> Bool)
-> (AwsIamPolicyDetails -> AwsIamPolicyDetails -> Bool)
-> Eq AwsIamPolicyDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsIamPolicyDetails -> AwsIamPolicyDetails -> Bool
$c/= :: AwsIamPolicyDetails -> AwsIamPolicyDetails -> Bool
== :: AwsIamPolicyDetails -> AwsIamPolicyDetails -> Bool
$c== :: AwsIamPolicyDetails -> AwsIamPolicyDetails -> Bool
Prelude.Eq, ReadPrec [AwsIamPolicyDetails]
ReadPrec AwsIamPolicyDetails
Int -> ReadS AwsIamPolicyDetails
ReadS [AwsIamPolicyDetails]
(Int -> ReadS AwsIamPolicyDetails)
-> ReadS [AwsIamPolicyDetails]
-> ReadPrec AwsIamPolicyDetails
-> ReadPrec [AwsIamPolicyDetails]
-> Read AwsIamPolicyDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsIamPolicyDetails]
$creadListPrec :: ReadPrec [AwsIamPolicyDetails]
readPrec :: ReadPrec AwsIamPolicyDetails
$creadPrec :: ReadPrec AwsIamPolicyDetails
readList :: ReadS [AwsIamPolicyDetails]
$creadList :: ReadS [AwsIamPolicyDetails]
readsPrec :: Int -> ReadS AwsIamPolicyDetails
$creadsPrec :: Int -> ReadS AwsIamPolicyDetails
Prelude.Read, Int -> AwsIamPolicyDetails -> ShowS
[AwsIamPolicyDetails] -> ShowS
AwsIamPolicyDetails -> String
(Int -> AwsIamPolicyDetails -> ShowS)
-> (AwsIamPolicyDetails -> String)
-> ([AwsIamPolicyDetails] -> ShowS)
-> Show AwsIamPolicyDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsIamPolicyDetails] -> ShowS
$cshowList :: [AwsIamPolicyDetails] -> ShowS
show :: AwsIamPolicyDetails -> String
$cshow :: AwsIamPolicyDetails -> String
showsPrec :: Int -> AwsIamPolicyDetails -> ShowS
$cshowsPrec :: Int -> AwsIamPolicyDetails -> ShowS
Prelude.Show, (forall x. AwsIamPolicyDetails -> Rep AwsIamPolicyDetails x)
-> (forall x. Rep AwsIamPolicyDetails x -> AwsIamPolicyDetails)
-> Generic AwsIamPolicyDetails
forall x. Rep AwsIamPolicyDetails x -> AwsIamPolicyDetails
forall x. AwsIamPolicyDetails -> Rep AwsIamPolicyDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsIamPolicyDetails x -> AwsIamPolicyDetails
$cfrom :: forall x. AwsIamPolicyDetails -> Rep AwsIamPolicyDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsIamPolicyDetails' 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:
--
-- 'policyName', 'awsIamPolicyDetails_policyName' - The name of the policy.
--
-- 'updateDate', 'awsIamPolicyDetails_updateDate' - When the policy was most recently updated.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'policyId', 'awsIamPolicyDetails_policyId' - The unique identifier of the policy.
--
-- 'path', 'awsIamPolicyDetails_path' - The path to the policy.
--
-- 'policyVersionList', 'awsIamPolicyDetails_policyVersionList' - List of versions of the policy.
--
-- 'createDate', 'awsIamPolicyDetails_createDate' - When the policy was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'isAttachable', 'awsIamPolicyDetails_isAttachable' - Whether the policy can be attached to a user, group, or role.
--
-- 'permissionsBoundaryUsageCount', 'awsIamPolicyDetails_permissionsBoundaryUsageCount' - The number of users and roles that use the policy to set the permissions
-- boundary.
--
-- 'defaultVersionId', 'awsIamPolicyDetails_defaultVersionId' - The identifier of the default version of the policy.
--
-- 'attachmentCount', 'awsIamPolicyDetails_attachmentCount' - The number of users, groups, and roles that the policy is attached to.
--
-- 'description', 'awsIamPolicyDetails_description' - A description of the policy.
newAwsIamPolicyDetails ::
  AwsIamPolicyDetails
newAwsIamPolicyDetails :: AwsIamPolicyDetails
newAwsIamPolicyDetails =
  AwsIamPolicyDetails' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [AwsIamPolicyVersion]
-> Maybe Text
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> AwsIamPolicyDetails
AwsIamPolicyDetails'
    { $sel:policyName:AwsIamPolicyDetails' :: Maybe Text
policyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updateDate:AwsIamPolicyDetails' :: Maybe Text
updateDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyId:AwsIamPolicyDetails' :: Maybe Text
policyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:path:AwsIamPolicyDetails' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policyVersionList:AwsIamPolicyDetails' :: Maybe [AwsIamPolicyVersion]
policyVersionList = Maybe [AwsIamPolicyVersion]
forall a. Maybe a
Prelude.Nothing,
      $sel:createDate:AwsIamPolicyDetails' :: Maybe Text
createDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isAttachable:AwsIamPolicyDetails' :: Maybe Bool
isAttachable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:permissionsBoundaryUsageCount:AwsIamPolicyDetails' :: Maybe Int
permissionsBoundaryUsageCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultVersionId:AwsIamPolicyDetails' :: Maybe Text
defaultVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attachmentCount:AwsIamPolicyDetails' :: Maybe Int
attachmentCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:description:AwsIamPolicyDetails' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

-- | When the policy was most recently updated.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsIamPolicyDetails_updateDate :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe Prelude.Text)
awsIamPolicyDetails_updateDate :: (Maybe Text -> f (Maybe Text))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_updateDate = (AwsIamPolicyDetails -> Maybe Text)
-> (AwsIamPolicyDetails -> Maybe Text -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails AwsIamPolicyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe Text
updateDate :: Maybe Text
$sel:updateDate:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
updateDate} -> Maybe Text
updateDate) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe Text
a -> AwsIamPolicyDetails
s {$sel:updateDate:AwsIamPolicyDetails' :: Maybe Text
updateDate = Maybe Text
a} :: AwsIamPolicyDetails)

-- | The unique identifier of the policy.
awsIamPolicyDetails_policyId :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe Prelude.Text)
awsIamPolicyDetails_policyId :: (Maybe Text -> f (Maybe Text))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_policyId = (AwsIamPolicyDetails -> Maybe Text)
-> (AwsIamPolicyDetails -> Maybe Text -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails AwsIamPolicyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe Text
policyId :: Maybe Text
$sel:policyId:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
policyId} -> Maybe Text
policyId) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe Text
a -> AwsIamPolicyDetails
s {$sel:policyId:AwsIamPolicyDetails' :: Maybe Text
policyId = Maybe Text
a} :: AwsIamPolicyDetails)

-- | The path to the policy.
awsIamPolicyDetails_path :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe Prelude.Text)
awsIamPolicyDetails_path :: (Maybe Text -> f (Maybe Text))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_path = (AwsIamPolicyDetails -> Maybe Text)
-> (AwsIamPolicyDetails -> Maybe Text -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails AwsIamPolicyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe Text
path :: Maybe Text
$sel:path:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
path} -> Maybe Text
path) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe Text
a -> AwsIamPolicyDetails
s {$sel:path:AwsIamPolicyDetails' :: Maybe Text
path = Maybe Text
a} :: AwsIamPolicyDetails)

-- | List of versions of the policy.
awsIamPolicyDetails_policyVersionList :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe [AwsIamPolicyVersion])
awsIamPolicyDetails_policyVersionList :: (Maybe [AwsIamPolicyVersion] -> f (Maybe [AwsIamPolicyVersion]))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_policyVersionList = (AwsIamPolicyDetails -> Maybe [AwsIamPolicyVersion])
-> (AwsIamPolicyDetails
    -> Maybe [AwsIamPolicyVersion] -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails
     AwsIamPolicyDetails
     (Maybe [AwsIamPolicyVersion])
     (Maybe [AwsIamPolicyVersion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe [AwsIamPolicyVersion]
policyVersionList :: Maybe [AwsIamPolicyVersion]
$sel:policyVersionList:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe [AwsIamPolicyVersion]
policyVersionList} -> Maybe [AwsIamPolicyVersion]
policyVersionList) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe [AwsIamPolicyVersion]
a -> AwsIamPolicyDetails
s {$sel:policyVersionList:AwsIamPolicyDetails' :: Maybe [AwsIamPolicyVersion]
policyVersionList = Maybe [AwsIamPolicyVersion]
a} :: AwsIamPolicyDetails) ((Maybe [AwsIamPolicyVersion] -> f (Maybe [AwsIamPolicyVersion]))
 -> AwsIamPolicyDetails -> f AwsIamPolicyDetails)
-> ((Maybe [AwsIamPolicyVersion]
     -> f (Maybe [AwsIamPolicyVersion]))
    -> Maybe [AwsIamPolicyVersion] -> f (Maybe [AwsIamPolicyVersion]))
-> (Maybe [AwsIamPolicyVersion] -> f (Maybe [AwsIamPolicyVersion]))
-> AwsIamPolicyDetails
-> f AwsIamPolicyDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsIamPolicyVersion]
  [AwsIamPolicyVersion]
  [AwsIamPolicyVersion]
  [AwsIamPolicyVersion]
-> Iso
     (Maybe [AwsIamPolicyVersion])
     (Maybe [AwsIamPolicyVersion])
     (Maybe [AwsIamPolicyVersion])
     (Maybe [AwsIamPolicyVersion])
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 AnIso
  [AwsIamPolicyVersion]
  [AwsIamPolicyVersion]
  [AwsIamPolicyVersion]
  [AwsIamPolicyVersion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | When the policy was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsIamPolicyDetails_createDate :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe Prelude.Text)
awsIamPolicyDetails_createDate :: (Maybe Text -> f (Maybe Text))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_createDate = (AwsIamPolicyDetails -> Maybe Text)
-> (AwsIamPolicyDetails -> Maybe Text -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails AwsIamPolicyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe Text
createDate :: Maybe Text
$sel:createDate:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
createDate} -> Maybe Text
createDate) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe Text
a -> AwsIamPolicyDetails
s {$sel:createDate:AwsIamPolicyDetails' :: Maybe Text
createDate = Maybe Text
a} :: AwsIamPolicyDetails)

-- | Whether the policy can be attached to a user, group, or role.
awsIamPolicyDetails_isAttachable :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe Prelude.Bool)
awsIamPolicyDetails_isAttachable :: (Maybe Bool -> f (Maybe Bool))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_isAttachable = (AwsIamPolicyDetails -> Maybe Bool)
-> (AwsIamPolicyDetails -> Maybe Bool -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails AwsIamPolicyDetails (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe Bool
isAttachable :: Maybe Bool
$sel:isAttachable:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Bool
isAttachable} -> Maybe Bool
isAttachable) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe Bool
a -> AwsIamPolicyDetails
s {$sel:isAttachable:AwsIamPolicyDetails' :: Maybe Bool
isAttachable = Maybe Bool
a} :: AwsIamPolicyDetails)

-- | The number of users and roles that use the policy to set the permissions
-- boundary.
awsIamPolicyDetails_permissionsBoundaryUsageCount :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe Prelude.Int)
awsIamPolicyDetails_permissionsBoundaryUsageCount :: (Maybe Int -> f (Maybe Int))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_permissionsBoundaryUsageCount = (AwsIamPolicyDetails -> Maybe Int)
-> (AwsIamPolicyDetails -> Maybe Int -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails AwsIamPolicyDetails (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe Int
permissionsBoundaryUsageCount :: Maybe Int
$sel:permissionsBoundaryUsageCount:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Int
permissionsBoundaryUsageCount} -> Maybe Int
permissionsBoundaryUsageCount) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe Int
a -> AwsIamPolicyDetails
s {$sel:permissionsBoundaryUsageCount:AwsIamPolicyDetails' :: Maybe Int
permissionsBoundaryUsageCount = Maybe Int
a} :: AwsIamPolicyDetails)

-- | The identifier of the default version of the policy.
awsIamPolicyDetails_defaultVersionId :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe Prelude.Text)
awsIamPolicyDetails_defaultVersionId :: (Maybe Text -> f (Maybe Text))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_defaultVersionId = (AwsIamPolicyDetails -> Maybe Text)
-> (AwsIamPolicyDetails -> Maybe Text -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails AwsIamPolicyDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe Text
defaultVersionId :: Maybe Text
$sel:defaultVersionId:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
defaultVersionId} -> Maybe Text
defaultVersionId) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe Text
a -> AwsIamPolicyDetails
s {$sel:defaultVersionId:AwsIamPolicyDetails' :: Maybe Text
defaultVersionId = Maybe Text
a} :: AwsIamPolicyDetails)

-- | The number of users, groups, and roles that the policy is attached to.
awsIamPolicyDetails_attachmentCount :: Lens.Lens' AwsIamPolicyDetails (Prelude.Maybe Prelude.Int)
awsIamPolicyDetails_attachmentCount :: (Maybe Int -> f (Maybe Int))
-> AwsIamPolicyDetails -> f AwsIamPolicyDetails
awsIamPolicyDetails_attachmentCount = (AwsIamPolicyDetails -> Maybe Int)
-> (AwsIamPolicyDetails -> Maybe Int -> AwsIamPolicyDetails)
-> Lens
     AwsIamPolicyDetails AwsIamPolicyDetails (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsIamPolicyDetails' {Maybe Int
attachmentCount :: Maybe Int
$sel:attachmentCount:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Int
attachmentCount} -> Maybe Int
attachmentCount) (\s :: AwsIamPolicyDetails
s@AwsIamPolicyDetails' {} Maybe Int
a -> AwsIamPolicyDetails
s {$sel:attachmentCount:AwsIamPolicyDetails' :: Maybe Int
attachmentCount = Maybe Int
a} :: AwsIamPolicyDetails)

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

instance Core.FromJSON AwsIamPolicyDetails where
  parseJSON :: Value -> Parser AwsIamPolicyDetails
parseJSON =
    String
-> (Object -> Parser AwsIamPolicyDetails)
-> Value
-> Parser AwsIamPolicyDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsIamPolicyDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [AwsIamPolicyVersion]
-> Maybe Text
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> AwsIamPolicyDetails
AwsIamPolicyDetails'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe [AwsIamPolicyVersion]
 -> Maybe Text
 -> Maybe Bool
 -> Maybe Int
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> AwsIamPolicyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe [AwsIamPolicyVersion]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> AwsIamPolicyDetails)
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
"PolicyName")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe [AwsIamPolicyVersion]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> AwsIamPolicyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [AwsIamPolicyVersion]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> AwsIamPolicyDetails)
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
"UpdateDate")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [AwsIamPolicyVersion]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> AwsIamPolicyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [AwsIamPolicyVersion]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> AwsIamPolicyDetails)
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
"PolicyId")
            Parser
  (Maybe Text
   -> Maybe [AwsIamPolicyVersion]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> AwsIamPolicyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe [AwsIamPolicyVersion]
      -> Maybe Text
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> AwsIamPolicyDetails)
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
"Path")
            Parser
  (Maybe [AwsIamPolicyVersion]
   -> Maybe Text
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> AwsIamPolicyDetails)
-> Parser (Maybe [AwsIamPolicyVersion])
-> Parser
     (Maybe Text
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> AwsIamPolicyDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AwsIamPolicyVersion]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PolicyVersionList"
                            Parser (Maybe (Maybe [AwsIamPolicyVersion]))
-> Maybe [AwsIamPolicyVersion]
-> Parser (Maybe [AwsIamPolicyVersion])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AwsIamPolicyVersion]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Text
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> AwsIamPolicyDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> AwsIamPolicyDetails)
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
"CreateDate")
            Parser
  (Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> AwsIamPolicyDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Int
      -> Maybe Text -> Maybe Int -> Maybe Text -> AwsIamPolicyDetails)
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
"IsAttachable")
            Parser
  (Maybe Int
   -> Maybe Text -> Maybe Int -> Maybe Text -> AwsIamPolicyDetails)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text -> Maybe Int -> Maybe Text -> AwsIamPolicyDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PermissionsBoundaryUsageCount")
            Parser
  (Maybe Text -> Maybe Int -> Maybe Text -> AwsIamPolicyDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> AwsIamPolicyDetails)
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
"DefaultVersionId")
            Parser (Maybe Int -> Maybe Text -> AwsIamPolicyDetails)
-> Parser (Maybe Int) -> Parser (Maybe Text -> AwsIamPolicyDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AttachmentCount")
            Parser (Maybe Text -> AwsIamPolicyDetails)
-> Parser (Maybe Text) -> Parser AwsIamPolicyDetails
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 AwsIamPolicyDetails

instance Prelude.NFData AwsIamPolicyDetails

instance Core.ToJSON AwsIamPolicyDetails where
  toJSON :: AwsIamPolicyDetails -> Value
toJSON AwsIamPolicyDetails' {Maybe Bool
Maybe Int
Maybe [AwsIamPolicyVersion]
Maybe Text
description :: Maybe Text
attachmentCount :: Maybe Int
defaultVersionId :: Maybe Text
permissionsBoundaryUsageCount :: Maybe Int
isAttachable :: Maybe Bool
createDate :: Maybe Text
policyVersionList :: Maybe [AwsIamPolicyVersion]
path :: Maybe Text
policyId :: Maybe Text
updateDate :: Maybe Text
policyName :: Maybe Text
$sel:description:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
$sel:attachmentCount:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Int
$sel:defaultVersionId:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
$sel:permissionsBoundaryUsageCount:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Int
$sel:isAttachable:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Bool
$sel:createDate:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
$sel:policyVersionList:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe [AwsIamPolicyVersion]
$sel:path:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
$sel:policyId:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
$sel:updateDate:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
$sel:policyName:AwsIamPolicyDetails' :: AwsIamPolicyDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PolicyName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policyName,
            (Text
"UpdateDate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
updateDate,
            (Text
"PolicyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policyId,
            (Text
"Path" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
path,
            (Text
"PolicyVersionList" Text -> [AwsIamPolicyVersion] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([AwsIamPolicyVersion] -> Pair)
-> Maybe [AwsIamPolicyVersion] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AwsIamPolicyVersion]
policyVersionList,
            (Text
"CreateDate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
createDate,
            (Text
"IsAttachable" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isAttachable,
            (Text
"PermissionsBoundaryUsageCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
permissionsBoundaryUsageCount,
            (Text
"DefaultVersionId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
defaultVersionId,
            (Text
"AttachmentCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
attachmentCount,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description
          ]
      )