nomoss 0.0.3 → 0.0.4
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 +27 -0
- package/README.md +5 -15
- package/ROADMAP.md +2 -0
- package/docs/README.md +1 -1
- package/docs/application/aws-resource-coverage.md +26 -0
- package/docs/application/aws-resource-lifecycle-management.md +13 -23
- package/docs/application/cli-workflow.md +1 -1
- package/docs/application/engine-design.md +2 -2
- package/docs/application/generation-architecture.md +10 -45
- package/docs/application/resource-command-policy-stage.md +2 -2
- package/docs/application/resource-graph.md +1 -1
- package/docs/application/resource-lifecycle-tracker.md +1 -9
- package/docs/application/resource-mapping.md +4 -9
- package/docs/application/resource-operations.md +4 -2
- package/docs/application/tracing.md +2 -6
- package/docs/development/code-documentation.md +2 -0
- package/docs/development/effect-native-development.md +44 -0
- package/docs/development/linting.md +1 -1
- package/docs/development/review-code.md +22 -6
- package/docs/development/review-remediation-spec.md +28 -37
- package/docs/development/spec-writing.md +1 -1
- package/docs/development/testing.md +23 -9
- package/docs/operations/observability-sop.md +11 -17
- package/docs/operations/releasing.md +3 -1
- package/examples/README.md +3 -26
- package/examples/commands.ts +2 -36
- package/examples/queue/application.ts +8 -2
- package/examples/state-machine/application.ts +3 -1
- package/package.json +40 -46
- package/providers/aws/README.md +21 -0
- package/providers/aws/awsEnvironment.ts +114 -0
- package/providers/aws/generated/managementRegistry.ts +136 -0
- package/{src/providers/aws/resources/generated/native/apigatewayv2/api/index.ts → providers/aws/generated/resources/apigatewayv2/api.ts} +13 -50
- package/{src/providers/aws/resources/generated/native/apigatewayv2/integration/index.ts → providers/aws/generated/resources/apigatewayv2/integration.ts} +13 -37
- package/{src/providers/aws/resources/generated/native/apigatewayv2/route/index.ts → providers/aws/generated/resources/apigatewayv2/route.ts} +23 -40
- package/{src/providers/aws/resources/generated/native/apigatewayv2/stage/index.ts → providers/aws/generated/resources/apigatewayv2/stage.ts} +13 -38
- package/providers/aws/generated/resources/iam/accesskey.ts +184 -0
- package/{src/providers/aws/resources/generated/native/iam/group/index.ts → providers/aws/generated/resources/iam/group.ts} +13 -38
- package/{src/providers/aws/resources/generated/native/iam/grouppolicy/index.ts → providers/aws/generated/resources/iam/grouppolicy.ts} +29 -59
- package/{src/providers/aws/resources/generated/native/iam/instanceprofile/index.ts → providers/aws/generated/resources/iam/instanceprofile.ts} +13 -41
- package/{src/providers/aws/resources/generated/native/iam/managedpolicy/index.ts → providers/aws/generated/resources/iam/managedpolicy.ts} +13 -95
- package/providers/aws/generated/resources/iam/oidcprovider.ts +314 -0
- package/{src/providers/aws/resources/generated/native/iam/policy/index.ts → providers/aws/generated/resources/iam/policy.ts} +13 -28
- package/{src/providers/aws/resources/generated/native/iam/role/index.ts → providers/aws/generated/resources/iam/role.ts} +13 -47
- package/{src/providers/aws/resources/generated/native/iam/rolepolicy/index.ts → providers/aws/generated/resources/iam/rolepolicy.ts} +29 -59
- package/providers/aws/generated/resources/iam/samlprovider.ts +463 -0
- package/providers/aws/generated/resources/iam/servercertificate.ts +465 -0
- package/providers/aws/generated/resources/iam/servicelinkedrole.ts +187 -0
- package/{src/providers/aws/resources/generated/native/iam/user/index.ts → providers/aws/generated/resources/iam/user.ts} +13 -38
- package/{src/providers/aws/resources/generated/native/iam/userpolicy/index.ts → providers/aws/generated/resources/iam/userpolicy.ts} +29 -59
- package/{src/providers/aws/resources/generated/native/iam/usertogroupaddition/index.ts → providers/aws/generated/resources/iam/usertogroupaddition.ts} +13 -27
- package/providers/aws/generated/resources/iam/virtualmfadevice.ts +298 -0
- package/{src/providers/aws/resources/generated/native/kms/key/index.ts → providers/aws/generated/resources/kms/key.ts} +13 -41
- package/{src/providers/aws/resources/generated/native/lambda/function/index.ts → providers/aws/generated/resources/lambda/function.ts} +13 -63
- package/{src/providers/aws/resources/generated/native/lambda/permission/index.ts → providers/aws/generated/resources/lambda/permission.ts} +13 -55
- package/{src/providers/aws/resources/generated/native/s3/bucket/index.ts → providers/aws/generated/resources/s3/bucket.ts} +14 -104
- package/{src/providers/aws/resources/generated/native/sns/topic/index.ts → providers/aws/generated/resources/sns/topic.ts} +14 -29
- package/{src/providers/aws/resources/generated/native/sqs/queue/index.ts → providers/aws/generated/resources/sqs/queue.ts} +14 -38
- package/{src/providers/aws/resources/generated/native/stepfunctions/statemachine/index.ts → providers/aws/generated/resources/stepfunctions/statemachine.ts} +15 -58
- package/providers/aws/management/mappings/iam/group.ts +63 -0
- package/providers/aws/management/mappings/iam/iamIdentity.ts +41 -0
- package/providers/aws/management/mappings/iam/iamLifecycleSettings.ts +8 -0
- package/providers/aws/management/mappings/iam/inlinePolicies.ts +159 -0
- package/providers/aws/management/mappings/iam/instanceProfile.ts +77 -0
- package/providers/aws/management/mappings/iam/oidcProvider.ts +94 -0
- package/providers/aws/management/mappings/iam/role.ts +74 -0
- package/providers/aws/management/mappings/iam/samlProvider.ts +98 -0
- package/providers/aws/management/mappings/iam/serverCertificate.ts +72 -0
- package/providers/aws/management/mappings/iam/user.ts +61 -0
- package/providers/aws/management/mappings/iam/userToGroupAddition.ts +75 -0
- package/providers/aws/management/operations/iam/accessKey.ts +206 -0
- package/providers/aws/management/operations/iam/managedPolicy.ts +491 -0
- package/providers/aws/management/operations/iam/policy.ts +476 -0
- package/providers/aws/management/operations/iam/serviceLinkedRole.ts +172 -0
- package/providers/aws/management/operations/iam/virtualMfaDevice.ts +253 -0
- package/providers/aws/management/resourceAssociationConfiguration.ts +112 -0
- package/providers/aws/management/resourceAssociationRegistration.ts +349 -0
- package/providers/aws/management/resourceAssociations.ts +168 -0
- package/{src/providers → providers}/aws/management/resourceConfiguration.ts +24 -26
- package/providers/aws/management/resourceLifecycleRegistration.ts +540 -0
- package/providers/aws/management/resourceManagementModule.ts +31 -0
- package/providers/aws/management/resourceManagementRegistry.ts +62 -0
- package/providers/aws/management/resourceMapping.ts +84 -0
- package/providers/aws/management/resourceOperation.ts +134 -0
- package/providers/aws/management/resourceTagOperations.ts +108 -0
- package/providers/aws/management/resourceTiming.ts +4 -0
- package/providers/aws/runtime.ts +52 -0
- package/src/core/resource/resourceCommandPolicy.ts +20 -0
- package/src/core/resource/resourceLifecycle.ts +644 -0
- package/src/core/resource/resourceStabilization.ts +120 -0
- package/src/core/resource/resourceVersions.ts +102 -0
- package/src/core/stack/planner.ts +9 -0
- package/src/core/stack/resourceStackLifecycle.ts +36 -3
- package/src/core/state/resourceState.ts +6 -4
- package/src/core/state/stateStore.ts +57 -10
- package/src/providers/file/resourcePolicy.ts +13 -12
- package/src/providers/providerRuntimeLayer.ts +5 -2
- package/src/providers/resourceCommandPolicyLayer.ts +117 -37
- package/src/providers/stripe/management/resourcePolicy.ts +22 -11
- package/examples/http-echo/application.ts +0 -87
- package/src/providers/aws/client/awsClient.ts +0 -418
- package/src/providers/aws/client/awsClientConfig.ts +0 -133
- package/src/providers/aws/client/awsClientModel.ts +0 -119
- package/src/providers/aws/client/awsHttpOperation.ts +0 -153
- package/src/providers/aws/client/awsQueryOperation.ts +0 -149
- package/src/providers/aws/client/awsRequestSigner.ts +0 -115
- package/src/providers/aws/client/awsResponseDecoder.ts +0 -135
- package/src/providers/aws/client/awsRetryPolicy.ts +0 -62
- package/src/providers/aws/client/generated/apiGatewayV2.ts +0 -3025
- package/src/providers/aws/client/generated/cloudControl.ts +0 -5746
- package/src/providers/aws/client/generated/iam.ts +0 -10892
- package/src/providers/aws/client/generated/lambda.ts +0 -5403
- package/src/providers/aws/client/generated/sqs.ts +0 -3769
- package/src/providers/aws/client/generated/stepFunctions.ts +0 -1726
- package/src/providers/aws/client/openapi/cloudControl/CancelResourceRequest.json +0 -579
- package/src/providers/aws/client/openapi/cloudControl/CreateResource.json +0 -1019
- package/src/providers/aws/client/openapi/cloudControl/DeleteResource.json +0 -1018
- package/src/providers/aws/client/openapi/cloudControl/GetResource.json +0 -883
- package/src/providers/aws/client/openapi/cloudControl/GetResourceRequestStatus.json +0 -655
- package/src/providers/aws/client/openapi/cloudControl/ListResourceRequests.json +0 -566
- package/src/providers/aws/client/openapi/cloudControl/ListResources.json +0 -913
- package/src/providers/aws/client/openapi/cloudControl/UpdateResource.json +0 -1027
- package/src/providers/aws/cloudControl/client.ts +0 -69
- package/src/providers/aws/cloudControl/requestTracker.ts +0 -138
- package/src/providers/aws/cloudControl/resourceCommandPolicyLayer.ts +0 -63
- package/src/providers/aws/cloudControl/resourceLifecycle.ts +0 -479
- package/src/providers/aws/cloudControl/resources/generated/certificatemanager/certificate/index.ts +0 -179
- package/src/providers/aws/cloudControl/resources/generated/kms/key/index.ts +0 -362
- package/src/providers/aws/cloudControl/resources/generated/s3/bucket/index.ts +0 -2364
- package/src/providers/aws/cloudControl/resources/generated/sns/topic/index.ts +0 -326
- package/src/providers/aws/cloudControl/resources/generated/sqs/queue/index.ts +0 -307
- package/src/providers/aws/cloudControl/resources/generated/sqs/queueinlinepolicy/index.ts +0 -108
- package/src/providers/aws/cloudControl/runtime.ts +0 -127
- package/src/providers/aws/management/resourceMapping.ts +0 -343
- package/src/providers/aws/management/resourceOperation.ts +0 -57
- package/src/providers/aws/management/resourcePolicy.ts +0 -549
- package/src/providers/aws/management/resourceRegistration.ts +0 -294
- package/src/providers/aws/resources/apiGatewayV2/httpApi.ts +0 -327
- package/src/providers/aws/resources/generated/native/resourceCommands.ts +0 -152
- package/src/providers/aws/resources/iam/grant.ts +0 -150
- package/src/providers/aws/resources/iam/grantCommands.ts +0 -283
- package/src/providers/aws/resources/iam/policyDocument.ts +0 -30
- package/src/providers/aws/resources/iam/policyStatement.ts +0 -59
- package/src/providers/aws/resources/iam/role.ts +0 -426
- package/src/providers/aws/resources/iam/roleDeclaration.ts +0 -105
- package/src/providers/aws/resources/lambda/function.ts +0 -403
- package/src/providers/aws/resources/lambda/functionDeclaration.ts +0 -234
- package/src/providers/aws/resources/lambda/permission.ts +0 -363
- package/src/providers/aws/resources/stepFunctions/stateMachine.ts +0 -95
- package/src/providers/aws/runtime.ts +0 -70
|
@@ -1,479 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Array as Arr,
|
|
3
|
-
Context,
|
|
4
|
-
Data,
|
|
5
|
-
Effect,
|
|
6
|
-
JsonPatch,
|
|
7
|
-
Match,
|
|
8
|
-
Option,
|
|
9
|
-
Schema,
|
|
10
|
-
Stream,
|
|
11
|
-
Struct,
|
|
12
|
-
} from "effect";
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
ResourceCommandResult,
|
|
16
|
-
ResourceObservation,
|
|
17
|
-
} from "../../../core/resource/lifecycle.js";
|
|
18
|
-
import {
|
|
19
|
-
ResourceModel,
|
|
20
|
-
type ResourceNode,
|
|
21
|
-
} from "../../../core/resource/model.js";
|
|
22
|
-
import { AwsCloudControlClient } from "./client.js";
|
|
23
|
-
import {
|
|
24
|
-
AwsCloudControlRequestFailed,
|
|
25
|
-
AwsCloudControlRequestTracker,
|
|
26
|
-
} from "./requestTracker.js";
|
|
27
|
-
|
|
28
|
-
export class AwsCloudControlMetadataMissing extends Data.TaggedError(
|
|
29
|
-
"AwsCloudControlMetadataMissing",
|
|
30
|
-
)<{ readonly node: ResourceNode }> {}
|
|
31
|
-
|
|
32
|
-
export class AwsCloudControlIdentifierMissing extends Data.TaggedError(
|
|
33
|
-
"AwsCloudControlIdentifierMissing",
|
|
34
|
-
)<{ readonly node: ResourceNode }> {}
|
|
35
|
-
|
|
36
|
-
export class AwsCloudControlResourceModelMissing extends Data.TaggedError(
|
|
37
|
-
"AwsCloudControlResourceModelMissing",
|
|
38
|
-
)<{ readonly typeName: string }> {}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* AwsCloudControlResourceLifecycle manages Registry-defined resources through
|
|
42
|
-
* generated Cloud Control operations. Creation and update return validated
|
|
43
|
-
* provider models after stabilization, so saved state and dependent inputs
|
|
44
|
-
* refer to resources whose AWS mutations have completed.
|
|
45
|
-
*/
|
|
46
|
-
export class AwsCloudControlResourceLifecycle extends Context.Service<AwsCloudControlResourceLifecycle>()(
|
|
47
|
-
"nomoss/providers/aws/cloudControl/resourceLifecycle/AwsCloudControlResourceLifecycle",
|
|
48
|
-
{
|
|
49
|
-
make: Effect.gen(function* () {
|
|
50
|
-
const client = yield* AwsCloudControlClient;
|
|
51
|
-
const requestTracker = yield* AwsCloudControlRequestTracker;
|
|
52
|
-
const resourceModel = yield* ResourceModel;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The model read returns the current provider node with its Cloud Control
|
|
56
|
-
* identity and validated outputs. Mutation results and observations use
|
|
57
|
-
* this node so dependent resources receive the provider's actual values.
|
|
58
|
-
*/
|
|
59
|
-
const readResourceByIdentifier = Effect.fn(
|
|
60
|
-
"AwsCloudControlResourceLifecycle.readResourceByIdentifier",
|
|
61
|
-
)(function* (node: ResourceNode, cloudControlIdentifier: string) {
|
|
62
|
-
const cloudControl = yield* Option.fromUndefinedOr(
|
|
63
|
-
node.schema.cloudControl,
|
|
64
|
-
).pipe(
|
|
65
|
-
Effect.fromOption,
|
|
66
|
-
Effect.mapError(() => new AwsCloudControlMetadataMissing({ node })),
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const response = yield* client
|
|
70
|
-
.getResource({
|
|
71
|
-
TypeName: cloudControl.typeName,
|
|
72
|
-
Identifier: cloudControlIdentifier,
|
|
73
|
-
})
|
|
74
|
-
.pipe(
|
|
75
|
-
Effect.mapError(
|
|
76
|
-
(cause) =>
|
|
77
|
-
new AwsCloudControlRequestFailed({
|
|
78
|
-
typeName: cloudControl.typeName,
|
|
79
|
-
cause,
|
|
80
|
-
}),
|
|
81
|
-
),
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const properties = yield* Effect.fromOption(
|
|
85
|
-
Option.fromUndefinedOr(response.ResourceDescription?.Properties),
|
|
86
|
-
).pipe(
|
|
87
|
-
Effect.mapError(
|
|
88
|
-
() =>
|
|
89
|
-
new AwsCloudControlResourceModelMissing({
|
|
90
|
-
typeName: cloudControl.typeName,
|
|
91
|
-
}),
|
|
92
|
-
),
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
const providerModel = yield* Schema.decodeEffect(
|
|
96
|
-
Schema.fromJsonString(Schema.Json),
|
|
97
|
-
)(properties);
|
|
98
|
-
|
|
99
|
-
const identified: ResourceNode = Struct.assign(node, {
|
|
100
|
-
cloudControlIdentifier,
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
const hydratedNode: ResourceNode = yield* resourceModel.withOutputs(
|
|
104
|
-
identified,
|
|
105
|
-
providerModel,
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
const result: Extract<
|
|
109
|
-
ResourceCommandResult,
|
|
110
|
-
{ readonly _tag: "Observed" }
|
|
111
|
-
> = ResourceCommandResult.Observed({
|
|
112
|
-
observation: ResourceObservation.Present({
|
|
113
|
-
node: hydratedNode,
|
|
114
|
-
observed: providerModel,
|
|
115
|
-
}),
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
return result;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Resource discovery matches provider models against desired properties
|
|
123
|
-
* when a declaration has no saved provider identifier. A match produces
|
|
124
|
-
* an observed node; no match produces a missing-resource observation.
|
|
125
|
-
*/
|
|
126
|
-
const discoverResource = Effect.fn(
|
|
127
|
-
"AwsCloudControlResourceLifecycle.discoverResource",
|
|
128
|
-
)(function* (node: ResourceNode) {
|
|
129
|
-
const cloudControl = yield* Option.fromUndefinedOr(
|
|
130
|
-
node.schema.cloudControl,
|
|
131
|
-
).pipe(
|
|
132
|
-
Effect.fromOption,
|
|
133
|
-
Effect.mapError(() => new AwsCloudControlMetadataMissing({ node })),
|
|
134
|
-
);
|
|
135
|
-
|
|
136
|
-
const resources = yield* client
|
|
137
|
-
.listResourceDescriptions({
|
|
138
|
-
TypeName: cloudControl.typeName,
|
|
139
|
-
})
|
|
140
|
-
.pipe(
|
|
141
|
-
Stream.runCollect,
|
|
142
|
-
Effect.mapError(
|
|
143
|
-
(cause) =>
|
|
144
|
-
new AwsCloudControlRequestFailed({
|
|
145
|
-
typeName: cloudControl.typeName,
|
|
146
|
-
cause,
|
|
147
|
-
}),
|
|
148
|
-
),
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
const identifiers = Arr.getSomes(
|
|
152
|
-
Arr.map(resources, (description) =>
|
|
153
|
-
Option.fromUndefinedOr(description.Identifier),
|
|
154
|
-
),
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
const candidates = yield* Effect.forEach(identifiers, (identifier) =>
|
|
158
|
-
readResourceByIdentifier(node, identifier),
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
const matchedResource = Arr.findFirst(candidates, ({ observation }) =>
|
|
162
|
-
Match.value(observation).pipe(
|
|
163
|
-
Match.when({ _tag: "Present" }, ({ observed }) =>
|
|
164
|
-
Arr.every(
|
|
165
|
-
JsonPatch.get(observed, node.props),
|
|
166
|
-
(patch) => patch.op === "remove",
|
|
167
|
-
),
|
|
168
|
-
),
|
|
169
|
-
Match.orElse(() => false),
|
|
170
|
-
),
|
|
171
|
-
);
|
|
172
|
-
|
|
173
|
-
const result: Extract<
|
|
174
|
-
ResourceCommandResult,
|
|
175
|
-
{ readonly _tag: "Observed" }
|
|
176
|
-
> = yield* Option.match(matchedResource, {
|
|
177
|
-
onNone: () =>
|
|
178
|
-
Effect.succeed(
|
|
179
|
-
ResourceCommandResult.Observed({
|
|
180
|
-
observation: ResourceObservation.Missing({ node }),
|
|
181
|
-
}),
|
|
182
|
-
),
|
|
183
|
-
onSome: Effect.succeed,
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
return result;
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* The readResource service method reports whether the resource exists in AWS through its saved
|
|
191
|
-
* identifier when available. Declarations without that identity use
|
|
192
|
-
* discovery. A provider NotFound response becomes a missing observation
|
|
193
|
-
* so reconciliation can distinguish remote deletion from a failed read.
|
|
194
|
-
*/
|
|
195
|
-
const readResource = Effect.fn(
|
|
196
|
-
"AwsCloudControlResourceLifecycle.readResource",
|
|
197
|
-
)(
|
|
198
|
-
function* (node: ResourceNode) {
|
|
199
|
-
yield* Effect.spanAnnotations.pipe(
|
|
200
|
-
Effect.flatMap(Effect.annotateCurrentSpan),
|
|
201
|
-
);
|
|
202
|
-
|
|
203
|
-
const result: Extract<
|
|
204
|
-
ResourceCommandResult,
|
|
205
|
-
{ readonly _tag: "Observed" }
|
|
206
|
-
> = yield* Option.match(
|
|
207
|
-
Option.fromUndefinedOr(node.cloudControlIdentifier),
|
|
208
|
-
{
|
|
209
|
-
onNone: () => discoverResource(node),
|
|
210
|
-
onSome: (identifier) =>
|
|
211
|
-
readResourceByIdentifier(node, identifier).pipe(
|
|
212
|
-
Effect.catchTag("AwsCloudControlRequestFailed", (failure) =>
|
|
213
|
-
Match.value(failure.cause).pipe(
|
|
214
|
-
Match.when(
|
|
215
|
-
{
|
|
216
|
-
_tag: "AwsServiceError",
|
|
217
|
-
code: "ResourceNotFoundException",
|
|
218
|
-
},
|
|
219
|
-
() =>
|
|
220
|
-
Effect.succeed(
|
|
221
|
-
ResourceCommandResult.Observed({
|
|
222
|
-
observation: ResourceObservation.Missing({
|
|
223
|
-
node,
|
|
224
|
-
}),
|
|
225
|
-
}),
|
|
226
|
-
),
|
|
227
|
-
),
|
|
228
|
-
Match.orElse(() => Effect.fail(failure)),
|
|
229
|
-
),
|
|
230
|
-
),
|
|
231
|
-
),
|
|
232
|
-
},
|
|
233
|
-
);
|
|
234
|
-
|
|
235
|
-
return result;
|
|
236
|
-
},
|
|
237
|
-
(effect, node) =>
|
|
238
|
-
effect.pipe(
|
|
239
|
-
Effect.annotateSpans({
|
|
240
|
-
"nomoss.resource.logical_id": node.key.logicalId,
|
|
241
|
-
"nomoss.resource.operation": "Read",
|
|
242
|
-
"nomoss.resource.provider": node.schema.provider,
|
|
243
|
-
"nomoss.resource.service": node.schema.service,
|
|
244
|
-
"nomoss.resource.type":
|
|
245
|
-
node.schema.cloudControl?.typeName ?? node.schema.resource,
|
|
246
|
-
}),
|
|
247
|
-
),
|
|
248
|
-
);
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Creation returns the validated provider model and identifier after AWS
|
|
252
|
-
* reports successful completion. An accepted request alone does not make
|
|
253
|
-
* outputs available to dependent resources.
|
|
254
|
-
*/
|
|
255
|
-
const createResource = Effect.fn(
|
|
256
|
-
"AwsCloudControlResourceLifecycle.createResource",
|
|
257
|
-
)(function* (node: ResourceNode) {
|
|
258
|
-
const cloudControl = yield* Option.fromUndefinedOr(
|
|
259
|
-
node.schema.cloudControl,
|
|
260
|
-
).pipe(
|
|
261
|
-
Effect.fromOption,
|
|
262
|
-
Effect.mapError(() => new AwsCloudControlMetadataMissing({ node })),
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
const desiredState = yield* Schema.encodeEffect(
|
|
266
|
-
Schema.fromJsonString(Schema.Json),
|
|
267
|
-
)(node.props).pipe(
|
|
268
|
-
Effect.mapError(
|
|
269
|
-
(cause) =>
|
|
270
|
-
new AwsCloudControlRequestFailed({
|
|
271
|
-
typeName: cloudControl.typeName,
|
|
272
|
-
cause,
|
|
273
|
-
}),
|
|
274
|
-
),
|
|
275
|
-
);
|
|
276
|
-
|
|
277
|
-
const response = yield* client
|
|
278
|
-
.createResource({
|
|
279
|
-
TypeName: cloudControl.typeName,
|
|
280
|
-
DesiredState: desiredState,
|
|
281
|
-
})
|
|
282
|
-
.pipe(
|
|
283
|
-
Effect.mapError(
|
|
284
|
-
(cause) =>
|
|
285
|
-
new AwsCloudControlRequestFailed({
|
|
286
|
-
typeName: cloudControl.typeName,
|
|
287
|
-
cause,
|
|
288
|
-
}),
|
|
289
|
-
),
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
const requestToken = yield* Option.fromUndefinedOr(
|
|
293
|
-
response.ProgressEvent?.RequestToken,
|
|
294
|
-
).pipe(
|
|
295
|
-
Effect.fromOption,
|
|
296
|
-
Effect.mapError(() => new AwsCloudControlIdentifierMissing({ node })),
|
|
297
|
-
);
|
|
298
|
-
|
|
299
|
-
const progress = yield* requestTracker.awaitResourceRequest({
|
|
300
|
-
typeName: cloudControl.typeName,
|
|
301
|
-
requestToken,
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
const cloudControlIdentifier = yield* Option.fromUndefinedOr(
|
|
305
|
-
progress.Identifier,
|
|
306
|
-
).pipe(
|
|
307
|
-
Effect.fromOption,
|
|
308
|
-
Effect.mapError(() => new AwsCloudControlIdentifierMissing({ node })),
|
|
309
|
-
);
|
|
310
|
-
|
|
311
|
-
const observed = yield* readResourceByIdentifier(
|
|
312
|
-
node,
|
|
313
|
-
cloudControlIdentifier,
|
|
314
|
-
);
|
|
315
|
-
|
|
316
|
-
const result: ResourceCommandResult = ResourceCommandResult.Created({
|
|
317
|
-
node: observed.observation.node,
|
|
318
|
-
});
|
|
319
|
-
|
|
320
|
-
return result;
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* The updateResource service method uses the saved provider identity to
|
|
325
|
-
* apply desired property changes to the resource. Its result contains the
|
|
326
|
-
* validated model after stabilization for saved state and dependent
|
|
327
|
-
* resource outputs.
|
|
328
|
-
*/
|
|
329
|
-
const updateResource = Effect.fn(
|
|
330
|
-
"AwsCloudControlResourceLifecycle.updateResource",
|
|
331
|
-
)(function* (node: ResourceNode, current: ResourceNode) {
|
|
332
|
-
const cloudControl = yield* Option.fromUndefinedOr(
|
|
333
|
-
current.schema.cloudControl,
|
|
334
|
-
).pipe(
|
|
335
|
-
Effect.fromOption,
|
|
336
|
-
Effect.mapError(
|
|
337
|
-
() => new AwsCloudControlMetadataMissing({ node: current }),
|
|
338
|
-
),
|
|
339
|
-
);
|
|
340
|
-
|
|
341
|
-
const cloudControlIdentifier = yield* Option.fromUndefinedOr(
|
|
342
|
-
current.cloudControlIdentifier,
|
|
343
|
-
).pipe(
|
|
344
|
-
Effect.fromOption,
|
|
345
|
-
Effect.mapError(
|
|
346
|
-
() => new AwsCloudControlIdentifierMissing({ node: current }),
|
|
347
|
-
),
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
const patchDocument = yield* Schema.encodeEffect(
|
|
351
|
-
Schema.fromJsonString(Schema.Json),
|
|
352
|
-
)(JsonPatch.get(current.props, node.props)).pipe(
|
|
353
|
-
Effect.mapError(
|
|
354
|
-
(cause) =>
|
|
355
|
-
new AwsCloudControlRequestFailed({
|
|
356
|
-
typeName: cloudControl.typeName,
|
|
357
|
-
cause,
|
|
358
|
-
}),
|
|
359
|
-
),
|
|
360
|
-
);
|
|
361
|
-
|
|
362
|
-
const response = yield* client
|
|
363
|
-
.updateResource({
|
|
364
|
-
TypeName: cloudControl.typeName,
|
|
365
|
-
Identifier: cloudControlIdentifier,
|
|
366
|
-
PatchDocument: patchDocument,
|
|
367
|
-
})
|
|
368
|
-
.pipe(
|
|
369
|
-
Effect.mapError(
|
|
370
|
-
(cause) =>
|
|
371
|
-
new AwsCloudControlRequestFailed({
|
|
372
|
-
typeName: cloudControl.typeName,
|
|
373
|
-
cause,
|
|
374
|
-
}),
|
|
375
|
-
),
|
|
376
|
-
);
|
|
377
|
-
|
|
378
|
-
const requestToken = yield* Option.fromUndefinedOr(
|
|
379
|
-
response.ProgressEvent?.RequestToken,
|
|
380
|
-
).pipe(
|
|
381
|
-
Effect.fromOption,
|
|
382
|
-
Effect.mapError(
|
|
383
|
-
() => new AwsCloudControlIdentifierMissing({ node: current }),
|
|
384
|
-
),
|
|
385
|
-
);
|
|
386
|
-
|
|
387
|
-
yield* requestTracker.awaitResourceRequest({
|
|
388
|
-
typeName: cloudControl.typeName,
|
|
389
|
-
requestToken,
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
const observed = yield* readResourceByIdentifier(
|
|
393
|
-
node,
|
|
394
|
-
cloudControlIdentifier,
|
|
395
|
-
);
|
|
396
|
-
|
|
397
|
-
const result: ResourceCommandResult = ResourceCommandResult.Updated({
|
|
398
|
-
node: observed.observation.node,
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
return result;
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* Destruction reports success once the identified resource is gone.
|
|
406
|
-
* Successful deletion and an accepted request that reports NotFound both
|
|
407
|
-
* establish that result for teardown callers.
|
|
408
|
-
*/
|
|
409
|
-
const destroyResource = Effect.fn(
|
|
410
|
-
"AwsCloudControlResourceLifecycle.destroyResource",
|
|
411
|
-
)(function* (node: ResourceNode) {
|
|
412
|
-
const cloudControl = yield* Option.fromUndefinedOr(
|
|
413
|
-
node.schema.cloudControl,
|
|
414
|
-
).pipe(
|
|
415
|
-
Effect.fromOption,
|
|
416
|
-
Effect.mapError(() => new AwsCloudControlMetadataMissing({ node })),
|
|
417
|
-
);
|
|
418
|
-
|
|
419
|
-
const cloudControlIdentifier = yield* Option.fromUndefinedOr(
|
|
420
|
-
node.cloudControlIdentifier,
|
|
421
|
-
).pipe(
|
|
422
|
-
Effect.fromOption,
|
|
423
|
-
Effect.mapError(() => new AwsCloudControlIdentifierMissing({ node })),
|
|
424
|
-
);
|
|
425
|
-
|
|
426
|
-
const response = yield* client
|
|
427
|
-
.deleteResource({
|
|
428
|
-
TypeName: cloudControl.typeName,
|
|
429
|
-
Identifier: cloudControlIdentifier,
|
|
430
|
-
})
|
|
431
|
-
.pipe(
|
|
432
|
-
Effect.mapError(
|
|
433
|
-
(cause) =>
|
|
434
|
-
new AwsCloudControlRequestFailed({
|
|
435
|
-
typeName: cloudControl.typeName,
|
|
436
|
-
cause,
|
|
437
|
-
}),
|
|
438
|
-
),
|
|
439
|
-
);
|
|
440
|
-
|
|
441
|
-
const requestToken = yield* Option.fromUndefinedOr(
|
|
442
|
-
response.ProgressEvent?.RequestToken,
|
|
443
|
-
).pipe(
|
|
444
|
-
Effect.fromOption,
|
|
445
|
-
Effect.mapError(() => new AwsCloudControlIdentifierMissing({ node })),
|
|
446
|
-
);
|
|
447
|
-
|
|
448
|
-
yield* requestTracker
|
|
449
|
-
.awaitResourceRequest({
|
|
450
|
-
typeName: cloudControl.typeName,
|
|
451
|
-
requestToken,
|
|
452
|
-
})
|
|
453
|
-
.pipe(
|
|
454
|
-
Effect.catchIf(
|
|
455
|
-
(failure) =>
|
|
456
|
-
failure._tag === "AwsCloudControlOperationFailed" &&
|
|
457
|
-
failure.errorCode === "NotFound",
|
|
458
|
-
() => Effect.void,
|
|
459
|
-
),
|
|
460
|
-
);
|
|
461
|
-
|
|
462
|
-
const result: ResourceCommandResult = ResourceCommandResult.Destroyed({
|
|
463
|
-
node,
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
return result;
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
return {
|
|
470
|
-
readResourceByIdentifier,
|
|
471
|
-
discoverResource,
|
|
472
|
-
readResource,
|
|
473
|
-
createResource,
|
|
474
|
-
updateResource,
|
|
475
|
-
destroyResource,
|
|
476
|
-
};
|
|
477
|
-
}),
|
|
478
|
-
},
|
|
479
|
-
) {}
|
package/src/providers/aws/cloudControl/resources/generated/certificatemanager/certificate/index.ts
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
// Generated from the CloudFormation Registry resource schema. Do not edit.
|
|
2
|
-
// biome-ignore-all lint/complexity/useRegexLiterals: Preserve Effect's generated regular expressions.
|
|
3
|
-
import { Effect, Schema } from "effect";
|
|
4
|
-
import {
|
|
5
|
-
annotateResourceSchema,
|
|
6
|
-
ResourceGraphBuilder,
|
|
7
|
-
type ResourceKey,
|
|
8
|
-
ResourceSchemaAnnotationSchema,
|
|
9
|
-
} from "nomoss/core";
|
|
10
|
-
import { ResourceOutputBinding } from "../../../../../../../core/resource/resourceOutputBinding.js";
|
|
11
|
-
|
|
12
|
-
interface DomainValidationOption {
|
|
13
|
-
readonly DomainName: string;
|
|
14
|
-
readonly ValidationDomain?: string;
|
|
15
|
-
readonly HostedZoneId?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const DomainValidationOption = Schema.Struct({
|
|
19
|
-
DomainName: Schema.String,
|
|
20
|
-
ValidationDomain: Schema.optionalKey(Schema.String),
|
|
21
|
-
HostedZoneId: Schema.optionalKey(Schema.String),
|
|
22
|
-
}).annotate({ identifier: "DomainValidationOption" });
|
|
23
|
-
|
|
24
|
-
interface Tag {
|
|
25
|
-
readonly Value: string;
|
|
26
|
-
readonly Key: string;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const Tag = Schema.Struct({
|
|
30
|
-
Value: Schema.String,
|
|
31
|
-
Key: Schema.String,
|
|
32
|
-
}).annotate({ identifier: "Tag" });
|
|
33
|
-
|
|
34
|
-
export interface CertificateProps {
|
|
35
|
-
readonly CertificateAuthorityArn?: string;
|
|
36
|
-
readonly CertificateExport?: string;
|
|
37
|
-
readonly DomainValidationOptions?: ReadonlyArray<DomainValidationOption>;
|
|
38
|
-
readonly CertificateTransparencyLoggingPreference?: string;
|
|
39
|
-
readonly DomainName: string;
|
|
40
|
-
readonly ValidationMethod?: string;
|
|
41
|
-
readonly SubjectAlternativeNames?: ReadonlyArray<string>;
|
|
42
|
-
readonly Tags?: ReadonlyArray<Tag>;
|
|
43
|
-
readonly KeyAlgorithm?: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export const CertificateResourceSchema = ResourceSchemaAnnotationSchema.make({
|
|
47
|
-
provider: "aws",
|
|
48
|
-
service: "certificatemanager",
|
|
49
|
-
resource: "certificate",
|
|
50
|
-
operation: "create",
|
|
51
|
-
stateSecretOutputKeys: [],
|
|
52
|
-
cloudControl: {
|
|
53
|
-
typeName: "AWS::CertificateManager::Certificate",
|
|
54
|
-
primaryIdentifier: ["/properties/Id"],
|
|
55
|
-
readOnlyProperties: ["/properties/Id"],
|
|
56
|
-
createOnlyProperties: [
|
|
57
|
-
"/properties/SubjectAlternativeNames",
|
|
58
|
-
"/properties/DomainValidationOptions",
|
|
59
|
-
"/properties/ValidationMethod",
|
|
60
|
-
"/properties/KeyAlgorithm",
|
|
61
|
-
"/properties/DomainName",
|
|
62
|
-
"/properties/CertificateAuthorityArn",
|
|
63
|
-
],
|
|
64
|
-
writeOnlyProperties: [],
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
export const CertificatePropsSchema = annotateResourceSchema(
|
|
68
|
-
Schema.Struct({
|
|
69
|
-
CertificateAuthorityArn: Schema.optionalKey(Schema.String),
|
|
70
|
-
CertificateExport: Schema.optionalKey(Schema.String),
|
|
71
|
-
DomainValidationOptions: Schema.optionalKey(
|
|
72
|
-
Schema.Array(DomainValidationOption).check(
|
|
73
|
-
Schema.isUnique().annotate({ expected: "an array with unique items" }),
|
|
74
|
-
),
|
|
75
|
-
),
|
|
76
|
-
CertificateTransparencyLoggingPreference: Schema.optionalKey(Schema.String),
|
|
77
|
-
DomainName: Schema.String,
|
|
78
|
-
ValidationMethod: Schema.optionalKey(Schema.String),
|
|
79
|
-
SubjectAlternativeNames: Schema.optionalKey(
|
|
80
|
-
Schema.Array(Schema.String).check(
|
|
81
|
-
Schema.isUnique().annotate({ expected: "an array with unique items" }),
|
|
82
|
-
),
|
|
83
|
-
),
|
|
84
|
-
Tags: Schema.optionalKey(Schema.Array(Tag)),
|
|
85
|
-
KeyAlgorithm: Schema.optionalKey(Schema.String),
|
|
86
|
-
}),
|
|
87
|
-
CertificateResourceSchema,
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
export interface CertificateOutputs {
|
|
91
|
-
readonly Id?: string;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export const CertificateOutputsSchema = Schema.Struct({
|
|
95
|
-
Id: Schema.optionalKey(Schema.String),
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
export interface CertificateResource {
|
|
99
|
-
readonly key: ResourceKey;
|
|
100
|
-
readonly props: CertificateProps;
|
|
101
|
-
readonly outputs: {
|
|
102
|
-
readonly [Key in keyof CertificateOutputs]-?: Required<CertificateOutputs>[Key];
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export const registerCertificate = Effect.fn("Certificate.register")(
|
|
107
|
-
function* (input: {
|
|
108
|
-
readonly key: ResourceKey;
|
|
109
|
-
readonly props: CertificateProps;
|
|
110
|
-
}) {
|
|
111
|
-
const graph = yield* ResourceGraphBuilder;
|
|
112
|
-
const graphResource = yield* graph.resource(input.key);
|
|
113
|
-
|
|
114
|
-
const resourceProps: CertificateProps = yield* Schema.decodeEffect(
|
|
115
|
-
CertificatePropsSchema,
|
|
116
|
-
)(input.props);
|
|
117
|
-
|
|
118
|
-
const resourceOutputs: CertificateOutputs = yield* Schema.decodeEffect(
|
|
119
|
-
CertificateOutputsSchema,
|
|
120
|
-
)({});
|
|
121
|
-
|
|
122
|
-
yield* graphResource.register({
|
|
123
|
-
propsSchema: CertificatePropsSchema,
|
|
124
|
-
outputsSchema: CertificateOutputsSchema,
|
|
125
|
-
props: resourceProps,
|
|
126
|
-
outputs: resourceOutputs,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
const resource: CertificateResource = {
|
|
130
|
-
key: input.key,
|
|
131
|
-
props: resourceProps,
|
|
132
|
-
outputs: {
|
|
133
|
-
get Id(): Required<CertificateOutputs>["Id"] {
|
|
134
|
-
const value: Required<CertificateOutputs>["Id"] =
|
|
135
|
-
ResourceOutputBinding.value(
|
|
136
|
-
graphResource.outputs,
|
|
137
|
-
input.key,
|
|
138
|
-
"Id",
|
|
139
|
-
Schema.requiredKey(CertificateOutputsSchema.fields.Id),
|
|
140
|
-
);
|
|
141
|
-
return value;
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
return resource;
|
|
147
|
-
},
|
|
148
|
-
);
|
|
149
|
-
export const CertificateOutputCatalog = [
|
|
150
|
-
{
|
|
151
|
-
source: {
|
|
152
|
-
provider: "AWS",
|
|
153
|
-
service: "CloudFormation",
|
|
154
|
-
name: "aws-certificatemanager-certificate.json",
|
|
155
|
-
format: "CloudFormation",
|
|
156
|
-
},
|
|
157
|
-
typeName: "AWS::CertificateManager::Certificate",
|
|
158
|
-
primaryIdentifier: ["/properties/Id"],
|
|
159
|
-
createOnlyProperties: [
|
|
160
|
-
"/properties/SubjectAlternativeNames",
|
|
161
|
-
"/properties/DomainValidationOptions",
|
|
162
|
-
"/properties/ValidationMethod",
|
|
163
|
-
"/properties/KeyAlgorithm",
|
|
164
|
-
"/properties/DomainName",
|
|
165
|
-
"/properties/CertificateAuthorityArn",
|
|
166
|
-
],
|
|
167
|
-
writeOnlyProperties: [],
|
|
168
|
-
outputs: {
|
|
169
|
-
Id: {
|
|
170
|
-
schema: {
|
|
171
|
-
type: "string",
|
|
172
|
-
},
|
|
173
|
-
schemaPath: "/properties/Id",
|
|
174
|
-
valuePath: "/Id",
|
|
175
|
-
required: false,
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
];
|