@ludeo/cloud-common 1.0.4 → 1.0.6
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/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/v2/events/pool-item-allocated.event.d.ts +4 -1
- package/dist/v2/events/pool-item-allocated.event.js +11 -4
- package/dist/v2/events/pool-item-allocated.event.js.map +1 -1
- package/dist/v2/events/schedule-task-request.event.js +5 -4
- package/dist/v2/events/schedule-task-request.event.js.map +1 -1
- package/dist/v2/events/token-required.event.js +8 -0
- package/dist/v2/events/token-required.event.js.map +1 -1
- package/dist/v2/types/cloud.d.ts +44 -0
- package/dist/v2/types/cloud.js +100 -0
- package/dist/v2/types/cloud.js.map +1 -0
- package/dist/v2/types/index.d.ts +2 -78
- package/dist/v2/types/index.js +15 -144
- package/dist/v2/types/index.js.map +1 -1
- package/dist/v2/types/pools.d.ts +28 -0
- package/dist/v2/types/pools.js +54 -0
- package/dist/v2/types/pools.js.map +1 -0
- package/package.json +1 -1
- package/src/v2/events/pool-item-allocated.event.ts +6 -1
- package/src/v2/events/schedule-task-request.event.ts +6 -11
- package/src/v2/events/token-required.event.ts +3 -0
- package/src/v2/types/cloud.ts +89 -0
- package/src/v2/types/index.ts +2 -139
- package/src/v2/types/pools.ts +41 -0
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IsEnum,
|
|
3
|
-
IsNumber,
|
|
4
|
-
IsOptional,
|
|
5
|
-
IsString,
|
|
6
|
-
ValidateNested,
|
|
7
|
-
} from "class-validator";
|
|
1
|
+
import { IsEnum, IsNumber, IsOptional, IsString } from "class-validator";
|
|
8
2
|
import { LudeoEvent } from "../../infra/ludeo-event";
|
|
3
|
+
import { ValidateNestedType } from "../../decorators";
|
|
9
4
|
|
|
10
5
|
export class SchedulingData {
|
|
11
6
|
@IsNumber()
|
|
@@ -33,7 +28,7 @@ export class Job {
|
|
|
33
28
|
@IsEnum(JobType)
|
|
34
29
|
type: JobType;
|
|
35
30
|
|
|
36
|
-
@
|
|
31
|
+
@ValidateNestedType(() => KafkaEventJobData)
|
|
37
32
|
jobData: KafkaEventJobData;
|
|
38
33
|
}
|
|
39
34
|
|
|
@@ -44,10 +39,10 @@ class ScheduleTaskRequestEventData {
|
|
|
44
39
|
@IsOptional()
|
|
45
40
|
sourceService?: string;
|
|
46
41
|
|
|
47
|
-
@
|
|
42
|
+
@ValidateNestedType(() => SchedulingData)
|
|
48
43
|
scheduling: SchedulingData;
|
|
49
44
|
|
|
50
|
-
@
|
|
45
|
+
@ValidateNestedType(() => Job)
|
|
51
46
|
job: Job;
|
|
52
47
|
}
|
|
53
48
|
export class ScheduleTaskRequest extends LudeoEvent {
|
|
@@ -61,6 +56,6 @@ export class ScheduleTaskRequest extends LudeoEvent {
|
|
|
61
56
|
|
|
62
57
|
context?: never;
|
|
63
58
|
|
|
64
|
-
@
|
|
59
|
+
@ValidateNestedType(() => ScheduleTaskRequestEventData)
|
|
65
60
|
payload: ScheduleTaskRequestEventData;
|
|
66
61
|
}
|
|
@@ -3,7 +3,10 @@ import { ValidateNestedType } from "../../decorators/validate-nested-type.decora
|
|
|
3
3
|
import { IsBoolean, IsNumber, IsString } from "class-validator";
|
|
4
4
|
|
|
5
5
|
export class TokenRequiredEventData {
|
|
6
|
+
@IsString()
|
|
6
7
|
defaultUser: string;
|
|
8
|
+
|
|
9
|
+
@IsString()
|
|
7
10
|
authSource: string;
|
|
8
11
|
}
|
|
9
12
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { GameCast } from "@ludeo/aws-gamecast-sdk";
|
|
2
|
+
import {
|
|
3
|
+
IsDefined,
|
|
4
|
+
IsNotEmpty,
|
|
5
|
+
IsOptional,
|
|
6
|
+
IsString,
|
|
7
|
+
IsUUID,
|
|
8
|
+
} from "class-validator";
|
|
9
|
+
import { ValidateNestedType } from "../../decorators";
|
|
10
|
+
|
|
11
|
+
export class AWSRequestData {
|
|
12
|
+
@IsString()
|
|
13
|
+
@IsNotEmpty()
|
|
14
|
+
signalRequest: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type CloudProviderRequest = AWSRequestData;
|
|
18
|
+
|
|
19
|
+
export class CloudProviderRequestData {
|
|
20
|
+
@IsUUID()
|
|
21
|
+
authToken: string;
|
|
22
|
+
|
|
23
|
+
@IsUUID()
|
|
24
|
+
appToken: string;
|
|
25
|
+
|
|
26
|
+
@IsDefined()
|
|
27
|
+
@ValidateNestedType(() => AWSRequestData)
|
|
28
|
+
cloudProviderRequest: CloudProviderRequest;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum CloudProvider {
|
|
32
|
+
AWS = "aws",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class AWSResourceCreationConfig {
|
|
36
|
+
streamGroupId: string;
|
|
37
|
+
identifier: GameCast.Identifier;
|
|
38
|
+
additionalEnvironmentVariables?: GameCast.EnvironmentVariables;
|
|
39
|
+
protocol?: GameCast.Protocol;
|
|
40
|
+
connectionTimeoutSeconds?: GameCast.ConnectionTimeoutSeconds;
|
|
41
|
+
sessionLengthSeconds?: GameCast.SessionLengthSeconds;
|
|
42
|
+
applicationIdentifier?: GameCast.Identifier;
|
|
43
|
+
region?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type CloudResourceCreationConfig = AWSResourceCreationConfig;
|
|
47
|
+
|
|
48
|
+
export class AwsAllocationData {
|
|
49
|
+
@IsString()
|
|
50
|
+
streamGroupId: string;
|
|
51
|
+
|
|
52
|
+
@IsString()
|
|
53
|
+
streamSessionId: string;
|
|
54
|
+
|
|
55
|
+
@IsString()
|
|
56
|
+
signalResponse: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type CloudProviderAllocationData = AwsAllocationData;
|
|
60
|
+
|
|
61
|
+
export class AWSResourceProviderSettings {
|
|
62
|
+
@IsString()
|
|
63
|
+
streamSessionId: string;
|
|
64
|
+
|
|
65
|
+
@IsString()
|
|
66
|
+
streamGroupId: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export class AWSCreationResponse {
|
|
70
|
+
@IsOptional()
|
|
71
|
+
signalResponse?: GameCast.SignalResponse;
|
|
72
|
+
|
|
73
|
+
@IsString()
|
|
74
|
+
@IsNotEmpty()
|
|
75
|
+
streamSessionId: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export type CreationResponse = AWSCreationResponse;
|
|
79
|
+
|
|
80
|
+
export class AllocationRequestData {
|
|
81
|
+
@IsString()
|
|
82
|
+
authToken: string;
|
|
83
|
+
|
|
84
|
+
@IsString()
|
|
85
|
+
appToken: string;
|
|
86
|
+
|
|
87
|
+
@ValidateNestedType(() => CloudProviderRequestData)
|
|
88
|
+
cloudProviderRequest: CloudProviderRequest;
|
|
89
|
+
}
|
package/src/v2/types/index.ts
CHANGED
|
@@ -1,139 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
IsUUID,
|
|
4
|
-
IsString,
|
|
5
|
-
IsNotEmpty,
|
|
6
|
-
IsOptional,
|
|
7
|
-
IsNumber,
|
|
8
|
-
IsEnum,
|
|
9
|
-
} from "class-validator";
|
|
10
|
-
import { ValidateNestedType } from "../../decorators/validate-nested-type.decorator";
|
|
11
|
-
import { GameCast } from "@ludeo/aws-gamecast-sdk";
|
|
12
|
-
|
|
13
|
-
export class AWSRequestData {
|
|
14
|
-
@IsString()
|
|
15
|
-
@IsNotEmpty()
|
|
16
|
-
signalRequest: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type CloudProviderRequest = AWSRequestData;
|
|
20
|
-
|
|
21
|
-
export class CloudProviderRequestData {
|
|
22
|
-
@IsUUID()
|
|
23
|
-
authToken: string;
|
|
24
|
-
|
|
25
|
-
@IsUUID()
|
|
26
|
-
appToken: string;
|
|
27
|
-
|
|
28
|
-
@IsDefined()
|
|
29
|
-
@ValidateNestedType(() => AWSRequestData)
|
|
30
|
-
cloudProviderRequest: CloudProviderRequest;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export enum CloudProvider {
|
|
34
|
-
AWS = "aws",
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class AWSResourceCreationConfig {
|
|
38
|
-
streamGroupId: string;
|
|
39
|
-
identifier: GameCast.Identifier;
|
|
40
|
-
additionalEnvironmentVariables?: GameCast.EnvironmentVariables;
|
|
41
|
-
protocol?: GameCast.Protocol;
|
|
42
|
-
connectionTimeoutSeconds?: GameCast.ConnectionTimeoutSeconds;
|
|
43
|
-
sessionLengthSeconds?: GameCast.SessionLengthSeconds;
|
|
44
|
-
applicationIdentifier?: GameCast.Identifier;
|
|
45
|
-
region?: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type CloudResourceCreationConfig = AWSResourceCreationConfig;
|
|
49
|
-
|
|
50
|
-
export enum CloudResourceStatus {
|
|
51
|
-
Allocated = "allocated",
|
|
52
|
-
Available = "available",
|
|
53
|
-
Creating = "creating",
|
|
54
|
-
Allocating = "allocating",
|
|
55
|
-
Error = "error",
|
|
56
|
-
Terminated = "terminated",
|
|
57
|
-
Terminating = "terminating",
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export class AllocateCloudResourceRequestData {
|
|
61
|
-
providerSettings: CloudResourceCreationConfig;
|
|
62
|
-
requestData: CloudProviderRequestData;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export class AwsAllocationData {
|
|
66
|
-
@IsString()
|
|
67
|
-
streamGroupId: string;
|
|
68
|
-
|
|
69
|
-
@IsString()
|
|
70
|
-
streamSessionId: string;
|
|
71
|
-
|
|
72
|
-
@IsString()
|
|
73
|
-
signalResponse: string;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export type CloudProviderAllocationData = AwsAllocationData;
|
|
77
|
-
|
|
78
|
-
export class AWSResourceProviderSettings {
|
|
79
|
-
@IsString()
|
|
80
|
-
streamSessionId: string;
|
|
81
|
-
|
|
82
|
-
@IsString()
|
|
83
|
-
streamGroupId: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export class AWSCreationResponse {
|
|
87
|
-
@IsOptional()
|
|
88
|
-
signalResponse?: GameCast.SignalResponse;
|
|
89
|
-
|
|
90
|
-
@IsString()
|
|
91
|
-
@IsNotEmpty()
|
|
92
|
-
streamSessionId: string;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export type CreationResponse = AWSCreationResponse;
|
|
96
|
-
|
|
97
|
-
export enum CloudPoolStatus {
|
|
98
|
-
Active = "active",
|
|
99
|
-
Scaling = "scaling",
|
|
100
|
-
Terminated = "terminated",
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export class CloudPoolConfiguration {
|
|
104
|
-
providerSettings?: CloudResourceCreationConfig;
|
|
105
|
-
|
|
106
|
-
@IsEnum(CloudProvider)
|
|
107
|
-
cloudProvider: CloudProvider;
|
|
108
|
-
|
|
109
|
-
@IsUUID()
|
|
110
|
-
poolId: string;
|
|
111
|
-
|
|
112
|
-
@ValidateNestedType(() => PoolScaleConfiguration)
|
|
113
|
-
poolScaleConfiguration: PoolScaleConfiguration;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export type CloudResourcesMap = Record<string, { status: CloudResourceStatus }>;
|
|
117
|
-
|
|
118
|
-
export class PoolScaleConfiguration {
|
|
119
|
-
@IsNumber()
|
|
120
|
-
size: number;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export class PoolItemAllocatedPayload {
|
|
124
|
-
@ValidateNestedType(() => AwsAllocationData)
|
|
125
|
-
allocationData?: CloudProviderAllocationData;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export type CloudResourcesStatusMap = Record<CloudResourceStatus, number>;
|
|
129
|
-
|
|
130
|
-
export class AllocationRequestData {
|
|
131
|
-
@IsString()
|
|
132
|
-
authToken: string;
|
|
133
|
-
|
|
134
|
-
@IsString()
|
|
135
|
-
appToken: string;
|
|
136
|
-
|
|
137
|
-
@ValidateNestedType(() => CloudProviderRequestData)
|
|
138
|
-
cloudProviderRequest: CloudProviderRequest;
|
|
139
|
-
}
|
|
1
|
+
export * from "./cloud";
|
|
2
|
+
export * from "./pools";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IsEnum, IsNumber, IsUUID } from "class-validator";
|
|
2
|
+
import { CloudProvider, CloudResourceCreationConfig } from "./cloud";
|
|
3
|
+
import { ValidateNestedType } from "../../decorators";
|
|
4
|
+
|
|
5
|
+
export enum CloudResourceStatus {
|
|
6
|
+
Allocated = "allocated",
|
|
7
|
+
Available = "available",
|
|
8
|
+
Creating = "creating",
|
|
9
|
+
Allocating = "allocating",
|
|
10
|
+
Error = "error",
|
|
11
|
+
Terminated = "terminated",
|
|
12
|
+
Terminating = "terminating",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum CloudPoolStatus {
|
|
16
|
+
Active = "active",
|
|
17
|
+
Scaling = "scaling",
|
|
18
|
+
Terminated = "terminated",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class CloudPoolConfiguration {
|
|
22
|
+
providerSettings?: CloudResourceCreationConfig;
|
|
23
|
+
|
|
24
|
+
@IsEnum(CloudProvider)
|
|
25
|
+
cloudProvider: CloudProvider;
|
|
26
|
+
|
|
27
|
+
@IsUUID()
|
|
28
|
+
poolId: string;
|
|
29
|
+
|
|
30
|
+
@ValidateNestedType(() => PoolScaleConfiguration)
|
|
31
|
+
poolScaleConfiguration: PoolScaleConfiguration;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type CloudResourcesMap = Record<string, { status: CloudResourceStatus }>;
|
|
35
|
+
|
|
36
|
+
export class PoolScaleConfiguration {
|
|
37
|
+
@IsNumber()
|
|
38
|
+
size: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type CloudResourcesStatusMap = Record<CloudResourceStatus, number>;
|