{-# 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.SSOAdmin.Types.AttachedManagedPolicy
-- 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.SSOAdmin.Types.AttachedManagedPolicy where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure that stores the details of the IAM managed policy.
--
-- /See:/ 'newAttachedManagedPolicy' smart constructor.
data AttachedManagedPolicy = AttachedManagedPolicy'
  { -- | The ARN of the IAM managed policy. For more information about ARNs, see
    -- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
    -- in the /Amazon Web Services General Reference/.
    AttachedManagedPolicy -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the IAM managed policy.
    AttachedManagedPolicy -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (AttachedManagedPolicy -> AttachedManagedPolicy -> Bool
(AttachedManagedPolicy -> AttachedManagedPolicy -> Bool)
-> (AttachedManagedPolicy -> AttachedManagedPolicy -> Bool)
-> Eq AttachedManagedPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachedManagedPolicy -> AttachedManagedPolicy -> Bool
$c/= :: AttachedManagedPolicy -> AttachedManagedPolicy -> Bool
== :: AttachedManagedPolicy -> AttachedManagedPolicy -> Bool
$c== :: AttachedManagedPolicy -> AttachedManagedPolicy -> Bool
Prelude.Eq, ReadPrec [AttachedManagedPolicy]
ReadPrec AttachedManagedPolicy
Int -> ReadS AttachedManagedPolicy
ReadS [AttachedManagedPolicy]
(Int -> ReadS AttachedManagedPolicy)
-> ReadS [AttachedManagedPolicy]
-> ReadPrec AttachedManagedPolicy
-> ReadPrec [AttachedManagedPolicy]
-> Read AttachedManagedPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachedManagedPolicy]
$creadListPrec :: ReadPrec [AttachedManagedPolicy]
readPrec :: ReadPrec AttachedManagedPolicy
$creadPrec :: ReadPrec AttachedManagedPolicy
readList :: ReadS [AttachedManagedPolicy]
$creadList :: ReadS [AttachedManagedPolicy]
readsPrec :: Int -> ReadS AttachedManagedPolicy
$creadsPrec :: Int -> ReadS AttachedManagedPolicy
Prelude.Read, Int -> AttachedManagedPolicy -> ShowS
[AttachedManagedPolicy] -> ShowS
AttachedManagedPolicy -> String
(Int -> AttachedManagedPolicy -> ShowS)
-> (AttachedManagedPolicy -> String)
-> ([AttachedManagedPolicy] -> ShowS)
-> Show AttachedManagedPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachedManagedPolicy] -> ShowS
$cshowList :: [AttachedManagedPolicy] -> ShowS
show :: AttachedManagedPolicy -> String
$cshow :: AttachedManagedPolicy -> String
showsPrec :: Int -> AttachedManagedPolicy -> ShowS
$cshowsPrec :: Int -> AttachedManagedPolicy -> ShowS
Prelude.Show, (forall x. AttachedManagedPolicy -> Rep AttachedManagedPolicy x)
-> (forall x. Rep AttachedManagedPolicy x -> AttachedManagedPolicy)
-> Generic AttachedManagedPolicy
forall x. Rep AttachedManagedPolicy x -> AttachedManagedPolicy
forall x. AttachedManagedPolicy -> Rep AttachedManagedPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachedManagedPolicy x -> AttachedManagedPolicy
$cfrom :: forall x. AttachedManagedPolicy -> Rep AttachedManagedPolicy x
Prelude.Generic)

-- |
-- Create a value of 'AttachedManagedPolicy' 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', 'attachedManagedPolicy_arn' - The ARN of the IAM managed policy. For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
--
-- 'name', 'attachedManagedPolicy_name' - The name of the IAM managed policy.
newAttachedManagedPolicy ::
  AttachedManagedPolicy
newAttachedManagedPolicy :: AttachedManagedPolicy
newAttachedManagedPolicy =
  AttachedManagedPolicy' :: Maybe Text -> Maybe Text -> AttachedManagedPolicy
AttachedManagedPolicy'
    { $sel:arn:AttachedManagedPolicy' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:AttachedManagedPolicy' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the IAM managed policy. For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
attachedManagedPolicy_arn :: Lens.Lens' AttachedManagedPolicy (Prelude.Maybe Prelude.Text)
attachedManagedPolicy_arn :: (Maybe Text -> f (Maybe Text))
-> AttachedManagedPolicy -> f AttachedManagedPolicy
attachedManagedPolicy_arn = (AttachedManagedPolicy -> Maybe Text)
-> (AttachedManagedPolicy -> Maybe Text -> AttachedManagedPolicy)
-> Lens
     AttachedManagedPolicy
     AttachedManagedPolicy
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachedManagedPolicy' {Maybe Text
arn :: Maybe Text
$sel:arn:AttachedManagedPolicy' :: AttachedManagedPolicy -> Maybe Text
arn} -> Maybe Text
arn) (\s :: AttachedManagedPolicy
s@AttachedManagedPolicy' {} Maybe Text
a -> AttachedManagedPolicy
s {$sel:arn:AttachedManagedPolicy' :: Maybe Text
arn = Maybe Text
a} :: AttachedManagedPolicy)

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

instance Core.FromJSON AttachedManagedPolicy where
  parseJSON :: Value -> Parser AttachedManagedPolicy
parseJSON =
    String
-> (Object -> Parser AttachedManagedPolicy)
-> Value
-> Parser AttachedManagedPolicy
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AttachedManagedPolicy"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AttachedManagedPolicy
AttachedManagedPolicy'
            (Maybe Text -> Maybe Text -> AttachedManagedPolicy)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AttachedManagedPolicy)
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 -> AttachedManagedPolicy)
-> Parser (Maybe Text) -> Parser AttachedManagedPolicy
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")
      )

instance Prelude.Hashable AttachedManagedPolicy

instance Prelude.NFData AttachedManagedPolicy