{-# 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 #-}
module Amazonka.IAM.Types.RoleUsageType where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data RoleUsageType = RoleUsageType'
{
RoleUsageType -> Maybe [Text]
resources :: Prelude.Maybe [Prelude.Text],
RoleUsageType -> Maybe Text
region :: Prelude.Maybe Prelude.Text
}
deriving (RoleUsageType -> RoleUsageType -> Bool
(RoleUsageType -> RoleUsageType -> Bool)
-> (RoleUsageType -> RoleUsageType -> Bool) -> Eq RoleUsageType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoleUsageType -> RoleUsageType -> Bool
$c/= :: RoleUsageType -> RoleUsageType -> Bool
== :: RoleUsageType -> RoleUsageType -> Bool
$c== :: RoleUsageType -> RoleUsageType -> Bool
Prelude.Eq, ReadPrec [RoleUsageType]
ReadPrec RoleUsageType
Int -> ReadS RoleUsageType
ReadS [RoleUsageType]
(Int -> ReadS RoleUsageType)
-> ReadS [RoleUsageType]
-> ReadPrec RoleUsageType
-> ReadPrec [RoleUsageType]
-> Read RoleUsageType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoleUsageType]
$creadListPrec :: ReadPrec [RoleUsageType]
readPrec :: ReadPrec RoleUsageType
$creadPrec :: ReadPrec RoleUsageType
readList :: ReadS [RoleUsageType]
$creadList :: ReadS [RoleUsageType]
readsPrec :: Int -> ReadS RoleUsageType
$creadsPrec :: Int -> ReadS RoleUsageType
Prelude.Read, Int -> RoleUsageType -> ShowS
[RoleUsageType] -> ShowS
RoleUsageType -> String
(Int -> RoleUsageType -> ShowS)
-> (RoleUsageType -> String)
-> ([RoleUsageType] -> ShowS)
-> Show RoleUsageType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoleUsageType] -> ShowS
$cshowList :: [RoleUsageType] -> ShowS
show :: RoleUsageType -> String
$cshow :: RoleUsageType -> String
showsPrec :: Int -> RoleUsageType -> ShowS
$cshowsPrec :: Int -> RoleUsageType -> ShowS
Prelude.Show, (forall x. RoleUsageType -> Rep RoleUsageType x)
-> (forall x. Rep RoleUsageType x -> RoleUsageType)
-> Generic RoleUsageType
forall x. Rep RoleUsageType x -> RoleUsageType
forall x. RoleUsageType -> Rep RoleUsageType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoleUsageType x -> RoleUsageType
$cfrom :: forall x. RoleUsageType -> Rep RoleUsageType x
Prelude.Generic)
newRoleUsageType ::
RoleUsageType
newRoleUsageType :: RoleUsageType
newRoleUsageType =
RoleUsageType' :: Maybe [Text] -> Maybe Text -> RoleUsageType
RoleUsageType'
{ $sel:resources:RoleUsageType' :: Maybe [Text]
resources = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:region:RoleUsageType' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
roleUsageType_resources :: Lens.Lens' RoleUsageType (Prelude.Maybe [Prelude.Text])
roleUsageType_resources :: (Maybe [Text] -> f (Maybe [Text]))
-> RoleUsageType -> f RoleUsageType
roleUsageType_resources = (RoleUsageType -> Maybe [Text])
-> (RoleUsageType -> Maybe [Text] -> RoleUsageType)
-> Lens RoleUsageType RoleUsageType (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleUsageType' {Maybe [Text]
resources :: Maybe [Text]
$sel:resources:RoleUsageType' :: RoleUsageType -> Maybe [Text]
resources} -> Maybe [Text]
resources) (\s :: RoleUsageType
s@RoleUsageType' {} Maybe [Text]
a -> RoleUsageType
s {$sel:resources:RoleUsageType' :: Maybe [Text]
resources = Maybe [Text]
a} :: RoleUsageType) ((Maybe [Text] -> f (Maybe [Text]))
-> RoleUsageType -> f RoleUsageType)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> RoleUsageType
-> f RoleUsageType
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
roleUsageType_region :: Lens.Lens' RoleUsageType (Prelude.Maybe Prelude.Text)
roleUsageType_region :: (Maybe Text -> f (Maybe Text)) -> RoleUsageType -> f RoleUsageType
roleUsageType_region = (RoleUsageType -> Maybe Text)
-> (RoleUsageType -> Maybe Text -> RoleUsageType)
-> Lens RoleUsageType RoleUsageType (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoleUsageType' {Maybe Text
region :: Maybe Text
$sel:region:RoleUsageType' :: RoleUsageType -> Maybe Text
region} -> Maybe Text
region) (\s :: RoleUsageType
s@RoleUsageType' {} Maybe Text
a -> RoleUsageType
s {$sel:region:RoleUsageType' :: Maybe Text
region = Maybe Text
a} :: RoleUsageType)
instance Core.FromXML RoleUsageType where
parseXML :: [Node] -> Either String RoleUsageType
parseXML [Node]
x =
Maybe [Text] -> Maybe Text -> RoleUsageType
RoleUsageType'
(Maybe [Text] -> Maybe Text -> RoleUsageType)
-> Either String (Maybe [Text])
-> Either String (Maybe Text -> RoleUsageType)
forall (f :: * -> *) a b. Functor 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
"Resources" 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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe Text -> RoleUsageType)
-> Either String (Maybe Text) -> Either String RoleUsageType
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
"Region")
instance Prelude.Hashable RoleUsageType
instance Prelude.NFData RoleUsageType