@reventlessdev/rescript-pulumi-aws 2.4.0-alpha.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +366 -0
- package/LICENSE +202 -0
- package/README.md +19 -0
- package/package.json +52 -0
- package/rescript.json +27 -0
- package/scripts/bundle-resolvers.mjs +77 -0
- package/src/AWS/Aws_AvailabilityZone.res +9 -0
- package/src/AWS/Aws_AvailabilityZone.res.mjs +9 -0
- package/src/AWS/Aws_AvailabilityZone.resi +9 -0
- package/src/AWS/Aws_Aws.res +29 -0
- package/src/AWS/Aws_Aws.res.mjs +32 -0
- package/src/AWS/Aws_Common.res +2 -0
- package/src/AWS/Aws_Common.res.mjs +2 -0
- package/src/AWS/Aws_Provider.res +10 -0
- package/src/AWS/Aws_Provider.res.mjs +2 -0
- package/src/Acm/Acm.res +5 -0
- package/src/Acm/Acm.res.mjs +12 -0
- package/src/Acm/Acm_Certificate.res +27 -0
- package/src/Acm/Acm_Certificate.res.mjs +2 -0
- package/src/Acm/Acm_CertificateValidation.res +22 -0
- package/src/Acm/Acm_CertificateValidation.res.mjs +2 -0
- package/src/AppSync/AppSync.res +7 -0
- package/src/AppSync/AppSync.res.mjs +18 -0
- package/src/AppSync/AppSync_DataSource.res +93 -0
- package/src/AppSync/AppSync_DataSource.res.mjs +42 -0
- package/src/AppSync/AppSync_Function.res +75 -0
- package/src/AppSync/AppSync_Function.res.mjs +36 -0
- package/src/AppSync/AppSync_GraphQLApi.res +65 -0
- package/src/AppSync/AppSync_GraphQLApi.res.mjs +20 -0
- package/src/AppSync/AppSync_Resolver.res +229 -0
- package/src/AppSync/AppSync_Resolver.res.mjs +113 -0
- package/src/AppSync/AppSync_ResolverRuntime.res +214 -0
- package/src/AppSync/AppSync_ResolverRuntime.res.mjs +15 -0
- package/src/AppSync/AppSync_Resolver_Functions.res +998 -0
- package/src/AppSync/AppSync_Resolver_Functions.res.mjs +913 -0
- package/src/Aws.res +5 -0
- package/src/Aws.res.mjs +16 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_Api.res +92 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_Api.res.mjs +12 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_ChannelNamespace.res +81 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_ChannelNamespace.res.mjs +18 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_Resolver.res +39 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_Resolver.res.mjs +12 -0
- package/src/AwsNative/AwsNative.res +10 -0
- package/src/AwsNative/AwsNative.res.mjs +13 -0
- package/src/CloudFront/CloudFront.res +5 -0
- package/src/CloudFront/CloudFront.res.mjs +12 -0
- package/src/CloudFront/CloudFront_Distribution.res +81 -0
- package/src/CloudFront/CloudFront_Distribution.res.mjs +2 -0
- package/src/CloudFront/CloudFront_OriginAccessControl.res +20 -0
- package/src/CloudFront/CloudFront_OriginAccessControl.res.mjs +2 -0
- package/src/Cloudwatch/Cloudwatch.res +7 -0
- package/src/Cloudwatch/Cloudwatch.res.mjs +18 -0
- package/src/Cloudwatch/Cloudwatch_EventRule.res +52 -0
- package/src/Cloudwatch/Cloudwatch_EventRule.res.mjs +37 -0
- package/src/Cloudwatch/Cloudwatch_EventTarget.res +28 -0
- package/src/Cloudwatch/Cloudwatch_EventTarget.res.mjs +25 -0
- package/src/Cloudwatch/Cloudwatch_LogGroup.res +14 -0
- package/src/Cloudwatch/Cloudwatch_LogGroup.res.mjs +2 -0
- package/src/Cloudwatch/Cloudwatch_LogMetricFilter.res +28 -0
- package/src/Cloudwatch/Cloudwatch_LogMetricFilter.res.mjs +2 -0
- package/src/Cognito/Cognito.res +8 -0
- package/src/Cognito/Cognito.res.mjs +21 -0
- package/src/Cognito/Cognito_IdentityPool.res +148 -0
- package/src/Cognito/Cognito_IdentityPool.res.mjs +65 -0
- package/src/Cognito/Cognito_IdentityPoolRoleAttachment.res +18 -0
- package/src/Cognito/Cognito_IdentityPoolRoleAttachment.res.mjs +2 -0
- package/src/Cognito/Cognito_UserGroup.res +16 -0
- package/src/Cognito/Cognito_UserGroup.res.mjs +2 -0
- package/src/Cognito/Cognito_UserPool.res +125 -0
- package/src/Cognito/Cognito_UserPool.res.mjs +44 -0
- package/src/Cognito/Cognito_UserPoolClient.res +33 -0
- package/src/Cognito/Cognito_UserPoolClient.res.mjs +2 -0
- package/src/DynamoDb/DynamoDb.res +5 -0
- package/src/DynamoDb/DynamoDb.res.mjs +12 -0
- package/src/DynamoDb/DynamoDb_Stream.res +41 -0
- package/src/DynamoDb/DynamoDb_Stream.res.mjs +2 -0
- package/src/DynamoDb/DynamoDb_Table.res +66 -0
- package/src/DynamoDb/DynamoDb_Table.res.mjs +2 -0
- package/src/EC2/EC2.res +13 -0
- package/src/EC2/EC2.res.mjs +36 -0
- package/src/EC2/EC2_Common.res +13 -0
- package/src/EC2/EC2_Common.res.mjs +22 -0
- package/src/EC2/EC2_DefaultSecurityGroup.res +22 -0
- package/src/EC2/EC2_DefaultSecurityGroup.res.mjs +19 -0
- package/src/EC2/EC2_Eip.res +24 -0
- package/src/EC2/EC2_Eip.res.mjs +18 -0
- package/src/EC2/EC2_InternetGateway.res +25 -0
- package/src/EC2/EC2_InternetGateway.res.mjs +18 -0
- package/src/EC2/EC2_NatGateway.res +30 -0
- package/src/EC2/EC2_NatGateway.res.mjs +18 -0
- package/src/EC2/EC2_RouteTable.res +49 -0
- package/src/EC2/EC2_RouteTable.res.mjs +38 -0
- package/src/EC2/EC2_RouteTableAssociation.res +30 -0
- package/src/EC2/EC2_RouteTableAssociation.res.mjs +18 -0
- package/src/EC2/EC2_SecurityGroup.res +44 -0
- package/src/EC2/EC2_SecurityGroup.res.mjs +49 -0
- package/src/EC2/EC2_Subnet.res +31 -0
- package/src/EC2/EC2_Subnet.res.mjs +19 -0
- package/src/EC2/EC2_Vpc.res +25 -0
- package/src/EC2/EC2_Vpc.res.mjs +18 -0
- package/src/EC2/EC2_VpcEndpoint.res +43 -0
- package/src/EC2/EC2_VpcEndpoint.res.mjs +22 -0
- package/src/ECS/ECS.res +6 -0
- package/src/ECS/ECS.res.mjs +15 -0
- package/src/ECS/ECS_Cluster.res +10 -0
- package/src/ECS/ECS_Cluster.res.mjs +2 -0
- package/src/ECS/ECS_Container.res +58 -0
- package/src/ECS/ECS_Container.res.mjs +2 -0
- package/src/ECS/ECS_TaskDefinition.res +31 -0
- package/src/ECS/ECS_TaskDefinition.res.mjs +2 -0
- package/src/IAM/IAM.res +148 -0
- package/src/IAM/IAM.res.mjs +61 -0
- package/src/IAM/IAM_ManagedPolicies.res +32 -0
- package/src/IAM/IAM_ManagedPolicies.res.mjs +2 -0
- package/src/IAM/PolicyDocument.res +163 -0
- package/src/IAM/PolicyDocument.res.mjs +164 -0
- package/src/Kinesis/Kinesis.res +4 -0
- package/src/Kinesis/Kinesis.res.mjs +9 -0
- package/src/Kinesis/Kinesis_Stream.res +70 -0
- package/src/Kinesis/Kinesis_Stream.res.mjs +9 -0
- package/src/Lambda/EventSourceMapping.res +78 -0
- package/src/Lambda/EventSourceMapping.res.mjs +2 -0
- package/src/Lambda/FunctionUrl.res +41 -0
- package/src/Lambda/FunctionUrl.res.mjs +2 -0
- package/src/Lambda/Lambda.res +270 -0
- package/src/Lambda/Lambda.res.mjs +94 -0
- package/src/Route53/Route53.res +4 -0
- package/src/Route53/Route53.res.mjs +9 -0
- package/src/Route53/Route53_Record.res +36 -0
- package/src/Route53/Route53_Record.res.mjs +2 -0
- package/src/S3/S3.res +10 -0
- package/src/S3/S3.res.mjs +27 -0
- package/src/S3/S3_Bucket.res +236 -0
- package/src/S3/S3_Bucket.res.mjs +2 -0
- package/src/S3/S3_BucketAclV2.res +24 -0
- package/src/S3/S3_BucketAclV2.res.mjs +2 -0
- package/src/S3/S3_BucketObject.res +22 -0
- package/src/S3/S3_BucketObject.res.mjs +2 -0
- package/src/S3/S3_BucketOwnershipControls.res +19 -0
- package/src/S3/S3_BucketOwnershipControls.res.mjs +2 -0
- package/src/S3/S3_BucketPolicy.res +13 -0
- package/src/S3/S3_BucketPolicy.res.mjs +2 -0
- package/src/S3/S3_BucketPublicAccessBlock.res +16 -0
- package/src/S3/S3_BucketPublicAccessBlock.res.mjs +2 -0
- package/src/S3/S3_BucketV2.res +11 -0
- package/src/S3/S3_BucketV2.res.mjs +2 -0
- package/src/SES/SES.bs.js +11 -0
- package/src/SES/SES.res +25 -0
- package/src/SES/SES.res.mjs +12 -0
- package/src/SNS/SNS.res +5 -0
- package/src/SNS/SNS.res.mjs +12 -0
- package/src/SNS/SNS_Topic.res +71 -0
- package/src/SNS/SNS_Topic.res.mjs +2 -0
- package/src/SNS/SNS_TopicSubscription.res +21 -0
- package/src/SNS/SNS_TopicSubscription.res.mjs +2 -0
- package/src/SQS/SQS.res +5 -0
- package/src/SQS/SQS.res.mjs +12 -0
- package/src/SQS/SQS_Queue.res +92 -0
- package/src/SQS/SQS_Queue.res.mjs +19 -0
- package/src/SQS/SQS_QueuePolicy.res +13 -0
- package/src/SQS/SQS_QueuePolicy.res.mjs +2 -0
- package/src/SecretsManager/GetSecretVersion.res +37 -0
- package/src/SecretsManager/GetSecretVersion.res.mjs +23 -0
- package/src/example/CustomDomainExample.res +71 -0
- package/src/example/CustomDomainExample.res.mjs +57 -0
- package/tests/AppSync_Resolver_FunctionsTest.mjs +597 -0
- package/tests/__mocks__/appsync-utils.mjs +26 -0
- package/tests/resolverTestHelper.mjs +46 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @pulumi/aws/ecs/cluster
|
|
2
|
+
see: https://www.pulumi.com/registry/packages/aws/api-docs/ecs/cluster/
|
|
3
|
+
*/
|
|
4
|
+
type t = {arn: Pulumi.Output.t<string>, id: Pulumi.Output.t<string>}
|
|
5
|
+
|
|
6
|
+
type args = {name?: Pulumi.Input.t<string>}
|
|
7
|
+
|
|
8
|
+
@module("@pulumi/aws") @scope("ecs") @new
|
|
9
|
+
external make: (~name: string, ~args: args=?, ~opts: Pulumi.CustomResourceOptions.t=?) => t =
|
|
10
|
+
"Cluster"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
type protocol = | @as("tcp") TCP | @as("udp") UDP
|
|
2
|
+
type portMapping = {containerPort?: int, hostPort?: int, protocol?: protocol}
|
|
3
|
+
type keyValuePair = {name: string, value: string}
|
|
4
|
+
type repositoryCredentials = {credentialsParameter: string}
|
|
5
|
+
|
|
6
|
+
type secret = {
|
|
7
|
+
name: string,
|
|
8
|
+
/** secret to expose to the container. The supported values are either the full ARN of the
|
|
9
|
+
* AWS Secrets Manager secret or the full ARN of the parameter in the AWS Systems Manager
|
|
10
|
+
* Parameter Store */
|
|
11
|
+
valueFrom: string,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type logOptions = {
|
|
15
|
+
@as("awslogs-create-group") awslogsCreateGroup: bool,
|
|
16
|
+
@as("awslogs-group") awslogsGroup: string,
|
|
17
|
+
@as("awslogs-region") awslogsRegion: string,
|
|
18
|
+
@as("awslogs-stream-prefix") awslogsStreamPrefix: string,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type logConfiguration = {logDriver: string, options?: logOptions}
|
|
22
|
+
|
|
23
|
+
type ulimitName = [
|
|
24
|
+
| #core
|
|
25
|
+
| #cpu
|
|
26
|
+
| #data
|
|
27
|
+
| #fsize
|
|
28
|
+
| #locks
|
|
29
|
+
| #memlock
|
|
30
|
+
| #msgqueue
|
|
31
|
+
| #nice
|
|
32
|
+
| #nofile
|
|
33
|
+
| #nproc
|
|
34
|
+
| #rss
|
|
35
|
+
| #rtprio
|
|
36
|
+
| #rttime
|
|
37
|
+
| #sigpending
|
|
38
|
+
| #stack
|
|
39
|
+
]
|
|
40
|
+
type ulimit = {
|
|
41
|
+
name: ulimitName,
|
|
42
|
+
hardLimit: int,
|
|
43
|
+
softLimit: int,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type containerDefinition = {
|
|
47
|
+
name: string,
|
|
48
|
+
cpu?: int,
|
|
49
|
+
environment?: array<keyValuePair>,
|
|
50
|
+
essential?: bool,
|
|
51
|
+
image?: string,
|
|
52
|
+
logConfiguration?: logConfiguration,
|
|
53
|
+
memory?: int,
|
|
54
|
+
portMappings?: array<portMapping>,
|
|
55
|
+
repositoryCredentials?: repositoryCredentials,
|
|
56
|
+
secrets?: array<secret>,
|
|
57
|
+
ulimits?: array<ulimit>,
|
|
58
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @pulumi/aws/ecs/taskdefinition
|
|
2
|
+
see: https://www.pulumi.com/registry/packages/aws/api-docs/ecs/taskdefinition/
|
|
3
|
+
*/
|
|
4
|
+
type t = {
|
|
5
|
+
arn: Pulumi.Output.t<string>,
|
|
6
|
+
id: Pulumi.Output.t<string>,
|
|
7
|
+
revision: Pulumi.Output.t<int>,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type args = {
|
|
11
|
+
/** unique name for your task definition. */
|
|
12
|
+
family: Pulumi.Input.t<string>,
|
|
13
|
+
/** A list of valid container definitions provided as a single valid JSON document. */
|
|
14
|
+
containerDefinitions: Pulumi.Input.t<string>,
|
|
15
|
+
/** Number of cpu units used by the task. If the requires_compatibilities is FARGATE this field is required. */
|
|
16
|
+
cpu?: Pulumi.Input.t<string>,
|
|
17
|
+
/** Amount (in MiB) of memory used by the task. If the requires_compatibilities is FARGATE this field is required. */
|
|
18
|
+
memory?: Pulumi.Input.t<string>,
|
|
19
|
+
/** Docker networking mode to use for the containers in the task. */
|
|
20
|
+
networkMode?: [#none | #bridge | #awsvpc | #host],
|
|
21
|
+
/** Set of launch types required by the task. */
|
|
22
|
+
requiresCompatibilities?: array<string>, // TODO: narrow down type
|
|
23
|
+
/** ARN of the task execution role that the Amazon ECS container agent and the Docker daemon can assume. */
|
|
24
|
+
executionRoleArn?: Pulumi.Input.t<string>,
|
|
25
|
+
/** ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services. */
|
|
26
|
+
taskRoleArn?: Pulumi.Input.t<string>,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@module("@pulumi/aws") @scope("ecs") @new
|
|
30
|
+
external make: (~name: string, ~args: args, ~opts: Pulumi.CustomResourceOptions.t=?) => t =
|
|
31
|
+
"TaskDefinition"
|
package/src/IAM/IAM.res
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/** @pulumi/aws/iam
|
|
2
|
+
see: https://www.pulumi.com/registry/packages/aws/api-docs/iam/getpolicydocument
|
|
3
|
+
*/
|
|
4
|
+
type principal = {identifiers: array<string>, @as("type") type_: string}
|
|
5
|
+
|
|
6
|
+
type statement = {
|
|
7
|
+
actions: array<string>,
|
|
8
|
+
principals: array<principal>,
|
|
9
|
+
resources: array<string>,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
type args = {statements: array<statement>}
|
|
13
|
+
|
|
14
|
+
@val @module("@pulumi/aws") @scope("iam")
|
|
15
|
+
external getPolicyDocument: (
|
|
16
|
+
~args: args=?,
|
|
17
|
+
~opts: Pulumi.InvokeOptions.t=?,
|
|
18
|
+
) => promise<PolicyDocument.t> = "getPolicyDocument"
|
|
19
|
+
|
|
20
|
+
/** @pulumi/aws/iam
|
|
21
|
+
see: https://www.pulumi.com/registry/packages/aws/api-docs/iam/policy
|
|
22
|
+
*/
|
|
23
|
+
module Policy = {
|
|
24
|
+
type t = {arn: Pulumi.Output.t<Aws.arn>}
|
|
25
|
+
|
|
26
|
+
type args = {
|
|
27
|
+
policy: Pulumi.Input.t<string>,
|
|
28
|
+
description?: Pulumi.Input.t<string>,
|
|
29
|
+
name?: Pulumi.Input.t<string>,
|
|
30
|
+
namePrefix?: Pulumi.Input.t<string>,
|
|
31
|
+
path?: Pulumi.Input.t<string>,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@module("@pulumi/aws") @scope("iam") @new
|
|
35
|
+
external make: (~name: string, ~args: args, ~opts: Pulumi.CustomResourceOptions.t=?) => t =
|
|
36
|
+
"Policy"
|
|
37
|
+
|
|
38
|
+
let assumeRolePolicy = (name, serviceId) =>
|
|
39
|
+
PolicyDocument.make(
|
|
40
|
+
~id=name ++ "TrustPolicy",
|
|
41
|
+
~statements=[
|
|
42
|
+
{
|
|
43
|
+
sid: name->String.split("-")->Array.getUnsafe(0) ++ "TrustPolicyStatement",
|
|
44
|
+
principal: PolicyDocument.Principals({service: PrincipalId(serviceId)}),
|
|
45
|
+
effect: PolicyDocument.Allow,
|
|
46
|
+
actions: PolicyDocument.Action("sts:AssumeRole"),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
)->PolicyDocument.toJsonString
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module InlinePolicy = {
|
|
53
|
+
type t = {name: string, policy: string}
|
|
54
|
+
|
|
55
|
+
let makeForActions = (~name, ~actions) => {
|
|
56
|
+
{
|
|
57
|
+
name,
|
|
58
|
+
policy: PolicyDocument.make(
|
|
59
|
+
~statements=[
|
|
60
|
+
{
|
|
61
|
+
sid: "InlinePolicyAllow",
|
|
62
|
+
effect: PolicyDocument.Allow,
|
|
63
|
+
actions: PolicyDocument.Actions(actions),
|
|
64
|
+
resources: PolicyDocument.AllResources,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
)->PolicyDocument.toJsonString,
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
module Role = {
|
|
73
|
+
type t = {
|
|
74
|
+
arn: Pulumi.Output.t<string>,
|
|
75
|
+
name: Pulumi.Output.t<string>,
|
|
76
|
+
id: Pulumi.Output.t<string>,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
type args = {
|
|
80
|
+
name?: Pulumi.Input.t<string>,
|
|
81
|
+
assumeRolePolicy: Pulumi.Input.t<string>,
|
|
82
|
+
inlinePolicies?: Pulumi.Input.t<array<InlinePolicy.t>>, //deprecated
|
|
83
|
+
tags?: Pulumi.Input.t<Aws.tags>,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@module("@pulumi/aws") @scope("iam") @new
|
|
87
|
+
external make: (
|
|
88
|
+
~name: string,
|
|
89
|
+
~args: args=?,
|
|
90
|
+
~opts: option<Pulumi.CustomResourceOptions.t>=?,
|
|
91
|
+
) => t = "Role"
|
|
92
|
+
|
|
93
|
+
let makeWithDefaultPolicy = (
|
|
94
|
+
~name: string,
|
|
95
|
+
~servicePrincipal: Pulumi.Output.t<string>,
|
|
96
|
+
~opts: option<Pulumi.CustomResourceOptions.t>=?,
|
|
97
|
+
) =>
|
|
98
|
+
make(
|
|
99
|
+
~name,
|
|
100
|
+
~args={
|
|
101
|
+
assumeRolePolicy: servicePrincipal
|
|
102
|
+
->Pulumi.Output.apply(principal => Policy.assumeRolePolicy(name, principal))
|
|
103
|
+
->Pulumi.Output.asInput,
|
|
104
|
+
},
|
|
105
|
+
~opts,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
@module("@pulumi/aws") @scope(("iam", "Role"))
|
|
109
|
+
external get: (
|
|
110
|
+
~name: string,
|
|
111
|
+
~id: Pulumi.Input.t<string>,
|
|
112
|
+
~opts: Pulumi.CustomResourceOptions.t=?,
|
|
113
|
+
) => t = "get"
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module RolePolicy = {
|
|
117
|
+
type t = {
|
|
118
|
+
arn: Pulumi.Output.t<string>,
|
|
119
|
+
name: Pulumi.Output.t<string>,
|
|
120
|
+
id: Pulumi.Output.t<string>,
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
type args = {
|
|
124
|
+
name?: Pulumi.Input.t<string>,
|
|
125
|
+
policy: Pulumi.Input.t<string>,
|
|
126
|
+
role: Pulumi.Input.t<string>,
|
|
127
|
+
tags?: Pulumi.Input.t<Aws.tags>,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@module("@pulumi/aws") @scope("iam") @new
|
|
131
|
+
external make: (~name: string, ~args: args=?, ~opts: Pulumi.CustomResourceOptions.t=?) => t =
|
|
132
|
+
"RolePolicy"
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
module RolePolicyAttachment = {
|
|
136
|
+
type t = {id: Pulumi.Output.t<string>}
|
|
137
|
+
|
|
138
|
+
type args = {policyArn: Pulumi.Input.t<string>, role: Pulumi.Input.t<string>}
|
|
139
|
+
|
|
140
|
+
@module("@pulumi/aws") @scope("iam") @new
|
|
141
|
+
external make: (
|
|
142
|
+
~name: string,
|
|
143
|
+
~args: args=?,
|
|
144
|
+
~opts: option<Pulumi.CustomResourceOptions.t>,
|
|
145
|
+
) => t = "RolePolicyAttachment"
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
module ManagedPolicies = IAM_ManagedPolicies
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Aws from "@pulumi/aws";
|
|
4
|
+
import * as PolicyDocument$PulumiAws from "./PolicyDocument.res.mjs";
|
|
5
|
+
|
|
6
|
+
function assumeRolePolicy(name, serviceId) {
|
|
7
|
+
return PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, name + "TrustPolicy", [{
|
|
8
|
+
Sid: name.split("-")[0] + "TrustPolicyStatement",
|
|
9
|
+
Principal: {
|
|
10
|
+
Service: serviceId
|
|
11
|
+
},
|
|
12
|
+
Effect: "Allow",
|
|
13
|
+
Action: "sts:AssumeRole"
|
|
14
|
+
}]));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let Policy = {
|
|
18
|
+
assumeRolePolicy: assumeRolePolicy
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function makeForActions(name, actions) {
|
|
22
|
+
return {
|
|
23
|
+
name: name,
|
|
24
|
+
policy: PolicyDocument$PulumiAws.toJsonString(PolicyDocument$PulumiAws.make(undefined, undefined, [{
|
|
25
|
+
Sid: "InlinePolicyAllow",
|
|
26
|
+
Effect: "Allow",
|
|
27
|
+
Action: actions,
|
|
28
|
+
Resource: "*"
|
|
29
|
+
}]))
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let InlinePolicy = {
|
|
34
|
+
makeForActions: makeForActions
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
function makeWithDefaultPolicy(name, servicePrincipal, opts) {
|
|
38
|
+
return new (Aws.iam.Role)(name, {
|
|
39
|
+
assumeRolePolicy: servicePrincipal.apply(principal => assumeRolePolicy(name, principal))
|
|
40
|
+
}, opts);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
let Role = {
|
|
44
|
+
makeWithDefaultPolicy: makeWithDefaultPolicy
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
let RolePolicy = {};
|
|
48
|
+
|
|
49
|
+
let RolePolicyAttachment = {};
|
|
50
|
+
|
|
51
|
+
let ManagedPolicies;
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
Policy,
|
|
55
|
+
InlinePolicy,
|
|
56
|
+
Role,
|
|
57
|
+
RolePolicy,
|
|
58
|
+
RolePolicyAttachment,
|
|
59
|
+
ManagedPolicies,
|
|
60
|
+
}
|
|
61
|
+
/* @pulumi/aws Not a pure module */
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
2
|
+
external lambdaFullAccess: string = "LambdaFullAccess"
|
|
3
|
+
|
|
4
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
5
|
+
external cognitoPowerUser: string = "AmazonCognitoPowerUser"
|
|
6
|
+
|
|
7
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
8
|
+
external dynamoDBFullAccess: string = "AmazonDynamoDBFullAccess"
|
|
9
|
+
|
|
10
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
11
|
+
external iamFullAccess: string = "IAMFullAccess"
|
|
12
|
+
|
|
13
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
14
|
+
external s3FullAccess: string = "AmazonS3FullAccess"
|
|
15
|
+
|
|
16
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
17
|
+
external snsFullAccess: string = "AmazonSNSFullAccess"
|
|
18
|
+
|
|
19
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
20
|
+
external sqsFullAccess: string = "AmazonSQSFullAccess"
|
|
21
|
+
|
|
22
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
23
|
+
external xrayFullAccess: string = "AWSXrayFullAccess"
|
|
24
|
+
|
|
25
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
26
|
+
external cloudWatchFullAccess: string = "CloudWatchFullAccess"
|
|
27
|
+
|
|
28
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
29
|
+
external cloudWatchEventsFullAccess: string = "CloudWatchEventsFullAccess"
|
|
30
|
+
|
|
31
|
+
@val @module("@pulumi/aws/iam") @scope("ManagedPolicy")
|
|
32
|
+
external lambdaVPCAccessExecutionRole: string = "AWSLambdaVPCAccessExecutionRole"
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_grammar.html
|
|
3
|
+
*/
|
|
4
|
+
@schema
|
|
5
|
+
type version = | @as("2008-10-17") Version2008 | @as("2012-10-17") Version2012
|
|
6
|
+
|
|
7
|
+
@schema
|
|
8
|
+
type effect = Allow | Deny
|
|
9
|
+
|
|
10
|
+
@schema @unboxed type principalEntry = PrincipalId(string) | PrincipalIds(array<string>)
|
|
11
|
+
@schema
|
|
12
|
+
type principal = {
|
|
13
|
+
@as("AWS") aws?: principalEntry,
|
|
14
|
+
@as("Federated") federated?: principalEntry,
|
|
15
|
+
@as("Service") service?: principalEntry,
|
|
16
|
+
@as("CanonicalUser") canonicalUser?: principalEntry,
|
|
17
|
+
}
|
|
18
|
+
@schema @unboxed type principals = | @as("*") AllPrincipals | Principals(principal)
|
|
19
|
+
|
|
20
|
+
@schema @unboxed
|
|
21
|
+
type actions = | @as("*") AllActions | Action(string) | Actions(array<string>)
|
|
22
|
+
|
|
23
|
+
@schema @unboxed
|
|
24
|
+
type resources =
|
|
25
|
+
| @as("*") AllResources
|
|
26
|
+
| Resource(string)
|
|
27
|
+
| Resources(array<string>)
|
|
28
|
+
|
|
29
|
+
//TODO allow entry like: "key": "singleValue"
|
|
30
|
+
@schema @unboxed
|
|
31
|
+
type conditionEntry = ConditionValue(string) | ConditionValues(array<string>)
|
|
32
|
+
@schema
|
|
33
|
+
type conditionMap = dict<conditionEntry>
|
|
34
|
+
/**
|
|
35
|
+
https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html#Conditions_Numeric
|
|
36
|
+
*/
|
|
37
|
+
@schema
|
|
38
|
+
type condition = {
|
|
39
|
+
//String condition operators
|
|
40
|
+
@as("StringEquals") stringEquals?: conditionMap,
|
|
41
|
+
@as("StringNotEquals") stringNotEquals?: conditionMap,
|
|
42
|
+
@as("StringEqualsIgnoreCase") stringEqualsIgnoreCase?: conditionMap,
|
|
43
|
+
@as("StringNotEqualsIgnoreCase") stringNotEqualsIgnoreCase?: conditionMap,
|
|
44
|
+
@as("StringLike") stringLike?: conditionMap,
|
|
45
|
+
@as("StringNotLike") stringNotLike?: conditionMap,
|
|
46
|
+
//Numeric condition operators
|
|
47
|
+
@as("NumericEquals") numericEquals?: conditionMap,
|
|
48
|
+
@as("NumericNotEquals") numericNotEquals?: conditionMap,
|
|
49
|
+
@as("NumericLessThan") numericLessThan?: conditionMap,
|
|
50
|
+
@as("NumericLessThanEquals") numericLessThanEquals?: conditionMap,
|
|
51
|
+
@as("NumericGreaterThan") numericGreaterThan?: conditionMap,
|
|
52
|
+
@as("NumericGreaterThanEquals") numericGreaterThanEquals?: conditionMap,
|
|
53
|
+
//Date condition operators
|
|
54
|
+
@as("DateEquals") dateEquals?: conditionMap,
|
|
55
|
+
@as("DateNotEquals") dateNotEquals?: conditionMap,
|
|
56
|
+
@as("DateLessThan") dateLessThan?: conditionMap,
|
|
57
|
+
@as("DateLessThanEquals") dateThanEquals?: conditionMap,
|
|
58
|
+
@as("DateGreaterThan") dateGreaterThan?: conditionMap,
|
|
59
|
+
@as("DateGreaterThanEquals") dateGreaterThanEquals?: conditionMap,
|
|
60
|
+
//Boolean condition operators
|
|
61
|
+
@as("Bool") boolean?: conditionMap,
|
|
62
|
+
//Binary condition operators
|
|
63
|
+
@as("Binary") binary?: conditionMap,
|
|
64
|
+
//ARN condition operators
|
|
65
|
+
@as("ArnEquals") arnEquals?: conditionMap,
|
|
66
|
+
@as("ArnLike") arnLike?: conditionMap,
|
|
67
|
+
@as("ArnNotEquals") arnNotEquals?: conditionMap,
|
|
68
|
+
@as("ArnNotLike") arnNotLike?: conditionMap,
|
|
69
|
+
//If Exists operators
|
|
70
|
+
//String condition operators
|
|
71
|
+
@as("StringEqualsIfExists") stringEqualsIfExists?: conditionMap,
|
|
72
|
+
@as("StringNotEqualsIfExists") stringNotEqualsIfExists?: conditionMap,
|
|
73
|
+
@as("StringEqualsIgnoreCaseIfExists") stringEqualsIgnoreCaseIfExists?: conditionMap,
|
|
74
|
+
@as("StringNotEqualsIgnoreCaseIfExists") stringNotEqualsIgnoreCaseIfExists?: conditionMap,
|
|
75
|
+
@as("StringLikeIfExists") stringLikeIfExists?: conditionMap,
|
|
76
|
+
@as("StringNotLikeIfExists") stringNotLikeIfExists?: conditionMap,
|
|
77
|
+
//Numeric condition operators
|
|
78
|
+
@as("NumericEqualsIfExists") numericEqualsIfExists?: conditionMap,
|
|
79
|
+
@as("NumericNotEqualsIfExists") numericNotEqualsIfExists?: conditionMap,
|
|
80
|
+
@as("NumericLessThanIfExists") numericLessThanIfExists?: conditionMap,
|
|
81
|
+
@as("NumericLessThanEqualsIfExists") numericLessThanEqualsIfExists?: conditionMap,
|
|
82
|
+
@as("NumericGreaterThanIfExists") numericGreaterThanIfExists?: conditionMap,
|
|
83
|
+
@as("NumericGreaterThanEqualsIfExists") numericGreaterThanEqualsIfExists?: conditionMap,
|
|
84
|
+
//Date condition operators
|
|
85
|
+
@as("DateEqualsIfExists") dateEqualsIfExists?: conditionMap,
|
|
86
|
+
@as("DateNotEqualsIfExists") dateNotEqualsIfExists?: conditionMap,
|
|
87
|
+
@as("DateLessThanIfExists") dateLessThanIfExists?: conditionMap,
|
|
88
|
+
@as("DateLessThanEqualsIfExists") dateThanEqualsIfExists?: conditionMap,
|
|
89
|
+
@as("DateGreaterThanIfExists") dateGreaterThanIfExists?: conditionMap,
|
|
90
|
+
@as("DateGreaterThanEqualsIfExists") dateGreaterThanEqualsIfExists?: conditionMap,
|
|
91
|
+
//Boolean condition operators
|
|
92
|
+
@as("BoolIfExists") booleanIfExists?: conditionMap,
|
|
93
|
+
//Binary condition operators
|
|
94
|
+
@as("BinaryIfExists") binaryIfExists?: conditionMap,
|
|
95
|
+
//ARN condition operators
|
|
96
|
+
@as("ArnEqualsIfExists") arnEqualsIfExists?: conditionMap,
|
|
97
|
+
@as("ArnLikeIfExists") arnLikeIfExists?: conditionMap,
|
|
98
|
+
@as("ArnNotEqualsIfExists") arnNotEqualsIfExists?: conditionMap,
|
|
99
|
+
@as("ArnNotLikeIfExists") arnNotLikeIfExists?: conditionMap,
|
|
100
|
+
//Existence check operator
|
|
101
|
+
@as("Null") null?: conditionMap,
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@schema
|
|
105
|
+
type statement = {
|
|
106
|
+
@as("Sid") sid?: string,
|
|
107
|
+
@as("Principal") principal?: principals,
|
|
108
|
+
@as("NotPrincipal") notPrincipal?: principals,
|
|
109
|
+
@as("Effect") effect: effect,
|
|
110
|
+
@as("Action") actions?: actions,
|
|
111
|
+
@as("NotAction") notAction?: actions,
|
|
112
|
+
@as("Resource") resources?: resources,
|
|
113
|
+
@as("NotResource") notResource?: resources,
|
|
114
|
+
@as("Condition") conditions?: condition,
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@schema
|
|
118
|
+
type policy = {
|
|
119
|
+
@as("Version") version: version,
|
|
120
|
+
@as("Id") id?: string,
|
|
121
|
+
@as("Statement") statements: array<statement>, //TODO add single statement support
|
|
122
|
+
}
|
|
123
|
+
type t = policy
|
|
124
|
+
|
|
125
|
+
let toJsonString: t => string = t => {
|
|
126
|
+
t
|
|
127
|
+
->S.reverseConvertToJsonOrThrow(policySchema)
|
|
128
|
+
->JSON.stringify(~space=1)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let fromJsonString: string => t = (policyString: string) =>
|
|
132
|
+
policyString->S.parseJsonStringOrThrow(policySchema)
|
|
133
|
+
|
|
134
|
+
let make = (~version=Version2012, ~id=?, ~statements) => {
|
|
135
|
+
version,
|
|
136
|
+
?id,
|
|
137
|
+
statements,
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
type mergeArgs = {
|
|
141
|
+
sourcePolicyDocuments: Pulumi.Input.t<array<Pulumi.Input.t<string>>>,
|
|
142
|
+
policyId: string,
|
|
143
|
+
}
|
|
144
|
+
type mergeResult = {json: string}
|
|
145
|
+
|
|
146
|
+
@module("@pulumi/aws") @scope("iam")
|
|
147
|
+
external merge: (~args: mergeArgs) => Pulumi.Output.t<mergeResult> = "getPolicyDocumentOutput"
|
|
148
|
+
|
|
149
|
+
let mergePolicyDocuments: (string, array<t>) => Pulumi.Output.t<string> = (
|
|
150
|
+
policyId,
|
|
151
|
+
policyDocuments,
|
|
152
|
+
) => {
|
|
153
|
+
merge(
|
|
154
|
+
~args={
|
|
155
|
+
sourcePolicyDocuments: policyDocuments
|
|
156
|
+
->Array.map(policyDocument => policyDocument->toJsonString->Pulumi.Input.make)
|
|
157
|
+
->Pulumi.Input.make,
|
|
158
|
+
policyId,
|
|
159
|
+
},
|
|
160
|
+
)->Pulumi.Output.apply(policyDocument => {
|
|
161
|
+
policyDocument.json
|
|
162
|
+
})
|
|
163
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as S from "sury/src/S.res.mjs";
|
|
4
|
+
import * as Aws from "@pulumi/aws";
|
|
5
|
+
|
|
6
|
+
let versionSchema = S.union([
|
|
7
|
+
S.literal("2008-10-17"),
|
|
8
|
+
S.literal("2012-10-17")
|
|
9
|
+
]);
|
|
10
|
+
|
|
11
|
+
let effectSchema = S.union([
|
|
12
|
+
S.literal("Allow"),
|
|
13
|
+
S.literal("Deny")
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
let principalEntrySchema = S.union([
|
|
17
|
+
S.schema(s => (s.m(S.string))),
|
|
18
|
+
S.schema(s => (s.m(S.array(S.string))))
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
let principalSchema = S.schema(s => ({
|
|
22
|
+
AWS: s.m(S.option(principalEntrySchema)),
|
|
23
|
+
Federated: s.m(S.option(principalEntrySchema)),
|
|
24
|
+
Service: s.m(S.option(principalEntrySchema)),
|
|
25
|
+
CanonicalUser: s.m(S.option(principalEntrySchema))
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
let principalsSchema = S.union([
|
|
29
|
+
S.literal("*"),
|
|
30
|
+
S.schema(s => (s.m(principalSchema)))
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
let actionsSchema = S.union([
|
|
34
|
+
S.literal("*"),
|
|
35
|
+
S.schema(s => (s.m(S.string))),
|
|
36
|
+
S.schema(s => (s.m(S.array(S.string))))
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
let resourcesSchema = S.union([
|
|
40
|
+
S.literal("*"),
|
|
41
|
+
S.schema(s => (s.m(S.string))),
|
|
42
|
+
S.schema(s => (s.m(S.array(S.string))))
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
let conditionEntrySchema = S.union([
|
|
46
|
+
S.schema(s => (s.m(S.string))),
|
|
47
|
+
S.schema(s => (s.m(S.array(S.string))))
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
let conditionMapSchema = S.dict(conditionEntrySchema);
|
|
51
|
+
|
|
52
|
+
let conditionSchema = S.schema(s => ({
|
|
53
|
+
StringEquals: s.m(S.option(conditionMapSchema)),
|
|
54
|
+
StringNotEquals: s.m(S.option(conditionMapSchema)),
|
|
55
|
+
StringEqualsIgnoreCase: s.m(S.option(conditionMapSchema)),
|
|
56
|
+
StringNotEqualsIgnoreCase: s.m(S.option(conditionMapSchema)),
|
|
57
|
+
StringLike: s.m(S.option(conditionMapSchema)),
|
|
58
|
+
StringNotLike: s.m(S.option(conditionMapSchema)),
|
|
59
|
+
NumericEquals: s.m(S.option(conditionMapSchema)),
|
|
60
|
+
NumericNotEquals: s.m(S.option(conditionMapSchema)),
|
|
61
|
+
NumericLessThan: s.m(S.option(conditionMapSchema)),
|
|
62
|
+
NumericLessThanEquals: s.m(S.option(conditionMapSchema)),
|
|
63
|
+
NumericGreaterThan: s.m(S.option(conditionMapSchema)),
|
|
64
|
+
NumericGreaterThanEquals: s.m(S.option(conditionMapSchema)),
|
|
65
|
+
DateEquals: s.m(S.option(conditionMapSchema)),
|
|
66
|
+
DateNotEquals: s.m(S.option(conditionMapSchema)),
|
|
67
|
+
DateLessThan: s.m(S.option(conditionMapSchema)),
|
|
68
|
+
DateLessThanEquals: s.m(S.option(conditionMapSchema)),
|
|
69
|
+
DateGreaterThan: s.m(S.option(conditionMapSchema)),
|
|
70
|
+
DateGreaterThanEquals: s.m(S.option(conditionMapSchema)),
|
|
71
|
+
Bool: s.m(S.option(conditionMapSchema)),
|
|
72
|
+
Binary: s.m(S.option(conditionMapSchema)),
|
|
73
|
+
ArnEquals: s.m(S.option(conditionMapSchema)),
|
|
74
|
+
ArnLike: s.m(S.option(conditionMapSchema)),
|
|
75
|
+
ArnNotEquals: s.m(S.option(conditionMapSchema)),
|
|
76
|
+
ArnNotLike: s.m(S.option(conditionMapSchema)),
|
|
77
|
+
StringEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
78
|
+
StringNotEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
79
|
+
StringEqualsIgnoreCaseIfExists: s.m(S.option(conditionMapSchema)),
|
|
80
|
+
StringNotEqualsIgnoreCaseIfExists: s.m(S.option(conditionMapSchema)),
|
|
81
|
+
StringLikeIfExists: s.m(S.option(conditionMapSchema)),
|
|
82
|
+
StringNotLikeIfExists: s.m(S.option(conditionMapSchema)),
|
|
83
|
+
NumericEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
84
|
+
NumericNotEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
85
|
+
NumericLessThanIfExists: s.m(S.option(conditionMapSchema)),
|
|
86
|
+
NumericLessThanEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
87
|
+
NumericGreaterThanIfExists: s.m(S.option(conditionMapSchema)),
|
|
88
|
+
NumericGreaterThanEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
89
|
+
DateEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
90
|
+
DateNotEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
91
|
+
DateLessThanIfExists: s.m(S.option(conditionMapSchema)),
|
|
92
|
+
DateLessThanEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
93
|
+
DateGreaterThanIfExists: s.m(S.option(conditionMapSchema)),
|
|
94
|
+
DateGreaterThanEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
95
|
+
BoolIfExists: s.m(S.option(conditionMapSchema)),
|
|
96
|
+
BinaryIfExists: s.m(S.option(conditionMapSchema)),
|
|
97
|
+
ArnEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
98
|
+
ArnLikeIfExists: s.m(S.option(conditionMapSchema)),
|
|
99
|
+
ArnNotEqualsIfExists: s.m(S.option(conditionMapSchema)),
|
|
100
|
+
ArnNotLikeIfExists: s.m(S.option(conditionMapSchema)),
|
|
101
|
+
Null: s.m(S.option(conditionMapSchema))
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
let statementSchema = S.schema(s => ({
|
|
105
|
+
Sid: s.m(S.option(S.string)),
|
|
106
|
+
Principal: s.m(S.option(principalsSchema)),
|
|
107
|
+
NotPrincipal: s.m(S.option(principalsSchema)),
|
|
108
|
+
Effect: s.m(effectSchema),
|
|
109
|
+
Action: s.m(S.option(actionsSchema)),
|
|
110
|
+
NotAction: s.m(S.option(actionsSchema)),
|
|
111
|
+
Resource: s.m(S.option(resourcesSchema)),
|
|
112
|
+
NotResource: s.m(S.option(resourcesSchema)),
|
|
113
|
+
Condition: s.m(S.option(conditionSchema))
|
|
114
|
+
}));
|
|
115
|
+
|
|
116
|
+
let policySchema = S.schema(s => ({
|
|
117
|
+
Version: s.m(versionSchema),
|
|
118
|
+
Id: s.m(S.option(S.string)),
|
|
119
|
+
Statement: s.m(S.array(statementSchema))
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
function toJsonString(t) {
|
|
123
|
+
return JSON.stringify(S.reverseConvertToJsonOrThrow(t, policySchema), undefined, 1);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function fromJsonString(policyString) {
|
|
127
|
+
return S.parseJsonStringOrThrow(policyString, policySchema);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function make(versionOpt, id, statements) {
|
|
131
|
+
let version = versionOpt !== undefined ? versionOpt : "2012-10-17";
|
|
132
|
+
return {
|
|
133
|
+
Version: version,
|
|
134
|
+
Id: id,
|
|
135
|
+
Statement: statements
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function mergePolicyDocuments(policyId, policyDocuments) {
|
|
140
|
+
return Aws.iam.getPolicyDocumentOutput({
|
|
141
|
+
sourcePolicyDocuments: policyDocuments.map(toJsonString),
|
|
142
|
+
policyId: policyId
|
|
143
|
+
}).apply(policyDocument => policyDocument.json);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
versionSchema,
|
|
148
|
+
effectSchema,
|
|
149
|
+
principalEntrySchema,
|
|
150
|
+
principalSchema,
|
|
151
|
+
principalsSchema,
|
|
152
|
+
actionsSchema,
|
|
153
|
+
resourcesSchema,
|
|
154
|
+
conditionEntrySchema,
|
|
155
|
+
conditionMapSchema,
|
|
156
|
+
conditionSchema,
|
|
157
|
+
statementSchema,
|
|
158
|
+
policySchema,
|
|
159
|
+
toJsonString,
|
|
160
|
+
fromJsonString,
|
|
161
|
+
make,
|
|
162
|
+
mergePolicyDocuments,
|
|
163
|
+
}
|
|
164
|
+
/* versionSchema Not a pure module */
|