{-# 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.IAM.Types.Policy
-- 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.IAM.Types.Policy where

import qualified Amazonka.Core as Core
import Amazonka.IAM.Types.Tag
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about a managed policy.
--
-- This data type is used as a response element in the CreatePolicy,
-- GetPolicy, and ListPolicies operations.
--
-- For more information about managed policies, refer to
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html Managed policies and inline policies>
-- in the /IAM User Guide/.
--
-- /See:/ 'newPolicy' smart constructor.
data Policy = Policy'
  { -- | The friendly name (not ARN) identifying the policy.
    Policy -> Maybe Text
policyName :: Prelude.Maybe Prelude.Text,
    Policy -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in
    -- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
    -- policy was last updated.
    --
    -- When a policy has only one version, this field contains the date and
    -- time when the policy was created. When a policy has more than one
    -- version, this field contains the date and time when the most recent
    -- policy version was created.
    Policy -> Maybe ISO8601
updateDate :: Prelude.Maybe Core.ISO8601,
    -- | The stable and unique string identifying the policy.
    --
    -- For more information about IDs, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    Policy -> Maybe Text
policyId :: Prelude.Maybe Prelude.Text,
    -- | The path to the policy.
    --
    -- For more information about paths, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
    -- in the /IAM User Guide/.
    Policy -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | The date and time, in
    -- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
    -- policy was created.
    Policy -> Maybe ISO8601
createDate :: Prelude.Maybe Core.ISO8601,
    -- | Specifies whether the policy can be attached to an IAM user, group, or
    -- role.
    Policy -> Maybe Bool
isAttachable :: Prelude.Maybe Prelude.Bool,
    -- | The number of entities (users and roles) for which the policy is used to
    -- set the permissions boundary.
    --
    -- For more information about permissions boundaries, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html Permissions boundaries for IAM identities>
    -- in the /IAM User Guide/.
    Policy -> Maybe Int
permissionsBoundaryUsageCount :: Prelude.Maybe Prelude.Int,
    -- | The identifier for the version of the policy that is set as the default
    -- version.
    Policy -> Maybe Text
defaultVersionId :: Prelude.Maybe Prelude.Text,
    -- | The number of entities (users, groups, and roles) that the policy is
    -- attached to.
    Policy -> Maybe Int
attachmentCount :: Prelude.Maybe Prelude.Int,
    -- | A friendly description of the policy.
    --
    -- This element is included in the response to the GetPolicy operation. It
    -- is not included in the response to the ListPolicies operation.
    Policy -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A list of tags that are attached to the instance profile. For more
    -- information about tagging, see
    -- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html Tagging IAM resources>
    -- in the /IAM User Guide/.
    Policy -> Maybe [Tag]
tags :: Prelude.Maybe [Tag]
  }
  deriving (Policy -> Policy -> Bool
(Policy -> Policy -> Bool)
-> (Policy -> Policy -> Bool) -> Eq Policy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Policy -> Policy -> Bool
$c/= :: Policy -> Policy -> Bool
== :: Policy -> Policy -> Bool
$c== :: Policy -> Policy -> Bool
Prelude.Eq, ReadPrec [Policy]
ReadPrec Policy
Int -> ReadS Policy
ReadS [Policy]
(Int -> ReadS Policy)
-> ReadS [Policy]
-> ReadPrec Policy
-> ReadPrec [Policy]
-> Read Policy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Policy]
$creadListPrec :: ReadPrec [Policy]
readPrec :: ReadPrec Policy
$creadPrec :: ReadPrec Policy
readList :: ReadS [Policy]
$creadList :: ReadS [Policy]
readsPrec :: Int -> ReadS Policy
$creadsPrec :: Int -> ReadS Policy
Prelude.Read, Int -> Policy -> ShowS
[Policy] -> ShowS
Policy -> String
(Int -> Policy -> ShowS)
-> (Policy -> String) -> ([Policy] -> ShowS) -> Show Policy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Policy] -> ShowS
$cshowList :: [Policy] -> ShowS
show :: Policy -> String
$cshow :: Policy -> String
showsPrec :: Int -> Policy -> ShowS
$cshowsPrec :: Int -> Policy -> ShowS
Prelude.Show, (forall x. Policy -> Rep Policy x)
-> (forall x. Rep Policy x -> Policy) -> Generic Policy
forall x. Rep Policy x -> Policy
forall x. Policy -> Rep Policy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Policy x -> Policy
$cfrom :: forall x. Policy -> Rep Policy x
Prelude.Generic)

-- |
-- Create a value of 'Policy' 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', 'policy_policyName' - The friendly name (not ARN) identifying the policy.
--
-- 'arn', 'policy_arn' - Undocumented member.
--
-- 'updateDate', 'policy_updateDate' - The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- policy was last updated.
--
-- When a policy has only one version, this field contains the date and
-- time when the policy was created. When a policy has more than one
-- version, this field contains the date and time when the most recent
-- policy version was created.
--
-- 'policyId', 'policy_policyId' - The stable and unique string identifying the policy.
--
-- For more information about IDs, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'path', 'policy_path' - The path to the policy.
--
-- For more information about paths, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
--
-- 'createDate', 'policy_createDate' - The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- policy was created.
--
-- 'isAttachable', 'policy_isAttachable' - Specifies whether the policy can be attached to an IAM user, group, or
-- role.
--
-- 'permissionsBoundaryUsageCount', 'policy_permissionsBoundaryUsageCount' - The number of entities (users and roles) for which the policy is used to
-- set the permissions boundary.
--
-- For more information about permissions boundaries, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html Permissions boundaries for IAM identities>
-- in the /IAM User Guide/.
--
-- 'defaultVersionId', 'policy_defaultVersionId' - The identifier for the version of the policy that is set as the default
-- version.
--
-- 'attachmentCount', 'policy_attachmentCount' - The number of entities (users, groups, and roles) that the policy is
-- attached to.
--
-- 'description', 'policy_description' - A friendly description of the policy.
--
-- This element is included in the response to the GetPolicy operation. It
-- is not included in the response to the ListPolicies operation.
--
-- 'tags', 'policy_tags' - A list of tags that are attached to the instance profile. For more
-- information about tagging, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html Tagging IAM resources>
-- in the /IAM User Guide/.
newPolicy ::
  Policy
newPolicy :: Policy
newPolicy =
  Policy' :: Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe [Tag]
-> Policy
Policy'
    { $sel:policyName:Policy' :: Maybe Text
policyName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Policy' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:updateDate:Policy' :: Maybe ISO8601
updateDate = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:policyId:Policy' :: Maybe Text
policyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:path:Policy' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createDate:Policy' :: Maybe ISO8601
createDate = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:isAttachable:Policy' :: Maybe Bool
isAttachable = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:permissionsBoundaryUsageCount:Policy' :: Maybe Int
permissionsBoundaryUsageCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultVersionId:Policy' :: Maybe Text
defaultVersionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attachmentCount:Policy' :: Maybe Int
attachmentCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Policy' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:Policy' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing
    }

-- | The friendly name (not ARN) identifying the policy.
policy_policyName :: Lens.Lens' Policy (Prelude.Maybe Prelude.Text)
policy_policyName :: (Maybe Text -> f (Maybe Text)) -> Policy -> f Policy
policy_policyName = (Policy -> Maybe Text)
-> (Policy -> Maybe Text -> Policy)
-> Lens Policy Policy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Text
policyName :: Maybe Text
$sel:policyName:Policy' :: Policy -> Maybe Text
policyName} -> Maybe Text
policyName) (\s :: Policy
s@Policy' {} Maybe Text
a -> Policy
s {$sel:policyName:Policy' :: Maybe Text
policyName = Maybe Text
a} :: Policy)

-- | Undocumented member.
policy_arn :: Lens.Lens' Policy (Prelude.Maybe Prelude.Text)
policy_arn :: (Maybe Text -> f (Maybe Text)) -> Policy -> f Policy
policy_arn = (Policy -> Maybe Text)
-> (Policy -> Maybe Text -> Policy)
-> Lens Policy Policy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Text
arn :: Maybe Text
$sel:arn:Policy' :: Policy -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Policy
s@Policy' {} Maybe Text
a -> Policy
s {$sel:arn:Policy' :: Maybe Text
arn = Maybe Text
a} :: Policy)

-- | The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- policy was last updated.
--
-- When a policy has only one version, this field contains the date and
-- time when the policy was created. When a policy has more than one
-- version, this field contains the date and time when the most recent
-- policy version was created.
policy_updateDate :: Lens.Lens' Policy (Prelude.Maybe Prelude.UTCTime)
policy_updateDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Policy -> f Policy
policy_updateDate = (Policy -> Maybe ISO8601)
-> (Policy -> Maybe ISO8601 -> Policy)
-> Lens Policy Policy (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe ISO8601
updateDate :: Maybe ISO8601
$sel:updateDate:Policy' :: Policy -> Maybe ISO8601
updateDate} -> Maybe ISO8601
updateDate) (\s :: Policy
s@Policy' {} Maybe ISO8601
a -> Policy
s {$sel:updateDate:Policy' :: Maybe ISO8601
updateDate = Maybe ISO8601
a} :: Policy) ((Maybe ISO8601 -> f (Maybe ISO8601)) -> Policy -> f Policy)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Policy
-> f Policy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The stable and unique string identifying the policy.
--
-- For more information about IDs, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
policy_policyId :: Lens.Lens' Policy (Prelude.Maybe Prelude.Text)
policy_policyId :: (Maybe Text -> f (Maybe Text)) -> Policy -> f Policy
policy_policyId = (Policy -> Maybe Text)
-> (Policy -> Maybe Text -> Policy)
-> Lens Policy Policy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Text
policyId :: Maybe Text
$sel:policyId:Policy' :: Policy -> Maybe Text
policyId} -> Maybe Text
policyId) (\s :: Policy
s@Policy' {} Maybe Text
a -> Policy
s {$sel:policyId:Policy' :: Maybe Text
policyId = Maybe Text
a} :: Policy)

-- | The path to the policy.
--
-- For more information about paths, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html IAM identifiers>
-- in the /IAM User Guide/.
policy_path :: Lens.Lens' Policy (Prelude.Maybe Prelude.Text)
policy_path :: (Maybe Text -> f (Maybe Text)) -> Policy -> f Policy
policy_path = (Policy -> Maybe Text)
-> (Policy -> Maybe Text -> Policy)
-> Lens Policy Policy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Text
path :: Maybe Text
$sel:path:Policy' :: Policy -> Maybe Text
path} -> Maybe Text
path) (\s :: Policy
s@Policy' {} Maybe Text
a -> Policy
s {$sel:path:Policy' :: Maybe Text
path = Maybe Text
a} :: Policy)

-- | The date and time, in
-- <http://www.iso.org/iso/iso8601 ISO 8601 date-time format>, when the
-- policy was created.
policy_createDate :: Lens.Lens' Policy (Prelude.Maybe Prelude.UTCTime)
policy_createDate :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Policy -> f Policy
policy_createDate = (Policy -> Maybe ISO8601)
-> (Policy -> Maybe ISO8601 -> Policy)
-> Lens Policy Policy (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe ISO8601
createDate :: Maybe ISO8601
$sel:createDate:Policy' :: Policy -> Maybe ISO8601
createDate} -> Maybe ISO8601
createDate) (\s :: Policy
s@Policy' {} Maybe ISO8601
a -> Policy
s {$sel:createDate:Policy' :: Maybe ISO8601
createDate = Maybe ISO8601
a} :: Policy) ((Maybe ISO8601 -> f (Maybe ISO8601)) -> Policy -> f Policy)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Policy
-> f Policy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

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

-- | The number of entities (users and roles) for which the policy is used to
-- set the permissions boundary.
--
-- For more information about permissions boundaries, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html Permissions boundaries for IAM identities>
-- in the /IAM User Guide/.
policy_permissionsBoundaryUsageCount :: Lens.Lens' Policy (Prelude.Maybe Prelude.Int)
policy_permissionsBoundaryUsageCount :: (Maybe Int -> f (Maybe Int)) -> Policy -> f Policy
policy_permissionsBoundaryUsageCount = (Policy -> Maybe Int)
-> (Policy -> Maybe Int -> Policy)
-> Lens Policy Policy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Int
permissionsBoundaryUsageCount :: Maybe Int
$sel:permissionsBoundaryUsageCount:Policy' :: Policy -> Maybe Int
permissionsBoundaryUsageCount} -> Maybe Int
permissionsBoundaryUsageCount) (\s :: Policy
s@Policy' {} Maybe Int
a -> Policy
s {$sel:permissionsBoundaryUsageCount:Policy' :: Maybe Int
permissionsBoundaryUsageCount = Maybe Int
a} :: Policy)

-- | The identifier for the version of the policy that is set as the default
-- version.
policy_defaultVersionId :: Lens.Lens' Policy (Prelude.Maybe Prelude.Text)
policy_defaultVersionId :: (Maybe Text -> f (Maybe Text)) -> Policy -> f Policy
policy_defaultVersionId = (Policy -> Maybe Text)
-> (Policy -> Maybe Text -> Policy)
-> Lens Policy Policy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Text
defaultVersionId :: Maybe Text
$sel:defaultVersionId:Policy' :: Policy -> Maybe Text
defaultVersionId} -> Maybe Text
defaultVersionId) (\s :: Policy
s@Policy' {} Maybe Text
a -> Policy
s {$sel:defaultVersionId:Policy' :: Maybe Text
defaultVersionId = Maybe Text
a} :: Policy)

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

-- | A friendly description of the policy.
--
-- This element is included in the response to the GetPolicy operation. It
-- is not included in the response to the ListPolicies operation.
policy_description :: Lens.Lens' Policy (Prelude.Maybe Prelude.Text)
policy_description :: (Maybe Text -> f (Maybe Text)) -> Policy -> f Policy
policy_description = (Policy -> Maybe Text)
-> (Policy -> Maybe Text -> Policy)
-> Lens Policy Policy (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe Text
description :: Maybe Text
$sel:description:Policy' :: Policy -> Maybe Text
description} -> Maybe Text
description) (\s :: Policy
s@Policy' {} Maybe Text
a -> Policy
s {$sel:description:Policy' :: Maybe Text
description = Maybe Text
a} :: Policy)

-- | A list of tags that are attached to the instance profile. For more
-- information about tagging, see
-- <https://docs.aws.amazon.com/IAM/latest/UserGuide/id_tags.html Tagging IAM resources>
-- in the /IAM User Guide/.
policy_tags :: Lens.Lens' Policy (Prelude.Maybe [Tag])
policy_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> Policy -> f Policy
policy_tags = (Policy -> Maybe [Tag])
-> (Policy -> Maybe [Tag] -> Policy)
-> Lens Policy Policy (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Policy' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:Policy' :: Policy -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: Policy
s@Policy' {} Maybe [Tag]
a -> Policy
s {$sel:tags:Policy' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: Policy) ((Maybe [Tag] -> f (Maybe [Tag])) -> Policy -> f Policy)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> Policy
-> f Policy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromXML Policy where
  parseXML :: [Node] -> Either String Policy
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe Bool
-> Maybe Int
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe [Tag]
-> Policy
Policy'
      (Maybe Text
 -> Maybe Text
 -> Maybe ISO8601
 -> Maybe Text
 -> Maybe Text
 -> Maybe ISO8601
 -> Maybe Bool
 -> Maybe Int
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Maybe [Tag]
 -> Policy)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Tag]
      -> Policy)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyName")
      Either
  String
  (Maybe Text
   -> Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Tag]
   -> Policy)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe ISO8601
      -> Maybe Text
      -> Maybe Text
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Tag]
      -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Arn")
      Either
  String
  (Maybe ISO8601
   -> Maybe Text
   -> Maybe Text
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Tag]
   -> Policy)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Tag]
      -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"UpdateDate")
      Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Tag]
   -> Policy)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe ISO8601
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Tag]
      -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PolicyId")
      Either
  String
  (Maybe Text
   -> Maybe ISO8601
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Tag]
   -> Policy)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe ISO8601
      -> Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Tag]
      -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Path")
      Either
  String
  (Maybe ISO8601
   -> Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Tag]
   -> Policy)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Bool
      -> Maybe Int
      -> Maybe Text
      -> Maybe Int
      -> Maybe Text
      -> Maybe [Tag]
      -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"CreateDate")
      Either
  String
  (Maybe Bool
   -> Maybe Int
   -> Maybe Text
   -> Maybe Int
   -> Maybe Text
   -> Maybe [Tag]
   -> Policy)
-> Either String (Maybe Bool)
-> Either
     String
     (Maybe Int
      -> Maybe Text -> Maybe Int -> Maybe Text -> Maybe [Tag] -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"IsAttachable")
      Either
  String
  (Maybe Int
   -> Maybe Text -> Maybe Int -> Maybe Text -> Maybe [Tag] -> Policy)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Text -> Maybe Int -> Maybe Text -> Maybe [Tag] -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PermissionsBoundaryUsageCount")
      Either
  String
  (Maybe Text -> Maybe Int -> Maybe Text -> Maybe [Tag] -> Policy)
-> Either String (Maybe Text)
-> Either String (Maybe Int -> Maybe Text -> Maybe [Tag] -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DefaultVersionId")
      Either String (Maybe Int -> Maybe Text -> Maybe [Tag] -> Policy)
-> Either String (Maybe Int)
-> Either String (Maybe Text -> Maybe [Tag] -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AttachmentCount")
      Either String (Maybe Text -> Maybe [Tag] -> Policy)
-> Either String (Maybe Text)
-> Either String (Maybe [Tag] -> Policy)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Description")
      Either String (Maybe [Tag] -> Policy)
-> Either String (Maybe [Tag]) -> Either String Policy
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Tags" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Tag]))
-> Either String (Maybe [Tag])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Tag])
-> [Node] -> Either String (Maybe [Tag])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Tag]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )

instance Prelude.Hashable Policy

instance Prelude.NFData Policy