module Stratosphere.IAM.Policy (
        Policy(..), mkPolicy
    ) where
import qualified Data.Aeson as JSON
import qualified Stratosphere.Prelude as Prelude
import Stratosphere.Property
import Stratosphere.ResourceProperties
import Stratosphere.Value
data Policy
  = -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html>
    Policy {Policy -> ()
haddock_workaround_ :: (),
            -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-groups>
            Policy -> Maybe (ValueList Text)
groups :: (Prelude.Maybe (ValueList Prelude.Text)),
            -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-policydocument>
            Policy -> Object
policyDocument :: JSON.Object,
            -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-policyname>
            Policy -> Value Text
policyName :: (Value Prelude.Text),
            -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-roles>
            Policy -> Maybe (ValueList Text)
roles :: (Prelude.Maybe (ValueList Prelude.Text)),
            -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html#cfn-iam-policy-users>
            Policy -> Maybe (ValueList Text)
users :: (Prelude.Maybe (ValueList Prelude.Text))}
  deriving stock (Policy -> Policy -> Bool
(Policy -> Policy -> Bool)
-> (Policy -> Policy -> Bool) -> Eq Policy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Policy -> Policy -> Bool
== :: Policy -> Policy -> Bool
$c/= :: Policy -> Policy -> Bool
/= :: Policy -> Policy -> Bool
Prelude.Eq, 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
$cshowsPrec :: Int -> Policy -> ShowS
showsPrec :: Int -> Policy -> ShowS
$cshow :: Policy -> String
show :: Policy -> String
$cshowList :: [Policy] -> ShowS
showList :: [Policy] -> ShowS
Prelude.Show)
mkPolicy :: JSON.Object -> Value Prelude.Text -> Policy
mkPolicy :: Object -> Value Text -> Policy
mkPolicy Object
policyDocument Value Text
policyName
  = Policy
      {haddock_workaround_ :: ()
haddock_workaround_ = (), policyDocument :: Object
policyDocument = Object
policyDocument,
       policyName :: Value Text
policyName = Value Text
policyName, groups :: Maybe (ValueList Text)
groups = Maybe (ValueList Text)
forall a. Maybe a
Prelude.Nothing,
       roles :: Maybe (ValueList Text)
roles = Maybe (ValueList Text)
forall a. Maybe a
Prelude.Nothing, users :: Maybe (ValueList Text)
users = Maybe (ValueList Text)
forall a. Maybe a
Prelude.Nothing}
instance ToResourceProperties Policy where
  toResourceProperties :: Policy -> ResourceProperties
toResourceProperties Policy {Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: Policy -> ()
groups :: Policy -> Maybe (ValueList Text)
policyDocument :: Policy -> Object
policyName :: Policy -> Value Text
roles :: Policy -> Maybe (ValueList Text)
users :: Policy -> Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..}
    = ResourceProperties
        {awsType :: Text
awsType = Text
"AWS::IAM::Policy", 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
"PolicyDocument" 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..= Object
policyDocument,
                            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]
                           ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
                              [Key -> ValueList Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Groups" (ValueList Text -> (Key, Value))
-> Maybe (ValueList Text) -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (ValueList Text)
groups,
                               Key -> ValueList Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Roles" (ValueList Text -> (Key, Value))
-> Maybe (ValueList Text) -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (ValueList Text)
roles,
                               Key -> ValueList Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Users" (ValueList Text -> (Key, Value))
-> Maybe (ValueList Text) -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (ValueList Text)
users]))}
instance JSON.ToJSON Policy where
  toJSON :: Policy -> Value
toJSON Policy {Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: Policy -> ()
groups :: Policy -> Maybe (ValueList Text)
policyDocument :: Policy -> Object
policyName :: Policy -> Value Text
roles :: Policy -> Maybe (ValueList Text)
users :: Policy -> Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList 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
"PolicyDocument" 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..= Object
policyDocument,
               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]
              ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
                 [Key -> ValueList Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Groups" (ValueList Text -> (Key, Value))
-> Maybe (ValueList Text) -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (ValueList Text)
groups,
                  Key -> ValueList Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Roles" (ValueList Text -> (Key, Value))
-> Maybe (ValueList Text) -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (ValueList Text)
roles,
                  Key -> ValueList Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Users" (ValueList Text -> (Key, Value))
-> Maybe (ValueList Text) -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (ValueList Text)
users])))
instance Property "Groups" Policy where
  type PropertyType "Groups" Policy = ValueList Prelude.Text
  set :: PropertyType "Groups" Policy -> Policy -> Policy
set PropertyType "Groups" Policy
newValue Policy {Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: Policy -> ()
groups :: Policy -> Maybe (ValueList Text)
policyDocument :: Policy -> Object
policyName :: Policy -> Value Text
roles :: Policy -> Maybe (ValueList Text)
users :: Policy -> Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..}
    = Policy {groups :: Maybe (ValueList Text)
groups = ValueList Text -> Maybe (ValueList Text)
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure PropertyType "Groups" Policy
ValueList Text
newValue, Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: ()
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
haddock_workaround_ :: ()
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..}
instance Property "PolicyDocument" Policy where
  type PropertyType "PolicyDocument" Policy = JSON.Object
  set :: PropertyType "PolicyDocument" Policy -> Policy -> Policy
set PropertyType "PolicyDocument" Policy
newValue Policy {Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: Policy -> ()
groups :: Policy -> Maybe (ValueList Text)
policyDocument :: Policy -> Object
policyName :: Policy -> Value Text
roles :: Policy -> Maybe (ValueList Text)
users :: Policy -> Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..} = Policy {policyDocument :: Object
policyDocument = Object
PropertyType "PolicyDocument" Policy
newValue, Maybe (ValueList Text)
()
Value Text
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..}
instance Property "PolicyName" Policy where
  type PropertyType "PolicyName" Policy = Value Prelude.Text
  set :: PropertyType "PolicyName" Policy -> Policy -> Policy
set PropertyType "PolicyName" Policy
newValue Policy {Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: Policy -> ()
groups :: Policy -> Maybe (ValueList Text)
policyDocument :: Policy -> Object
policyName :: Policy -> Value Text
roles :: Policy -> Maybe (ValueList Text)
users :: Policy -> Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..} = Policy {policyName :: Value Text
policyName = PropertyType "PolicyName" Policy
Value Text
newValue, Maybe (ValueList Text)
()
Object
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..}
instance Property "Roles" Policy where
  type PropertyType "Roles" Policy = ValueList Prelude.Text
  set :: PropertyType "Roles" Policy -> Policy -> Policy
set PropertyType "Roles" Policy
newValue Policy {Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: Policy -> ()
groups :: Policy -> Maybe (ValueList Text)
policyDocument :: Policy -> Object
policyName :: Policy -> Value Text
roles :: Policy -> Maybe (ValueList Text)
users :: Policy -> Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..}
    = Policy {roles :: Maybe (ValueList Text)
roles = ValueList Text -> Maybe (ValueList Text)
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure PropertyType "Roles" Policy
ValueList Text
newValue, Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
users :: Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
users :: Maybe (ValueList Text)
..}
instance Property "Users" Policy where
  type PropertyType "Users" Policy = ValueList Prelude.Text
  set :: PropertyType "Users" Policy -> Policy -> Policy
set PropertyType "Users" Policy
newValue Policy {Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: Policy -> ()
groups :: Policy -> Maybe (ValueList Text)
policyDocument :: Policy -> Object
policyName :: Policy -> Value Text
roles :: Policy -> Maybe (ValueList Text)
users :: Policy -> Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
users :: Maybe (ValueList Text)
..}
    = Policy {users :: Maybe (ValueList Text)
users = ValueList Text -> Maybe (ValueList Text)
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure PropertyType "Users" Policy
ValueList Text
newValue, Maybe (ValueList Text)
()
Object
Value Text
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
haddock_workaround_ :: ()
groups :: Maybe (ValueList Text)
policyDocument :: Object
policyName :: Value Text
roles :: Maybe (ValueList Text)
..}