module Stratosphere.IAM.UserPolicy (
        UserPolicy(..), mkUserPolicy
    ) where
import qualified Data.Aeson as JSON
import qualified Stratosphere.Prelude as Prelude
import Stratosphere.Property
import Stratosphere.ResourceProperties
import Stratosphere.Value
data UserPolicy
  = -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-userpolicy.html>
    UserPolicy {UserPolicy -> ()
haddock_workaround_ :: (),
                -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-userpolicy.html#cfn-iam-userpolicy-policydocument>
                UserPolicy -> Maybe Object
policyDocument :: (Prelude.Maybe JSON.Object),
                -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-userpolicy.html#cfn-iam-userpolicy-policyname>
                UserPolicy -> Value Text
policyName :: (Value Prelude.Text),
                -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-userpolicy.html#cfn-iam-userpolicy-username>
                UserPolicy -> Value Text
userName :: (Value Prelude.Text)}
  deriving stock (UserPolicy -> UserPolicy -> Bool
(UserPolicy -> UserPolicy -> Bool)
-> (UserPolicy -> UserPolicy -> Bool) -> Eq UserPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UserPolicy -> UserPolicy -> Bool
== :: UserPolicy -> UserPolicy -> Bool
$c/= :: UserPolicy -> UserPolicy -> Bool
/= :: UserPolicy -> UserPolicy -> Bool
Prelude.Eq, Int -> UserPolicy -> ShowS
[UserPolicy] -> ShowS
UserPolicy -> String
(Int -> UserPolicy -> ShowS)
-> (UserPolicy -> String)
-> ([UserPolicy] -> ShowS)
-> Show UserPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UserPolicy -> ShowS
showsPrec :: Int -> UserPolicy -> ShowS
$cshow :: UserPolicy -> String
show :: UserPolicy -> String
$cshowList :: [UserPolicy] -> ShowS
showList :: [UserPolicy] -> ShowS
Prelude.Show)
mkUserPolicy ::
  Value Prelude.Text -> Value Prelude.Text -> UserPolicy
mkUserPolicy :: Value Text -> Value Text -> UserPolicy
mkUserPolicy Value Text
policyName Value Text
userName
  = UserPolicy
      {haddock_workaround_ :: ()
haddock_workaround_ = (), policyName :: Value Text
policyName = Value Text
policyName,
       userName :: Value Text
userName = Value Text
userName, policyDocument :: Maybe Object
policyDocument = Maybe Object
forall a. Maybe a
Prelude.Nothing}
instance ToResourceProperties UserPolicy where
  toResourceProperties :: UserPolicy -> ResourceProperties
toResourceProperties UserPolicy {Maybe Object
()
Value Text
haddock_workaround_ :: UserPolicy -> ()
policyDocument :: UserPolicy -> Maybe Object
policyName :: UserPolicy -> Value Text
userName :: UserPolicy -> Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
policyName :: Value Text
userName :: Value Text
..}
    = ResourceProperties
        {awsType :: Text
awsType = Text
"AWS::IAM::UserPolicy", supportsTags :: Bool
supportsTags = Bool
Prelude.False,
         properties :: Object
properties = [Item Object] -> Object
forall l. IsList l => [Item l] -> l
Prelude.fromList
                        ([(Key, Value)] -> [(Key, Value)] -> [(Key, Value)]
forall a. Semigroup a => a -> a -> a
(Prelude.<>)
                           [Key
"PolicyName" Key -> Value Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= Value Text
policyName, Key
"UserName" Key -> Value Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= Value Text
userName]
                           ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
                              [Key -> Object -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"PolicyDocument" (Object -> (Key, Value)) -> Maybe Object -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Object
policyDocument]))}
instance JSON.ToJSON UserPolicy where
  toJSON :: UserPolicy -> Value
toJSON UserPolicy {Maybe Object
()
Value Text
haddock_workaround_ :: UserPolicy -> ()
policyDocument :: UserPolicy -> Maybe Object
policyName :: UserPolicy -> Value Text
userName :: UserPolicy -> Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
policyName :: Value Text
userName :: Value Text
..}
    = [(Key, Value)] -> Value
JSON.object
        ([Item [(Key, Value)]] -> [(Key, Value)]
forall l. IsList l => [Item l] -> l
Prelude.fromList
           ([(Key, Value)] -> [(Key, Value)] -> [(Key, Value)]
forall a. Semigroup a => a -> a -> a
(Prelude.<>)
              [Key
"PolicyName" Key -> Value Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= Value Text
policyName, Key
"UserName" Key -> Value Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= Value Text
userName]
              ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
                 [Key -> Object -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"PolicyDocument" (Object -> (Key, Value)) -> Maybe Object -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Object
policyDocument])))
instance Property "PolicyDocument" UserPolicy where
  type PropertyType "PolicyDocument" UserPolicy = JSON.Object
  set :: PropertyType "PolicyDocument" UserPolicy
-> UserPolicy -> UserPolicy
set PropertyType "PolicyDocument" UserPolicy
newValue UserPolicy {Maybe Object
()
Value Text
haddock_workaround_ :: UserPolicy -> ()
policyDocument :: UserPolicy -> Maybe Object
policyName :: UserPolicy -> Value Text
userName :: UserPolicy -> Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
policyName :: Value Text
userName :: Value Text
..}
    = UserPolicy {policyDocument :: Maybe Object
policyDocument = Object -> Maybe Object
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure Object
PropertyType "PolicyDocument" UserPolicy
newValue, ()
Value Text
haddock_workaround_ :: ()
policyName :: Value Text
userName :: Value Text
haddock_workaround_ :: ()
policyName :: Value Text
userName :: Value Text
..}
instance Property "PolicyName" UserPolicy where
  type PropertyType "PolicyName" UserPolicy = Value Prelude.Text
  set :: PropertyType "PolicyName" UserPolicy -> UserPolicy -> UserPolicy
set PropertyType "PolicyName" UserPolicy
newValue UserPolicy {Maybe Object
()
Value Text
haddock_workaround_ :: UserPolicy -> ()
policyDocument :: UserPolicy -> Maybe Object
policyName :: UserPolicy -> Value Text
userName :: UserPolicy -> Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
policyName :: Value Text
userName :: Value Text
..}
    = UserPolicy {policyName :: Value Text
policyName = PropertyType "PolicyName" UserPolicy
Value Text
newValue, Maybe Object
()
Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
userName :: Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
userName :: Value Text
..}
instance Property "UserName" UserPolicy where
  type PropertyType "UserName" UserPolicy = Value Prelude.Text
  set :: PropertyType "UserName" UserPolicy -> UserPolicy -> UserPolicy
set PropertyType "UserName" UserPolicy
newValue UserPolicy {Maybe Object
()
Value Text
haddock_workaround_ :: UserPolicy -> ()
policyDocument :: UserPolicy -> Maybe Object
policyName :: UserPolicy -> Value Text
userName :: UserPolicy -> Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
policyName :: Value Text
userName :: Value Text
..} = UserPolicy {userName :: Value Text
userName = PropertyType "UserName" UserPolicy
Value Text
newValue, Maybe Object
()
Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
policyName :: Value Text
haddock_workaround_ :: ()
policyDocument :: Maybe Object
policyName :: Value Text
..}