awscdk-construct-mediaconnect-flow 0.0.0

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/API.md ADDED
@@ -0,0 +1,343 @@
1
+ # API Reference <a name="API Reference" id="api-reference"></a>
2
+
3
+ ## Constructs <a name="Constructs" id="Constructs"></a>
4
+
5
+ ### LiveFeedFromFile <a name="LiveFeedFromFile" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile"></a>
6
+
7
+ #### Initializers <a name="Initializers" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.Initializer"></a>
8
+
9
+ ```typescript
10
+ import { LiveFeedFromFile } from 'awscdk-construct-mediaconnect-flow'
11
+
12
+ new LiveFeedFromFile(scope: Construct, id: string, props: LiveFeedFromFileProps)
13
+ ```
14
+
15
+ | **Name** | **Type** | **Description** |
16
+ | --- | --- | --- |
17
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFile.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
18
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFile.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
19
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFile.Initializer.parameter.props">props</a></code> | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps">LiveFeedFromFileProps</a></code> | *No description.* |
20
+
21
+ ---
22
+
23
+ ##### `scope`<sup>Required</sup> <a name="scope" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.Initializer.parameter.scope"></a>
24
+
25
+ - *Type:* constructs.Construct
26
+
27
+ ---
28
+
29
+ ##### `id`<sup>Required</sup> <a name="id" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.Initializer.parameter.id"></a>
30
+
31
+ - *Type:* string
32
+
33
+ ---
34
+
35
+ ##### `props`<sup>Required</sup> <a name="props" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.Initializer.parameter.props"></a>
36
+
37
+ - *Type:* <a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps">LiveFeedFromFileProps</a>
38
+
39
+ ---
40
+
41
+ #### Methods <a name="Methods" id="Methods"></a>
42
+
43
+ | **Name** | **Description** |
44
+ | --- | --- |
45
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFile.toString">toString</a></code> | Returns a string representation of this construct. |
46
+
47
+ ---
48
+
49
+ ##### `toString` <a name="toString" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.toString"></a>
50
+
51
+ ```typescript
52
+ public toString(): string
53
+ ```
54
+
55
+ Returns a string representation of this construct.
56
+
57
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
58
+
59
+ | **Name** | **Description** |
60
+ | --- | --- |
61
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFile.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
62
+
63
+ ---
64
+
65
+ ##### `isConstruct` <a name="isConstruct" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.isConstruct"></a>
66
+
67
+ ```typescript
68
+ import { LiveFeedFromFile } from 'awscdk-construct-mediaconnect-flow'
69
+
70
+ LiveFeedFromFile.isConstruct(x: any)
71
+ ```
72
+
73
+ Checks if `x` is a construct.
74
+
75
+ Use this method instead of `instanceof` to properly detect `Construct`
76
+ instances, even when the construct library is symlinked.
77
+
78
+ Explanation: in JavaScript, multiple copies of the `constructs` library on
79
+ disk are seen as independent, completely different libraries. As a
80
+ consequence, the class `Construct` in each copy of the `constructs` library
81
+ is seen as a different class, and an instance of one class will not test as
82
+ `instanceof` the other class. `npm install` will not create installations
83
+ like this, but users may manually symlink construct libraries together or
84
+ use a monorepo tool: in those cases, multiple copies of the `constructs`
85
+ library can be accidentally installed, and `instanceof` will behave
86
+ unpredictably. It is safest to avoid using `instanceof`, and using
87
+ this type-testing method instead.
88
+
89
+ ###### `x`<sup>Required</sup> <a name="x" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.isConstruct.parameter.x"></a>
90
+
91
+ - *Type:* any
92
+
93
+ Any object.
94
+
95
+ ---
96
+
97
+ #### Properties <a name="Properties" id="Properties"></a>
98
+
99
+ | **Name** | **Type** | **Description** |
100
+ | --- | --- | --- |
101
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFile.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
102
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFile.property.flow">flow</a></code> | <code>aws-cdk-lib.aws_mediaconnect.CfnFlow</code> | *No description.* |
103
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFile.property.vpc">vpc</a></code> | <code>aws-cdk-lib.aws_ec2.IVpc</code> | *No description.* |
104
+
105
+ ---
106
+
107
+ ##### `node`<sup>Required</sup> <a name="node" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.property.node"></a>
108
+
109
+ ```typescript
110
+ public readonly node: Node;
111
+ ```
112
+
113
+ - *Type:* constructs.Node
114
+
115
+ The tree node.
116
+
117
+ ---
118
+
119
+ ##### `flow`<sup>Required</sup> <a name="flow" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.property.flow"></a>
120
+
121
+ ```typescript
122
+ public readonly flow: CfnFlow;
123
+ ```
124
+
125
+ - *Type:* aws-cdk-lib.aws_mediaconnect.CfnFlow
126
+
127
+ ---
128
+
129
+ ##### `vpc`<sup>Optional</sup> <a name="vpc" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFile.property.vpc"></a>
130
+
131
+ ```typescript
132
+ public readonly vpc: IVpc;
133
+ ```
134
+
135
+ - *Type:* aws-cdk-lib.aws_ec2.IVpc
136
+
137
+ ---
138
+
139
+
140
+ ## Structs <a name="Structs" id="Structs"></a>
141
+
142
+ ### FileSpec <a name="FileSpec" id="awscdk-construct-mediaconnect-flow.FileSpec"></a>
143
+
144
+ #### Initializer <a name="Initializer" id="awscdk-construct-mediaconnect-flow.FileSpec.Initializer"></a>
145
+
146
+ ```typescript
147
+ import { FileSpec } from 'awscdk-construct-mediaconnect-flow'
148
+
149
+ const fileSpec: FileSpec = { ... }
150
+ ```
151
+
152
+ #### Properties <a name="Properties" id="Properties"></a>
153
+
154
+ | **Name** | **Type** | **Description** |
155
+ | --- | --- | --- |
156
+ | <code><a href="#awscdk-construct-mediaconnect-flow.FileSpec.property.url">url</a></code> | <code>string</code> | *No description.* |
157
+ | <code><a href="#awscdk-construct-mediaconnect-flow.FileSpec.property.type">type</a></code> | <code>string</code> | *No description.* |
158
+
159
+ ---
160
+
161
+ ##### `url`<sup>Required</sup> <a name="url" id="awscdk-construct-mediaconnect-flow.FileSpec.property.url"></a>
162
+
163
+ ```typescript
164
+ public readonly url: string;
165
+ ```
166
+
167
+ - *Type:* string
168
+
169
+ ---
170
+
171
+ ##### `type`<sup>Optional</sup> <a name="type" id="awscdk-construct-mediaconnect-flow.FileSpec.property.type"></a>
172
+
173
+ ```typescript
174
+ public readonly type: string;
175
+ ```
176
+
177
+ - *Type:* string
178
+
179
+ ---
180
+
181
+ ### LiveFeedFromFileProps <a name="LiveFeedFromFileProps" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps"></a>
182
+
183
+ #### Initializer <a name="Initializer" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.Initializer"></a>
184
+
185
+ ```typescript
186
+ import { LiveFeedFromFileProps } from 'awscdk-construct-mediaconnect-flow'
187
+
188
+ const liveFeedFromFileProps: LiveFeedFromFileProps = { ... }
189
+ ```
190
+
191
+ #### Properties <a name="Properties" id="Properties"></a>
192
+
193
+ | **Name** | **Type** | **Description** |
194
+ | --- | --- | --- |
195
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.property.file">file</a></code> | <code><a href="#awscdk-construct-mediaconnect-flow.FileSpec">FileSpec</a></code> | *No description.* |
196
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.property.autoStart">autoStart</a></code> | <code>boolean</code> | *No description.* |
197
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.property.source">source</a></code> | <code><a href="#awscdk-construct-mediaconnect-flow.LiveSourceSpec">LiveSourceSpec</a></code> | *No description.* |
198
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.property.vpcConfig">vpcConfig</a></code> | <code><a href="#awscdk-construct-mediaconnect-flow.VpcConfig">VpcConfig</a></code> | *No description.* |
199
+
200
+ ---
201
+
202
+ ##### `file`<sup>Required</sup> <a name="file" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.property.file"></a>
203
+
204
+ ```typescript
205
+ public readonly file: FileSpec;
206
+ ```
207
+
208
+ - *Type:* <a href="#awscdk-construct-mediaconnect-flow.FileSpec">FileSpec</a>
209
+
210
+ ---
211
+
212
+ ##### `autoStart`<sup>Optional</sup> <a name="autoStart" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.property.autoStart"></a>
213
+
214
+ ```typescript
215
+ public readonly autoStart: boolean;
216
+ ```
217
+
218
+ - *Type:* boolean
219
+
220
+ ---
221
+
222
+ ##### `source`<sup>Optional</sup> <a name="source" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.property.source"></a>
223
+
224
+ ```typescript
225
+ public readonly source: LiveSourceSpec;
226
+ ```
227
+
228
+ - *Type:* <a href="#awscdk-construct-mediaconnect-flow.LiveSourceSpec">LiveSourceSpec</a>
229
+
230
+ ---
231
+
232
+ ##### `vpcConfig`<sup>Optional</sup> <a name="vpcConfig" id="awscdk-construct-mediaconnect-flow.LiveFeedFromFileProps.property.vpcConfig"></a>
233
+
234
+ ```typescript
235
+ public readonly vpcConfig: VpcConfig;
236
+ ```
237
+
238
+ - *Type:* <a href="#awscdk-construct-mediaconnect-flow.VpcConfig">VpcConfig</a>
239
+
240
+ ---
241
+
242
+ ### LiveSourceSpec <a name="LiveSourceSpec" id="awscdk-construct-mediaconnect-flow.LiveSourceSpec"></a>
243
+
244
+ #### Initializer <a name="Initializer" id="awscdk-construct-mediaconnect-flow.LiveSourceSpec.Initializer"></a>
245
+
246
+ ```typescript
247
+ import { LiveSourceSpec } from 'awscdk-construct-mediaconnect-flow'
248
+
249
+ const liveSourceSpec: LiveSourceSpec = { ... }
250
+ ```
251
+
252
+ #### Properties <a name="Properties" id="Properties"></a>
253
+
254
+ | **Name** | **Type** | **Description** |
255
+ | --- | --- | --- |
256
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveSourceSpec.property.protocol">protocol</a></code> | <code>string</code> | *No description.* |
257
+ | <code><a href="#awscdk-construct-mediaconnect-flow.LiveSourceSpec.property.type">type</a></code> | <code>string</code> | *No description.* |
258
+
259
+ ---
260
+
261
+ ##### `protocol`<sup>Required</sup> <a name="protocol" id="awscdk-construct-mediaconnect-flow.LiveSourceSpec.property.protocol"></a>
262
+
263
+ ```typescript
264
+ public readonly protocol: string;
265
+ ```
266
+
267
+ - *Type:* string
268
+
269
+ ---
270
+
271
+ ##### `type`<sup>Required</sup> <a name="type" id="awscdk-construct-mediaconnect-flow.LiveSourceSpec.property.type"></a>
272
+
273
+ ```typescript
274
+ public readonly type: string;
275
+ ```
276
+
277
+ - *Type:* string
278
+
279
+ ---
280
+
281
+ ### VpcConfig <a name="VpcConfig" id="awscdk-construct-mediaconnect-flow.VpcConfig"></a>
282
+
283
+ #### Initializer <a name="Initializer" id="awscdk-construct-mediaconnect-flow.VpcConfig.Initializer"></a>
284
+
285
+ ```typescript
286
+ import { VpcConfig } from 'awscdk-construct-mediaconnect-flow'
287
+
288
+ const vpcConfig: VpcConfig = { ... }
289
+ ```
290
+
291
+ #### Properties <a name="Properties" id="Properties"></a>
292
+
293
+ | **Name** | **Type** | **Description** |
294
+ | --- | --- | --- |
295
+ | <code><a href="#awscdk-construct-mediaconnect-flow.VpcConfig.property.props">props</a></code> | <code>aws-cdk-lib.aws_ec2.VpcProps</code> | *No description.* |
296
+ | <code><a href="#awscdk-construct-mediaconnect-flow.VpcConfig.property.availabilityZone">availabilityZone</a></code> | <code>string</code> | *No description.* |
297
+ | <code><a href="#awscdk-construct-mediaconnect-flow.VpcConfig.property.enableNDI">enableNDI</a></code> | <code>boolean</code> | *No description.* |
298
+ | <code><a href="#awscdk-construct-mediaconnect-flow.VpcConfig.property.subnetId">subnetId</a></code> | <code>string</code> | *No description.* |
299
+
300
+ ---
301
+
302
+ ##### `props`<sup>Required</sup> <a name="props" id="awscdk-construct-mediaconnect-flow.VpcConfig.property.props"></a>
303
+
304
+ ```typescript
305
+ public readonly props: VpcProps;
306
+ ```
307
+
308
+ - *Type:* aws-cdk-lib.aws_ec2.VpcProps
309
+
310
+ ---
311
+
312
+ ##### `availabilityZone`<sup>Optional</sup> <a name="availabilityZone" id="awscdk-construct-mediaconnect-flow.VpcConfig.property.availabilityZone"></a>
313
+
314
+ ```typescript
315
+ public readonly availabilityZone: string;
316
+ ```
317
+
318
+ - *Type:* string
319
+
320
+ ---
321
+
322
+ ##### `enableNDI`<sup>Optional</sup> <a name="enableNDI" id="awscdk-construct-mediaconnect-flow.VpcConfig.property.enableNDI"></a>
323
+
324
+ ```typescript
325
+ public readonly enableNDI: boolean;
326
+ ```
327
+
328
+ - *Type:* boolean
329
+
330
+ ---
331
+
332
+ ##### `subnetId`<sup>Optional</sup> <a name="subnetId" id="awscdk-construct-mediaconnect-flow.VpcConfig.property.subnetId"></a>
333
+
334
+ ```typescript
335
+ public readonly subnetId: string;
336
+ ```
337
+
338
+ - *Type:* string
339
+
340
+ ---
341
+
342
+
343
+
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2025 Kuu Miyazaki
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # awscdk-construct-mediaconnect-flow
2
+ [![View on Construct Hub](https://constructs.dev/badge?package=awscdk-construct-mediaconnect-flow)](https://constructs.dev/packages/awscdk-construct-mediaconnect-flow)
3
+
4
+ CDK Construct for creating MediaConnect flow using a file as a source
5
+ * The file can be either MP4 or TS
6
+ * MediaLive channel will be created internally for producing a live source (SRT or RTP) of the loop playback of the file
7
+ * MediaConnect flow will be returned so you can freely add outputs to it
8
+
9
+ ## Install
10
+ [![NPM](https://nodei.co/npm/awscdk-construct-mediaconnect-flow.png?mini=true)](https://nodei.co/npm/awscdk-construct-mediaconnect-flow/)
11
+
12
+ ## Usage
13
+
14
+ ### Sample code
15
+ Here's an example of setting up a MediaConnect flow using an MP4 file in your S3 bucket as a source.
16
+ The source can be VPC-SOURCE or STANRDAR-SOURCE. A separate VPC will be created internally if you specify vpcConfig.
17
+ 2 outputs are created, a VPC output for NDI protocol and a Standard output for SRT-Listener protocol.
18
+
19
+ ```ts
20
+ import * as cdk from 'aws-cdk-lib';
21
+ import { Construct } from 'constructs';
22
+ import { LiveFeedFromFile } from 'awscdk-construct-mediaconnect-flow';
23
+
24
+ export class ExampleStack extends cdk.Stack {
25
+ constructor(scope: Construct, id: string, props?: cdk.StackProps) {
26
+ super(scope, id, props);
27
+
28
+ const {flow, vpc} = new LiveFeedFromFile(this, 'MediaConnectFlow', {
29
+ file: {
30
+ type: 'MP4_FILE',
31
+ url: 's3://bucket/test.mp4',
32
+ },
33
+ source: {
34
+ protocol: 'SRT',
35
+ type: 'VPC-SOURCE',
36
+ },
37
+ vpcConfig: {
38
+ props: {
39
+ ipAddresses: ec2.IpAddresses.cidr('10.0.0.0/16'),
40
+ flowLogs: {
41
+ 'video-flow-logs': {
42
+ destination: ec2.FlowLogDestination.toCloudWatchLogs(),
43
+ },
44
+ },
45
+ },
46
+ enableNDI: true,
47
+ },
48
+ });
49
+
50
+ if (vpc) {
51
+ // Create a VPC output
52
+ new CfnFlowOutput(this, 'VpcOutput', {
53
+ flowArn: flow.attrFlowArn,
54
+ name: 'vpc-output',
55
+ protocol: 'ndi-speed-hq',
56
+ ndiSpeedHqQuality: 100,
57
+ });
58
+ }
59
+ // Create a Standard output
60
+ new CfnFlowOutput(this, 'StandardOutput', {
61
+ flowArn: flow.attrFlowArn,
62
+ name: 'standard-output',
63
+ protocol: 'srt-listener',
64
+ destination,
65
+ });
66
+
67
+ // Access MediaConnect flow attributes via `flow`
68
+ new cdk.CfnOutput(this, "MediaConnectFlow", {
69
+ value: flow.attrFlowArn,
70
+ exportName: cdk.Aws.STACK_NAME + "MediaConnectFlow",
71
+ description: "MediaConnect Flow ARN",
72
+ });
73
+ }
74
+ }
75
+ ```
@@ -0,0 +1,29 @@
1
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
2
+ import { CfnFlow } from 'aws-cdk-lib/aws-mediaconnect';
3
+ import { Construct } from 'constructs';
4
+ export interface FileSpec {
5
+ readonly type?: 'MP4_FILE' | 'TS_FILE';
6
+ readonly url: string;
7
+ }
8
+ export interface LiveSourceSpec {
9
+ readonly protocol: 'RTP' | 'RTP-FEC' | 'SRT';
10
+ readonly type: 'STANDARD-SOURCE' | 'VPC-SOURCE';
11
+ }
12
+ export interface VpcConfig {
13
+ readonly props: ec2.VpcProps;
14
+ readonly availabilityZone?: string;
15
+ readonly subnetId?: string;
16
+ readonly enableNDI?: boolean;
17
+ }
18
+ export interface LiveFeedFromFileProps {
19
+ readonly file: FileSpec;
20
+ readonly source?: LiveSourceSpec;
21
+ readonly vpcConfig?: VpcConfig;
22
+ readonly autoStart?: boolean;
23
+ }
24
+ export declare class LiveFeedFromFile extends Construct {
25
+ readonly flow: CfnFlow;
26
+ readonly vpc?: ec2.IVpc;
27
+ constructor(scope: Construct, id: string, props: LiveFeedFromFileProps);
28
+ }
29
+ export declare function startFlow(scope: Construct, id: string, flowArn: string): Date;