@kensio/yulin 1.20.11 → 1.20.13

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.
Files changed (150) hide show
  1. package/dist/service/acm/command/delete-certificate/delete-certificate-authorizer.js +1 -0
  2. package/dist/service/acm/command/describe-certificate/describe-certificate-authorizer.js +1 -0
  3. package/dist/service/acm/command/list-certificates/list-certificates-authorizer.js +1 -0
  4. package/dist/service/acm/command/request-certificate/request-certificate-authorizer.js +1 -0
  5. package/dist/service/apigateway/serve/auth/sim-rest-api-authorizer-policy.js +3 -0
  6. package/dist/service/apigatewayv2/serve/auth/sim-http-api-authorizer-policy.js +3 -0
  7. package/dist/service/athena/engine/sim-athena-regexp-flags.d.ts +22 -0
  8. package/dist/service/athena/engine/sim-athena-regexp-flags.js +34 -0
  9. package/dist/service/athena/engine/sim-athena-regexp-shims.js +3 -1
  10. package/dist/service/athena/engine/sim-athena-url-parts.d.ts +24 -0
  11. package/dist/service/athena/engine/sim-athena-url-parts.js +76 -0
  12. package/dist/service/athena/engine/sim-athena-url-shims.d.ts +3 -2
  13. package/dist/service/athena/engine/sim-athena-url-shims.js +57 -25
  14. package/dist/service/athena/table/sim-athena-negated-columns.d.ts +17 -0
  15. package/dist/service/athena/table/sim-athena-negated-columns.js +80 -0
  16. package/dist/service/athena/table/sim-athena-partition-filters.d.ts +7 -4
  17. package/dist/service/athena/table/sim-athena-partition-filters.js +12 -5
  18. package/dist/service/aws/factory/sim-aws-account-service-cache.d.ts +3 -0
  19. package/dist/service/aws/factory/sim-aws-account-service-cache.js +5 -0
  20. package/dist/service/aws/factory/sim-aws-service-factory.d.ts +9 -0
  21. package/dist/service/aws/factory/sim-aws-service-factory.js +10 -0
  22. package/dist/service/aws/sim-aws.d.ts +18 -0
  23. package/dist/service/aws/sim-aws.js +19 -0
  24. package/dist/service/cloudformation/resource/cfn/organizations/sim-organizations-cfn-value-adapter.d.ts +6 -0
  25. package/dist/service/cloudformation/resource/cfn/organizations/sim-organizations-cfn-value-adapter.js +23 -0
  26. package/dist/service/cloudformation/resource/cfn/organizations/sim-organizations-cfn.d.ts +66 -0
  27. package/dist/service/cloudformation/resource/cfn/organizations/sim-organizations-cfn.js +136 -0
  28. package/dist/service/cloudformation/resource/cfn/sim-cfn-service-value-adapters.js +2 -0
  29. package/dist/service/cloudformation/resource/resolve/service/sim-cfn-service-factories.js +7 -0
  30. package/dist/service/cloudfront/command/create-distribution/create-distribution-authorizer.js +1 -0
  31. package/dist/service/cloudfront/command/create-function/create-function-authorizer.js +1 -0
  32. package/dist/service/cloudfront/command/delete-distribution/delete-distribution-authorizer.js +1 -0
  33. package/dist/service/cloudfront/command/delete-function/delete-function-authorizer.js +1 -0
  34. package/dist/service/cloudfront/command/get-distribution/get-distribution-authorizer.js +1 -0
  35. package/dist/service/cloudfront/command/update-distribution/update-distribution-authorizer.js +1 -0
  36. package/dist/service/cloudfront/edge/sim-cf-edge-association-auth-z.js +1 -0
  37. package/dist/service/cloudfront/key-value-store/sim-cf-key-value-store-access.js +1 -0
  38. package/dist/service/cloudwatch/command/authorize/sim-cloudwatch-decide.js +1 -0
  39. package/dist/service/cognito/command/authorize/sim-cognito-authorizer.js +1 -0
  40. package/dist/service/dynamodb/command/authorize/sim-dynamodb-authorizer.js +1 -0
  41. package/dist/service/firehose/command/authorize/sim-firehose-authorizer.js +1 -0
  42. package/dist/service/glue/command/authorize/sim-glue-authorize-resources.js +1 -0
  43. package/dist/service/iam/authorize/allow/sim-iam-policy-evaluation.d.ts +45 -0
  44. package/dist/service/iam/authorize/allow/sim-iam-policy-evaluation.js +59 -0
  45. package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.d.ts +15 -4
  46. package/dist/service/iam/authorize/context/sim-iam-auth-z-context-builder.js +15 -4
  47. package/dist/service/iam/authorize/context/sim-iam-auth-z-context.d.ts +31 -1
  48. package/dist/service/iam/authorize/context/sim-iam-auth-z-context.factory.js +1 -0
  49. package/dist/service/iam/authorize/context/sim-iam-auth-z-scp-source-builder.d.ts +46 -0
  50. package/dist/service/iam/authorize/context/sim-iam-auth-z-scp-source-builder.js +71 -0
  51. package/dist/service/iam/authorize/scp/sim-iam-scp-gate.d.ts +96 -0
  52. package/dist/service/iam/authorize/scp/sim-iam-scp-gate.js +148 -0
  53. package/dist/service/iam/authorize/scp/sim-iam-scp-resolver.d.ts +53 -0
  54. package/dist/service/iam/authorize/scp/sim-iam-scp-resolver.js +1 -0
  55. package/dist/service/iam/authorize/sim-iam-account-auth-z.d.ts +8 -0
  56. package/dist/service/iam/authorize/sim-iam-account-auth-z.js +1 -0
  57. package/dist/service/iam/authorize/sim-iam-action-authorizer.js +1 -0
  58. package/dist/service/iam/authorize/sim-iam-authorizer.d.ts +2 -0
  59. package/dist/service/iam/authorize/sim-iam-authorizer.js +1 -0
  60. package/dist/service/iam/authorize/sim-iam-decision-value.d.ts +13 -0
  61. package/dist/service/iam/authorize/sim-iam-decision-value.js +12 -0
  62. package/dist/service/iam/authorize/sim-iam-decision.d.ts +33 -16
  63. package/dist/service/iam/authorize/sim-iam-decision.js +64 -49
  64. package/dist/service/iam/authorize/sim-iam-inter-service-auth-z.d.ts +8 -0
  65. package/dist/service/iam/authorize/sim-iam-inter-service-auth-z.js +1 -0
  66. package/dist/service/iam/error/sim-iam.error.d.ts +8 -0
  67. package/dist/service/iam/error/sim-iam.error.js +2 -1
  68. package/dist/service/iam/sim-iam-account-parts.d.ts +9 -0
  69. package/dist/service/iam/sim-iam-account-parts.js +1 -0
  70. package/dist/service/kinesis/command/authorize/sim-kinesis-authorizer.js +1 -0
  71. package/dist/service/kms/command/authorize/sim-kms-authorizer.js +2 -0
  72. package/dist/service/lambda/command/create-function/create-function-authorizer.js +1 -0
  73. package/dist/service/lambda/command/delete-function/delete-function-authorizer.js +1 -0
  74. package/dist/service/lambda/command/event-invoke-config/event-invoke-config-authorizer.js +1 -0
  75. package/dist/service/lambda/command/function-url/function-url-authorizer.js +1 -0
  76. package/dist/service/lambda/command/get-function/get-function-authorizer.js +1 -0
  77. package/dist/service/lambda/command/invoke/invoke-authorizer.js +1 -0
  78. package/dist/service/lambda/command/list-functions/list-functions-authorizer.js +1 -0
  79. package/dist/service/lambda/command/update-function-code/update-function-code-authorizer.js +1 -0
  80. package/dist/service/lambda/command/update-function-configuration/update-function-configuration-authorizer.js +1 -0
  81. package/dist/service/lambda/command/version/version-authorizer.js +1 -0
  82. package/dist/service/logs/command/authorize/sim-logs-authorizer.js +1 -0
  83. package/dist/service/organizations/cfn/sim-cfn-organization-creator.d.ts +19 -0
  84. package/dist/service/organizations/cfn/sim-cfn-organization-creator.js +25 -0
  85. package/dist/service/organizations/cfn/sim-cfn-organizational-unit-creator.d.ts +16 -0
  86. package/dist/service/organizations/cfn/sim-cfn-organizational-unit-creator.js +21 -0
  87. package/dist/service/organizations/cfn/sim-cfn-organizations-account-creator.d.ts +20 -0
  88. package/dist/service/organizations/cfn/sim-cfn-organizations-account-creator.js +34 -0
  89. package/dist/service/organizations/cfn/sim-cfn-organizations-policy-creator.d.ts +21 -0
  90. package/dist/service/organizations/cfn/sim-cfn-organizations-policy-creator.js +40 -0
  91. package/dist/service/organizations/cfn/sim-cfn-organizations-policy-input.d.ts +20 -0
  92. package/dist/service/organizations/cfn/sim-cfn-organizations-policy-input.js +33 -0
  93. package/dist/service/organizations/cfn/sim-cfn-organizations-properties.d.ts +36 -0
  94. package/dist/service/organizations/cfn/sim-cfn-organizations-properties.js +78 -0
  95. package/dist/service/organizations/cfn/sim-cfn-organizations-record.d.ts +40 -0
  96. package/dist/service/organizations/cfn/sim-cfn-organizations-record.js +54 -0
  97. package/dist/service/organizations/cfn/sim-cfn-organizations-remover.d.ts +17 -0
  98. package/dist/service/organizations/cfn/sim-cfn-organizations-remover.js +40 -0
  99. package/dist/service/organizations/cfn/sim-organizations-cfn-resource-factory.d.ts +24 -0
  100. package/dist/service/organizations/cfn/sim-organizations-cfn-resource-factory.js +50 -0
  101. package/dist/service/organizations/index.d.ts +6 -0
  102. package/dist/service/organizations/index.js +6 -0
  103. package/dist/service/organizations/policy/sim-organizations-effective-policies.d.ts +43 -0
  104. package/dist/service/organizations/policy/sim-organizations-effective-policies.js +58 -0
  105. package/dist/service/organizations/policy/sim-organizations-scp-store.d.ts +61 -0
  106. package/dist/service/organizations/policy/sim-organizations-scp-store.js +103 -0
  107. package/dist/service/organizations/sim-organizations-structure.d.ts +94 -0
  108. package/dist/service/organizations/sim-organizations-structure.js +140 -0
  109. package/dist/service/organizations/sim-organizations.d.ts +95 -0
  110. package/dist/service/organizations/sim-organizations.js +99 -0
  111. package/dist/service/organizations/tree/sim-organizations-node.d.ts +57 -0
  112. package/dist/service/organizations/tree/sim-organizations-node.js +58 -0
  113. package/dist/service/organizations/tree/sim-organizations-tree.d.ts +91 -0
  114. package/dist/service/organizations/tree/sim-organizations-tree.js +154 -0
  115. package/dist/service/route53/command/change-resource-record-sets/change-resource-record-sets-authorizer.js +1 -0
  116. package/dist/service/route53/command/create-hosted-zone/create-hosted-zone-authorizer.js +1 -0
  117. package/dist/service/route53/command/delete-hosted-zone/delete-hosted-zone-authorizer.js +1 -0
  118. package/dist/service/route53/command/dnssec/sim-route53-dnssec-authorizer.js +1 -0
  119. package/dist/service/route53/command/get-hosted-zone/get-hosted-zone-authorizer.js +1 -0
  120. package/dist/service/route53/command/list-hosted-zones-by-name/list-hosted-zones-by-name-authorizer.js +1 -0
  121. package/dist/service/route53/command/list-resource-record-sets/list-resource-record-sets-authorizer.js +1 -0
  122. package/dist/service/s3/command/create-bucket/create-bucket.handler.js +1 -0
  123. package/dist/service/s3/command/delete-bucket/delete-bucket-authorizer.js +1 -0
  124. package/dist/service/s3/command/delete-bucket-policy/delete-bucket-policy-authorizer.js +1 -0
  125. package/dist/service/s3/command/delete-object/delete-object-authorizer.js +1 -0
  126. package/dist/service/s3/command/get-bucket-policy/get-bucket-policy-authorizer.js +1 -0
  127. package/dist/service/s3/command/get-object/get-object-authorizer.js +1 -0
  128. package/dist/service/s3/command/head-bucket/head-bucket-authorizer.js +1 -0
  129. package/dist/service/s3/command/lifecycle/sim-s3-lifecycle-authorizer.js +1 -0
  130. package/dist/service/s3/command/list-buckets/list-buckets-authorizer.js +1 -0
  131. package/dist/service/s3/command/list-objects/list-objects-authorizer.js +1 -0
  132. package/dist/service/s3/command/multipart/sim-s3-multipart-authorizer.js +1 -0
  133. package/dist/service/s3/command/notification/sim-s3-notification-authorizer.js +1 -0
  134. package/dist/service/s3/command/public-access-block/sim-s3-public-access-block-authorizer.js +1 -0
  135. package/dist/service/s3/command/put-bucket-policy/put-bucket-policy-authorizer.js +1 -0
  136. package/dist/service/s3/command/put-bucket-website/put-bucket-website-authorizer.js +1 -0
  137. package/dist/service/s3/command/put-object/put-object-authorizer.js +1 -0
  138. package/dist/service/secretsmanager/command/authorize/sim-secrets-manager-authorizer.js +1 -0
  139. package/dist/service/ses/command/authorize/sim-ses-authorizer.js +1 -0
  140. package/dist/service/sqs/command/authorize/sim-sqs-authorizer.js +1 -0
  141. package/dist/service/ssm/command/authorize/sim-ssm-authorizer.js +1 -0
  142. package/dist/service/wafv2/command/authorize/sim-wafv2-authorizer.js +1 -0
  143. package/dist/service/wafv2/command/ip-set/sim-wafv2-ip-set-commands.js +4 -3
  144. package/dist/service/wafv2/command/regex-pattern-set/sim-wafv2-regex-pattern-set-commands.js +4 -3
  145. package/dist/service/wafv2/command/sim-wafv2-input.d.ts +15 -0
  146. package/dist/service/wafv2/command/sim-wafv2-input.js +66 -1
  147. package/dist/service/wafv2/command/web-acl/sim-wafv2-web-acl-commands.js +7 -5
  148. package/dist/service/wafv2/error/sim-wafv2.error.d.ts +11 -0
  149. package/dist/service/wafv2/error/sim-wafv2.error.js +13 -0
  150. package/package.json +5 -1
@@ -4,6 +4,7 @@ import type { SimAwsAccountRegionContainer } from "./sim-aws-account-region-scop
4
4
  import { SimAwsServiceFactory } from "./factory/sim-aws-service-factory.js";
5
5
  import { SimAwsServiceAccessors } from "./sim-aws-service-accessors.js";
6
6
  import type { SimIamRegistry } from "../iam/registry/sim-iam-registry.js";
7
+ import type { SimOrganizations } from "../organizations/index.js";
7
8
  import type { SimAwsPrincipal } from "./caller/sim-aws-caller.js";
8
9
  import type { SimClockControl } from "../../util/clock/sim-clock-control.js";
9
10
  import type { SimAwsProperties, SimAwsRequestCallerOptions } from "./sim-aws-properties.js";
@@ -36,6 +37,23 @@ export declare class SimAws extends SimAwsServiceAccessors {
36
37
  private readonly timekeeping;
37
38
  private readonly requestAuthentication;
38
39
  constructor(properties?: SimAwsProperties);
40
+ /**
41
+ * Get simulated AWS Organizations for this simulated AWS environment.
42
+ *
43
+ * An organization spans Accounts, so this one belongs to the whole
44
+ * simulation and is reached here rather than from an Account scope. The
45
+ * service control policies attached through it filter what the Accounts in
46
+ * this simulation may do, whether a request arrives through a CloudFormation
47
+ * deployment, an intercepted SDK client, or a service call in a handler.
48
+ *
49
+ * ```typescript
50
+ * simAws.organizations().attachServiceControlPolicy("123456789012", {
51
+ * Version: "2012-10-17",
52
+ * Statement: { Effect: "Deny", Action: "s3:CreateBucket", Resource: "*" },
53
+ * });
54
+ * ```
55
+ */
56
+ organizations(): SimOrganizations;
39
57
  /**
40
58
  * Get the current time in this simulated AWS environment.
41
59
  *
@@ -55,6 +55,25 @@ export class SimAws extends SimAwsServiceAccessors {
55
55
  clock: background,
56
56
  });
57
57
  }
58
+ /**
59
+ * Get simulated AWS Organizations for this simulated AWS environment.
60
+ *
61
+ * An organization spans Accounts, so this one belongs to the whole
62
+ * simulation and is reached here rather than from an Account scope. The
63
+ * service control policies attached through it filter what the Accounts in
64
+ * this simulation may do, whether a request arrives through a CloudFormation
65
+ * deployment, an intercepted SDK client, or a service call in a handler.
66
+ *
67
+ * ```typescript
68
+ * simAws.organizations().attachServiceControlPolicy("123456789012", {
69
+ * Version: "2012-10-17",
70
+ * Statement: { Effect: "Deny", Action: "s3:CreateBucket", Resource: "*" },
71
+ * });
72
+ * ```
73
+ */
74
+ organizations() {
75
+ return this.serviceFactory.organizations;
76
+ }
58
77
  /**
59
78
  * Get the current time in this simulated AWS environment.
60
79
  *
@@ -0,0 +1,6 @@
1
+ import type { SimCfnResourceValueAdapterProperties, SimCfnServiceValueAdapter } from "../sim-cfn-resource-value-adapter.js";
2
+ /**
3
+ * The CloudFormation-facing value adapter for a simulated Organizations
4
+ * Resource.
5
+ */
6
+ export declare function organizationsValueAdapter(properties: SimCfnResourceValueAdapterProperties): SimCfnServiceValueAdapter;
@@ -0,0 +1,23 @@
1
+ import { SimCfnOrganization, SimCfnOrganizationsAccount, SimCfnOrganizationsPolicy, } from "../../../../organizations/cfn/sim-cfn-organizations-record.js";
2
+ import { SimOrganizationsOrganizationalUnit } from "../../../../organizations/tree/sim-organizations-node.js";
3
+ import { SimOrganizationalUnitCfn, SimOrganizationCfn, SimOrganizationsAccountCfn, SimOrganizationsPolicyCfn, } from "./sim-organizations-cfn.js";
4
+ /**
5
+ * The CloudFormation-facing value adapter for a simulated Organizations
6
+ * Resource.
7
+ */
8
+ export function organizationsValueAdapter(properties) {
9
+ const { simResource } = properties;
10
+ if (simResource instanceof SimCfnOrganization) {
11
+ return new SimOrganizationCfn(simResource);
12
+ }
13
+ if (simResource instanceof SimOrganizationsOrganizationalUnit) {
14
+ return new SimOrganizationalUnitCfn(simResource);
15
+ }
16
+ if (simResource instanceof SimCfnOrganizationsAccount) {
17
+ return new SimOrganizationsAccountCfn(simResource);
18
+ }
19
+ if (simResource instanceof SimCfnOrganizationsPolicy) {
20
+ return new SimOrganizationsPolicyCfn(simResource);
21
+ }
22
+ return undefined;
23
+ }
@@ -0,0 +1,66 @@
1
+ import type { SimCfnOrganization, SimCfnOrganizationsAccount, SimCfnOrganizationsPolicy } from "../../../../organizations/cfn/sim-cfn-organizations-record.js";
2
+ import type { SimOrganizationsOrganizationalUnit } from "../../../../organizations/tree/sim-organizations-node.js";
3
+ import type { SimCfnTemplateValue } from "../../../template/value/sim-cfn-template-value.js";
4
+ import type { SimCfnResourceValueAdapter } from "../sim-cfn-resource-value-adapter.js";
5
+ /**
6
+ * CloudFormation-facing values for a simulated organization.
7
+ */
8
+ export declare class SimOrganizationCfn implements SimCfnResourceValueAdapter {
9
+ private readonly organization;
10
+ constructor(organization: SimCfnOrganization);
11
+ /**
12
+ * AWS::Organizations::Organization Ref returns the organization id.
13
+ */
14
+ refValue(): SimCfnTemplateValue;
15
+ /**
16
+ * The attributes the AWS Resource reference lists, less the management
17
+ * account email, which a simulation has no address for.
18
+ */
19
+ attributeValue(attributeName: string): SimCfnTemplateValue;
20
+ }
21
+ /**
22
+ * CloudFormation-facing values for a simulated organizational unit.
23
+ */
24
+ export declare class SimOrganizationalUnitCfn implements SimCfnResourceValueAdapter {
25
+ private readonly unit;
26
+ constructor(unit: SimOrganizationsOrganizationalUnit);
27
+ /**
28
+ * AWS::Organizations::OrganizationalUnit Ref returns the unit id.
29
+ */
30
+ refValue(): SimCfnTemplateValue;
31
+ /**
32
+ * Id, Arn and Name, as the AWS Resource reference lists.
33
+ */
34
+ attributeValue(attributeName: string): SimCfnTemplateValue;
35
+ }
36
+ /**
37
+ * CloudFormation-facing values for an Account a template put in the
38
+ * organization.
39
+ */
40
+ export declare class SimOrganizationsAccountCfn implements SimCfnResourceValueAdapter {
41
+ private readonly account;
42
+ constructor(account: SimCfnOrganizationsAccount);
43
+ /**
44
+ * AWS::Organizations::Account Ref returns the Account id.
45
+ */
46
+ refValue(): SimCfnTemplateValue;
47
+ /**
48
+ * The attributes the AWS Resource reference lists.
49
+ */
50
+ attributeValue(attributeName: string): SimCfnTemplateValue;
51
+ }
52
+ /**
53
+ * CloudFormation-facing values for a simulated service control policy.
54
+ */
55
+ export declare class SimOrganizationsPolicyCfn implements SimCfnResourceValueAdapter {
56
+ private readonly policy;
57
+ constructor(policy: SimCfnOrganizationsPolicy);
58
+ /**
59
+ * AWS::Organizations::Policy Ref returns the policy id.
60
+ */
61
+ refValue(): SimCfnTemplateValue;
62
+ /**
63
+ * Id, Arn and AwsManaged, as the AWS Resource reference lists.
64
+ */
65
+ attributeValue(attributeName: string): SimCfnTemplateValue;
66
+ }
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Refuse an attribute the AWS Resource reference does not list.
3
+ */
4
+ function unknownAttribute(resourceType, attributeName) {
5
+ throw new Error(`AWS::Organizations::${resourceType} has no attribute ${attributeName}`);
6
+ }
7
+ /**
8
+ * CloudFormation-facing values for a simulated organization.
9
+ */
10
+ export class SimOrganizationCfn {
11
+ organization;
12
+ constructor(organization) {
13
+ this.organization = organization;
14
+ }
15
+ /**
16
+ * AWS::Organizations::Organization Ref returns the organization id.
17
+ */
18
+ refValue() {
19
+ return this.organization.id;
20
+ }
21
+ /**
22
+ * The attributes the AWS Resource reference lists, less the management
23
+ * account email, which a simulation has no address for.
24
+ */
25
+ attributeValue(attributeName) {
26
+ const { organization } = this;
27
+ const values = new Map([
28
+ ["Id", organization.id],
29
+ [
30
+ "Arn",
31
+ `arn:aws:organizations::${organization.managementAccountId}:organization/${organization.id}`,
32
+ ],
33
+ ["RootId", organization.rootId],
34
+ ["ManagementAccountId", organization.managementAccountId],
35
+ [
36
+ "ManagementAccountArn",
37
+ `arn:aws:organizations::${organization.managementAccountId}:account/${organization.id}/${organization.managementAccountId}`,
38
+ ],
39
+ ]);
40
+ return (values.get(attributeName) ??
41
+ unknownAttribute("Organization", attributeName));
42
+ }
43
+ }
44
+ /**
45
+ * CloudFormation-facing values for a simulated organizational unit.
46
+ */
47
+ export class SimOrganizationalUnitCfn {
48
+ unit;
49
+ constructor(unit) {
50
+ this.unit = unit;
51
+ }
52
+ /**
53
+ * AWS::Organizations::OrganizationalUnit Ref returns the unit id.
54
+ */
55
+ refValue() {
56
+ return this.unit.id;
57
+ }
58
+ /**
59
+ * Id, Arn and Name, as the AWS Resource reference lists.
60
+ */
61
+ attributeValue(attributeName) {
62
+ const { unit } = this;
63
+ const values = new Map([
64
+ ["Id", unit.id],
65
+ ["Arn", `arn:aws:organizations::organizational-unit/${unit.id}`],
66
+ ["Name", unit.name],
67
+ ]);
68
+ return (values.get(attributeName) ??
69
+ unknownAttribute("OrganizationalUnit", attributeName));
70
+ }
71
+ }
72
+ /**
73
+ * CloudFormation-facing values for an Account a template put in the
74
+ * organization.
75
+ */
76
+ export class SimOrganizationsAccountCfn {
77
+ account;
78
+ constructor(account) {
79
+ this.account = account;
80
+ }
81
+ /**
82
+ * AWS::Organizations::Account Ref returns the Account id.
83
+ */
84
+ refValue() {
85
+ return this.account.accountId;
86
+ }
87
+ /**
88
+ * The attributes the AWS Resource reference lists.
89
+ */
90
+ attributeValue(attributeName) {
91
+ const { account } = this;
92
+ const values = new Map([
93
+ ["AccountId", account.accountId],
94
+ [
95
+ "Arn",
96
+ `arn:aws:organizations::${account.accountId}:account/${account.accountId}`,
97
+ ],
98
+ ["Email", account.email],
99
+ ["AccountName", account.accountName],
100
+ ["JoinedMethod", "CREATED"],
101
+ ["JoinedTimestamp", account.joinedTimestamp.toISOString()],
102
+ ["Status", "ACTIVE"],
103
+ ]);
104
+ return (values.get(attributeName) ?? unknownAttribute("Account", attributeName));
105
+ }
106
+ }
107
+ /**
108
+ * CloudFormation-facing values for a simulated service control policy.
109
+ */
110
+ export class SimOrganizationsPolicyCfn {
111
+ policy;
112
+ constructor(policy) {
113
+ this.policy = policy;
114
+ }
115
+ /**
116
+ * AWS::Organizations::Policy Ref returns the policy id.
117
+ */
118
+ refValue() {
119
+ return this.policy.id;
120
+ }
121
+ /**
122
+ * Id, Arn and AwsManaged, as the AWS Resource reference lists.
123
+ */
124
+ attributeValue(attributeName) {
125
+ const { policy } = this;
126
+ const values = new Map([
127
+ ["Id", policy.id],
128
+ [
129
+ "Arn",
130
+ `arn:aws:organizations::policy/service_control_policy/${policy.id}`,
131
+ ],
132
+ ["AwsManaged", false],
133
+ ]);
134
+ return (values.get(attributeName) ?? unknownAttribute("Policy", attributeName));
135
+ }
136
+ }
@@ -18,6 +18,7 @@ import { iamValueAdapter } from "./iam/sim-iam-cfn-value-adapter.js";
18
18
  import { kinesisValueAdapter } from "./kinesis/sim-kinesis-cfn-value-adapter.js";
19
19
  import { kmsValueAdapter } from "./kms/sim-kms-cfn-value-adapter.js";
20
20
  import { lambdaValueAdapter } from "./lambda/sim-lambda-cfn-value-adapter.js";
21
+ import { organizationsValueAdapter } from "./organizations/sim-organizations-cfn-value-adapter.js";
21
22
  import { personalizeValueAdapter } from "./personalize/sim-personalize-cfn-value-adapter.js";
22
23
  import { route53ValueAdapter } from "./route53/sim-route53-cfn-value-adapter.js";
23
24
  import { s3ValueAdapter } from "./s3/sim-s3-cfn-value-adapter.js";
@@ -60,6 +61,7 @@ export const simCfnServiceValueAdapters = [
60
61
  kinesisValueAdapter,
61
62
  kmsValueAdapter,
62
63
  lambdaValueAdapter,
64
+ organizationsValueAdapter,
63
65
  personalizeValueAdapter,
64
66
  route53ValueAdapter,
65
67
  s3ValueAdapter,
@@ -1,4 +1,5 @@
1
1
  import { SimCfnCfnResourceFactory } from "../../factory/sim-cfn-cfn-resource-factory.js";
2
+ import { SimOrganizationsCfnResourceFactory } from "../../../../organizations/cfn/sim-organizations-cfn-resource-factory.js";
2
3
  /**
3
4
  * Certificates arrive under two service names. `AWS::CertificateManager::*` is
4
5
  * the real one, and `AWS::ACM::*` is the shorthand some templates use, so both
@@ -34,6 +35,12 @@ export const simCfnServiceResourceFactories = new Map([
34
35
  "CloudFormation",
35
36
  () => new SimCfnCfnResourceFactory(),
36
37
  ],
38
+ // An organization spans Accounts, so this factory reads the one on the
39
+ // creation context rather than the Account and Region scope it deploys into.
40
+ [
41
+ "Organizations",
42
+ () => new SimOrganizationsCfnResourceFactory(),
43
+ ],
37
44
  [
38
45
  "CloudFront",
39
46
  (scopedAws) => scopedAws.cloudFront().cfnResourceFactory(),
@@ -28,6 +28,7 @@ export class CreateDistributionAuthorizer {
28
28
  if (decision.isDenied) {
29
29
  throw new SimIamAccessDenied({
30
30
  principal: decision.caller.principal,
31
+ reason: decision.denialReason,
31
32
  action: CreateDistributionAuthorizer.action,
32
33
  resource: CreateDistributionAuthorizer.resource,
33
34
  });
@@ -26,6 +26,7 @@ export class CreateFunctionAuthorizer {
26
26
  if (decision.isDenied) {
27
27
  throw new SimIamAccessDenied({
28
28
  principal: decision.caller.principal,
29
+ reason: decision.denialReason,
29
30
  action: CreateFunctionAuthorizer.action,
30
31
  resource,
31
32
  });
@@ -31,6 +31,7 @@ export class DeleteDistributionAuthorizer {
31
31
  if (decision.isDenied) {
32
32
  throw new SimIamAccessDenied({
33
33
  principal: decision.caller.principal,
34
+ reason: decision.denialReason,
34
35
  action: DeleteDistributionAuthorizer.action,
35
36
  resource,
36
37
  });
@@ -27,6 +27,7 @@ export class DeleteFunctionAuthorizer {
27
27
  if (decision.isDenied) {
28
28
  throw new SimIamAccessDenied({
29
29
  principal: decision.caller.principal,
30
+ reason: decision.denialReason,
30
31
  action: DeleteFunctionAuthorizer.action,
31
32
  resource,
32
33
  });
@@ -27,6 +27,7 @@ export class GetDistributionAuthorizer {
27
27
  if (decision.isDenied) {
28
28
  throw new SimIamAccessDenied({
29
29
  principal: decision.caller.principal,
30
+ reason: decision.denialReason,
30
31
  action: GetDistributionAuthorizer.action,
31
32
  resource,
32
33
  });
@@ -27,6 +27,7 @@ export class UpdateDistributionAuthorizer {
27
27
  if (decision.isDenied) {
28
28
  throw new SimIamAccessDenied({
29
29
  principal: decision.caller.principal,
30
+ reason: decision.denialReason,
30
31
  action: UpdateDistributionAuthorizer.action,
31
32
  resource,
32
33
  });
@@ -18,6 +18,7 @@ export function authorizeEdgeAssociation(iam, functionArn, caller) {
18
18
  if (decision.isDenied) {
19
19
  throw new SimIamAccessDenied({
20
20
  principal: decision.caller.principal,
21
+ reason: decision.denialReason,
21
22
  action,
22
23
  resource: functionArn,
23
24
  });
@@ -25,6 +25,7 @@ export class SimCfKeyValueStoreAccess {
25
25
  if (decision.isDenied) {
26
26
  throw new SimIamAccessDenied({
27
27
  principal: decision.caller.principal,
28
+ reason: decision.denialReason,
28
29
  action,
29
30
  resource,
30
31
  });
@@ -21,6 +21,7 @@ export function decideSimCloudWatchRequest(iam, request) {
21
21
  if (decision.isDenied) {
22
22
  throw new SimIamAccessDenied({
23
23
  principal: decision.caller.principal,
24
+ reason: decision.denialReason,
24
25
  action,
25
26
  resource,
26
27
  });
@@ -45,6 +45,7 @@ export class SimCognitoAuthorizer {
45
45
  if (decision.isDenied) {
46
46
  throw new SimIamAccessDenied({
47
47
  principal: decision.caller.principal,
48
+ reason: decision.denialReason,
48
49
  action,
49
50
  resource,
50
51
  });
@@ -56,6 +56,7 @@ export class SimDynamoDbAuthorizer {
56
56
  if (decision.isDenied) {
57
57
  throw new SimIamAccessDenied({
58
58
  principal: decision.caller.principal,
59
+ reason: decision.denialReason,
59
60
  action,
60
61
  resource,
61
62
  });
@@ -39,6 +39,7 @@ export class SimFirehoseAuthorizer {
39
39
  if (decision.isDenied) {
40
40
  throw new SimIamAccessDenied({
41
41
  principal: decision.caller.principal,
42
+ reason: decision.denialReason,
42
43
  action,
43
44
  resource,
44
45
  });
@@ -14,6 +14,7 @@ export function authorizeSimGlueResources(properties) {
14
14
  if (decision.isDenied) {
15
15
  throw new SimIamAccessDenied({
16
16
  principal: decision.caller.principal,
17
+ reason: decision.denialReason,
17
18
  action,
18
19
  resource,
19
20
  });
@@ -0,0 +1,45 @@
1
+ import type { SimIamPolicyDocumentStatement } from "../../policy/sim-iam-policy.js";
2
+ import type { SimIamPolicyDocumentParser } from "../../policy/parse/sim-iam-document-parser.js";
3
+ import type { SimIamPolicyStatementMatcher } from "../match/sim-iam-policy-statement-matcher.js";
4
+ import type { SimIamAuthZPolicySource } from "../context/sim-iam-auth-z-context.js";
5
+ import { SimIamAllowStatements } from "./sim-iam-allow-statements.js";
6
+ import type { SimIamAllowSides } from "./sim-iam-allow-requirement.js";
7
+ interface SimIamPolicyEvaluationProperties {
8
+ readonly policies: readonly SimIamAuthZPolicySource[];
9
+ readonly policyDocumentParser: SimIamPolicyDocumentParser;
10
+ readonly statementMatcher: SimIamPolicyStatementMatcher;
11
+ }
12
+ /**
13
+ * The statements of the identity and resource policies that matched one
14
+ * request.
15
+ *
16
+ * These are the two sides that can allow a request, so they are read together
17
+ * and kept apart by side afterwards. Which of them has to allow for the
18
+ * request to go ahead belongs to the allow requirement rather than here.
19
+ */
20
+ export declare class SimIamPolicyEvaluation {
21
+ private readonly explicitDenyStatementRecords;
22
+ private readonly allows;
23
+ constructor(properties: SimIamPolicyEvaluationProperties);
24
+ /**
25
+ * Whether a matching Deny statement was found.
26
+ */
27
+ get isExplicitDeny(): boolean;
28
+ /**
29
+ * Matching explicit Deny statements.
30
+ */
31
+ get explicitDenyStatements(): readonly SimIamPolicyDocumentStatement[];
32
+ /**
33
+ * The matching Allow statements, kept per side.
34
+ */
35
+ get allowStatements(): SimIamAllowStatements;
36
+ /**
37
+ * Which sides produced a matching Allow.
38
+ */
39
+ get sides(): SimIamAllowSides;
40
+ /**
41
+ * Record the matching statements of one policy.
42
+ */
43
+ private evaluate;
44
+ }
45
+ export {};
@@ -0,0 +1,59 @@
1
+ import { SimIamAllowStatements } from "./sim-iam-allow-statements.js";
2
+ /**
3
+ * The statements of the identity and resource policies that matched one
4
+ * request.
5
+ *
6
+ * These are the two sides that can allow a request, so they are read together
7
+ * and kept apart by side afterwards. Which of them has to allow for the
8
+ * request to go ahead belongs to the allow requirement rather than here.
9
+ */
10
+ export class SimIamPolicyEvaluation {
11
+ explicitDenyStatementRecords = [];
12
+ allows = new SimIamAllowStatements();
13
+ constructor(properties) {
14
+ for (const policy of properties.policies) {
15
+ this.evaluate(policy, properties);
16
+ }
17
+ }
18
+ /**
19
+ * Whether a matching Deny statement was found.
20
+ */
21
+ get isExplicitDeny() {
22
+ return this.explicitDenyStatementRecords.length > 0;
23
+ }
24
+ /**
25
+ * Matching explicit Deny statements.
26
+ */
27
+ get explicitDenyStatements() {
28
+ return this.explicitDenyStatementRecords;
29
+ }
30
+ /**
31
+ * The matching Allow statements, kept per side.
32
+ */
33
+ get allowStatements() {
34
+ return this.allows;
35
+ }
36
+ /**
37
+ * Which sides produced a matching Allow.
38
+ */
39
+ get sides() {
40
+ return this.allows.sides;
41
+ }
42
+ /**
43
+ * Record the matching statements of one policy.
44
+ */
45
+ evaluate(policy, properties) {
46
+ const parsedPolicy = properties.policyDocumentParser.parse(policy.document);
47
+ for (const statement of parsedPolicy.statements) {
48
+ const principal = properties.statementMatcher.matches(policy, statement);
49
+ if (!principal.matched) {
50
+ continue;
51
+ }
52
+ if (statement.effect === "Deny") {
53
+ this.explicitDenyStatementRecords.push(statement.source);
54
+ continue;
55
+ }
56
+ this.allows.record(policy, statement.source, principal);
57
+ }
58
+ }
59
+ }
@@ -8,6 +8,7 @@ import type { SimIamCallerConditionSource } from "./sim-iam-caller-condition-sou
8
8
  import type { SimIamAuthZContext, SimIamAuthZPolicySource, SimIamAuthZPolicySourceType } from "./sim-iam-auth-z-context.js";
9
9
  import type { SimAwsCredentialIdentityResolver } from "../../../aws/caller/sim-aws-caller-resolver.js";
10
10
  import type { SimIamUser, SimIamUsername } from "../../user/sim-iam-user.js";
11
+ import type { SimIamServiceControlPolicyResolver } from "../scp/sim-iam-scp-resolver.js";
11
12
  export interface SimIamResourcePolicyInput {
12
13
  readonly document: SimIamPolicyDocument;
13
14
  readonly sourceType?: Extract<SimIamAuthZPolicySourceType, "resource" | "trust">;
@@ -77,6 +78,11 @@ interface SimIamAuthZContextBuilderProperties {
77
78
  * of a cross-Account request.
78
79
  */
79
80
  readonly iamResolver?: SimIamAccountResolver | undefined;
81
+ /**
82
+ * Resolves the service control policies in force for an Account. A
83
+ * standalone SimIam has no organization around it and leaves this out.
84
+ */
85
+ readonly scpResolver?: SimIamServiceControlPolicyResolver | undefined;
80
86
  }
81
87
  /**
82
88
  * Builds the authorization context consumed by SimIamAuthorizer.
@@ -99,16 +105,21 @@ interface SimIamAuthZContextBuilderProperties {
99
105
  * They are passed through the authorization input rather than loaded from the
100
106
  * IAM role or managed-policy stores.
101
107
  *
102
- * Permissions boundaries, session policies, SCPs, and role trust-policy
103
- * assume-role semantics are not part of this context assembly path yet. Add
104
- * those concerns through separate policy-source builders so this class stays
105
- * focused on composing the authorization request.
108
+ * Service control policies come from the organization the caller's Account
109
+ * belongs to, read by SimIamAuthZScpSourceBuilder. They filter and grant
110
+ * nothing, so they travel apart from the sides that can allow a request.
111
+ *
112
+ * Permissions boundaries, session policies, and role trust-policy assume-role
113
+ * semantics are not part of this context assembly path yet. Add those concerns
114
+ * through separate policy-source builders so this class stays focused on
115
+ * composing the authorization request.
106
116
  */
107
117
  export declare class SimIamAuthZContextBuilder {
108
118
  private readonly callerContextBuilder;
109
119
  private readonly identityPolicyCoordinator;
110
120
  private readonly callerAccountResolver;
111
121
  private readonly allowRequirement;
122
+ private readonly scpSourceBuilder;
112
123
  constructor(properties: SimIamAuthZContextBuilderProperties);
113
124
  /**
114
125
  * Build the context consumed by SimIamAuthorizer.
@@ -3,6 +3,7 @@ import { SimIamCallerAccountResolver } from "../caller-account/sim-iam-caller-ac
3
3
  import { SimIamAuthZAllowRequirement } from "./sim-iam-auth-z-allow-requirement.js";
4
4
  import { SimIamAuthZIdentityPolicyCoordinator } from "./identity-policy-source/sim-iam-auth-z-id-pol-coordinator.js";
5
5
  import { SimIamAuthZCallerContextBuilder, } from "./sim-iam-auth-z-caller-context-builder.js";
6
+ import { SimIamAuthZScpSourceBuilder } from "./sim-iam-auth-z-scp-source-builder.js";
6
7
  /**
7
8
  * Builds the authorization context consumed by SimIamAuthorizer.
8
9
  *
@@ -24,16 +25,21 @@ import { SimIamAuthZCallerContextBuilder, } from "./sim-iam-auth-z-caller-contex
24
25
  * They are passed through the authorization input rather than loaded from the
25
26
  * IAM role or managed-policy stores.
26
27
  *
27
- * Permissions boundaries, session policies, SCPs, and role trust-policy
28
- * assume-role semantics are not part of this context assembly path yet. Add
29
- * those concerns through separate policy-source builders so this class stays
30
- * focused on composing the authorization request.
28
+ * Service control policies come from the organization the caller's Account
29
+ * belongs to, read by SimIamAuthZScpSourceBuilder. They filter and grant
30
+ * nothing, so they travel apart from the sides that can allow a request.
31
+ *
32
+ * Permissions boundaries, session policies, and role trust-policy assume-role
33
+ * semantics are not part of this context assembly path yet. Add those concerns
34
+ * through separate policy-source builders so this class stays focused on
35
+ * composing the authorization request.
31
36
  */
32
37
  export class SimIamAuthZContextBuilder {
33
38
  callerContextBuilder;
34
39
  identityPolicyCoordinator;
35
40
  callerAccountResolver;
36
41
  allowRequirement = new SimIamAuthZAllowRequirement();
42
+ scpSourceBuilder;
37
43
  constructor(properties) {
38
44
  this.callerContextBuilder = new SimIamAuthZCallerContextBuilder(makeSimAwsAccountRootPrincipal(properties.accountId), properties.credentialIdentityResolver);
39
45
  this.identityPolicyCoordinator = new SimIamAuthZIdentityPolicyCoordinator({
@@ -45,6 +51,10 @@ export class SimIamAuthZContextBuilder {
45
51
  accountId: properties.accountId,
46
52
  iamResolver: properties.iamResolver,
47
53
  });
54
+ this.scpSourceBuilder = new SimIamAuthZScpSourceBuilder({
55
+ accountId: properties.accountId,
56
+ scpResolver: properties.scpResolver,
57
+ });
48
58
  }
49
59
  /**
50
60
  * Build the context consumed by SimIamAuthorizer.
@@ -58,6 +68,7 @@ export class SimIamAuthZContextBuilder {
58
68
  ...callerAccount.identityPolicies,
59
69
  ],
60
70
  resourcePolicies: this.resourcePolicySources(input),
71
+ serviceControlPolicies: this.scpSourceBuilder.build(callerContext.caller),
61
72
  allowRequirement: this.allowRequirement.resolve(callerAccount, input.requiresResourcePolicyAllow),
62
73
  action: input.action,
63
74
  resource: input.resource,