@stack-spot/portal-network 0.64.2 → 0.65.1

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.
@@ -14,6 +14,25 @@ const oazapfts = Oazapfts.runtime(defaults);
14
14
  export const servers = {
15
15
  generatedServerUrl: "https://cloud-cloud-runtime-api.dev.stackspot.com"
16
16
  };
17
+ export type ScheduleRequest = {
18
+ applicationId: string;
19
+ runtimeId: string;
20
+ startDate: string;
21
+ endDate: string;
22
+ time: string;
23
+ repeats: "NEVER" | "DAILY" | "WEEKLY" | "MONTHLY";
24
+ action: "START" | "STOP" | "RESTART" | "DEPLOY";
25
+ };
26
+ export type ScheduleResponse = {
27
+ applicationId: string;
28
+ runtimeId: string;
29
+ startDate: string;
30
+ endDate: string;
31
+ time: string;
32
+ repeats: "NEVER" | "DAILY" | "WEEKLY" | "MONTHLY";
33
+ action: "START" | "STOP" | "RESTART" | "DEPLOY";
34
+ };
35
+ export type StatusType = number;
17
36
  export type EnvVar = {
18
37
  key: string;
19
38
  value: string;
@@ -45,11 +64,8 @@ export type CreateDeploymentRequestV2 = {
45
64
  health?: string;
46
65
  applicationURL?: string;
47
66
  };
48
- export type StatusType = number;
49
67
  export type SetAutoscalingRequest = {
50
68
  deploymentId: string;
51
- cpu: string;
52
- mem: string;
53
69
  replicaNum: ReplicaNum;
54
70
  applicationName: string;
55
71
  };
@@ -333,6 +349,42 @@ export type GetApplicationByUlidResponse = {
333
349
  createdAt?: string;
334
350
  updatedAt?: string;
335
351
  };
352
+ export function createSchedule({ scheduleRequest }: {
353
+ scheduleRequest: ScheduleRequest;
354
+ }, opts?: Oazapfts.RequestOpts) {
355
+ return oazapfts.ok(oazapfts.fetchJson<{
356
+ status: 200;
357
+ data: ScheduleResponse;
358
+ } | {
359
+ status: 422;
360
+ data: {
361
+ instance?: string;
362
+ "type"?: string;
363
+ parameters?: {
364
+ [key: string]: object;
365
+ };
366
+ title?: string;
367
+ status?: StatusType;
368
+ detail?: string;
369
+ };
370
+ } | {
371
+ status: 500;
372
+ data: {
373
+ instance?: string;
374
+ "type"?: string;
375
+ parameters?: {
376
+ [key: string]: object;
377
+ };
378
+ title?: string;
379
+ status?: StatusType;
380
+ detail?: string;
381
+ };
382
+ }>("/v2/schedule", oazapfts.json({
383
+ ...opts,
384
+ method: "POST",
385
+ body: scheduleRequest
386
+ })));
387
+ }
336
388
  export function createDeployment({ authorization, createDeploymentRequestV2 }: {
337
389
  authorization: string;
338
390
  createDeploymentRequestV2: CreateDeploymentRequestV2;
@@ -373,7 +425,7 @@ export function createDeployment({ authorization, createDeploymentRequestV2 }: {
373
425
  })
374
426
  })));
375
427
  }
376
- export function setAutoscalihng({ authorization, setAutoscalingRequest }: {
428
+ export function setAutoscaling({ authorization, setAutoscalingRequest }: {
377
429
  authorization: string;
378
430
  setAutoscalingRequest: SetAutoscalingRequest;
379
431
  }, opts?: Oazapfts.RequestOpts) {
@@ -829,6 +881,41 @@ export function createApplication1({ applicationDto }: {
829
881
  body: applicationDto
830
882
  })));
831
883
  }
884
+ export function getScheduling({ applicationId, runtimeId }: {
885
+ applicationId: string;
886
+ runtimeId: string;
887
+ }, opts?: Oazapfts.RequestOpts) {
888
+ return oazapfts.ok(oazapfts.fetchJson<{
889
+ status: 200;
890
+ data: ScheduleResponse[];
891
+ } | {
892
+ status: 422;
893
+ data: {
894
+ instance?: string;
895
+ "type"?: string;
896
+ parameters?: {
897
+ [key: string]: object;
898
+ };
899
+ title?: string;
900
+ status?: StatusType;
901
+ detail?: string;
902
+ };
903
+ } | {
904
+ status: 500;
905
+ data: {
906
+ instance?: string;
907
+ "type"?: string;
908
+ parameters?: {
909
+ [key: string]: object;
910
+ };
911
+ title?: string;
912
+ status?: StatusType;
913
+ detail?: string;
914
+ };
915
+ }>(`/v2/schedule/${encodeURIComponent(applicationId)}/runtime/${encodeURIComponent(runtimeId)}`, {
916
+ ...opts
917
+ }));
918
+ }
832
919
  export function getRuntimeByUlid({ runtimeId }: {
833
920
  runtimeId: string;
834
921
  }, opts?: Oazapfts.RequestOpts) {
@@ -1350,47 +1437,6 @@ export function getLastDeploymentByRuntime({ applicationId }: {
1350
1437
  ...opts
1351
1438
  }));
1352
1439
  }
1353
- export function schedule({ applicationId, runtimeId, day, month, minute }: {
1354
- applicationId: string;
1355
- runtimeId: string;
1356
- day: number;
1357
- month: number;
1358
- minute: number;
1359
- }, opts?: Oazapfts.RequestOpts) {
1360
- return oazapfts.ok(oazapfts.fetchJson<{
1361
- status: 200;
1362
- } | {
1363
- status: 422;
1364
- data: {
1365
- instance?: string;
1366
- "type"?: string;
1367
- parameters?: {
1368
- [key: string]: object;
1369
- };
1370
- title?: string;
1371
- status?: StatusType;
1372
- detail?: string;
1373
- };
1374
- } | {
1375
- status: 500;
1376
- data: {
1377
- instance?: string;
1378
- "type"?: string;
1379
- parameters?: {
1380
- [key: string]: object;
1381
- };
1382
- title?: string;
1383
- status?: StatusType;
1384
- detail?: string;
1385
- };
1386
- }>(`/v2/applications/schedule/${encodeURIComponent(applicationId)}/${encodeURIComponent(runtimeId)}${QS.query(QS.explode({
1387
- day,
1388
- month,
1389
- minute
1390
- }))}`, {
1391
- ...opts
1392
- }));
1393
- }
1394
1440
  export function listApplications1({ projectId, limit, offset }: {
1395
1441
  projectId: string;
1396
1442
  limit?: number;
@@ -1,34 +1,27 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import
3
3
  {
4
- createApplication,
5
4
  createCertificate,
6
5
  createCidr,
7
- createDeployment,
6
+ createDnsRecord,
8
7
  createDnsZone,
9
8
  createFolder,
10
9
  createFoundation,
10
+ createNetwork,
11
11
  createProject,
12
+ createSubnet,
12
13
  defaults,
13
- getApplication,
14
- getApplicationHistory,
15
14
  getCertificate,
16
- getDeployment,
17
- getDeploymentHealth,
18
- getDeploymentLogs,
19
- getDeploymentStatus,
20
15
  getFolder,
21
16
  getFoundation,
22
17
  getProject,
23
- getRepositoryImages,
24
- listApplications,
25
18
  listCertificates,
26
19
  listCidr,
27
- listDeployments,
20
+ listDnsRecord,
28
21
  listDnsZone,
29
22
  listFoundations,
30
- listRepositories,
31
- listRuntimes,
23
+ listNetwork,
24
+ listSubnet,
32
25
  providers,
33
26
  } from '../api/cloudPlatform'
34
27
  import apis from '../apis.json'
@@ -46,58 +39,6 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
46
39
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
47
40
  return new DefaultAPIError(error.data, error.status, cntDictionary, error.headers)
48
41
  }
49
- /**
50
- * Get list of applications
51
- */
52
- listApplications = this.query(removeAuthorizationParam(listApplications))
53
- /**
54
- * Get an application by id
55
- */
56
- application = this.query(removeAuthorizationParam(getApplication))
57
- /**
58
- * Get an application history
59
- */
60
- applicationHistory = this.query(removeAuthorizationParam(getApplicationHistory))
61
- /**
62
- * Get list of application deployments
63
- */
64
- listApplicationDeployments = this.query(removeAuthorizationParam(listDeployments))
65
- /**
66
- * Get an application deployment by id
67
- */
68
- applicationDeployment = this.query(removeAuthorizationParam(getDeployment))
69
- /**
70
- * Get an application deployment status
71
- */
72
- applicationDeploymentStatus = this.query(removeAuthorizationParam(getDeploymentStatus))
73
- /**
74
- * Get an application deployment health
75
- */
76
- applicationDeploymentHealth = this.query(removeAuthorizationParam(getDeploymentHealth))
77
- /**
78
- * Get an application deployment logs
79
- */
80
- applicationDeploymentLogs = this.query(removeAuthorizationParam(getDeploymentLogs))
81
- /**
82
- * Get an application runtimes
83
- */
84
- listApplicationRuntimes = this.query(removeAuthorizationParam(listRuntimes))
85
- /**
86
- * Get list of repositories
87
- */
88
- listRepositories = this.query(removeAuthorizationParam(listRepositories))
89
- /**
90
- * Get list of images from a repository
91
- */
92
- listRepositoryImages = this.query(removeAuthorizationParam(getRepositoryImages))
93
- /**
94
- * Create a deploy of the application
95
- */
96
- createDeployment = this.mutation(removeAuthorizationParam(createDeployment))
97
- /**
98
- * Create an application
99
- */
100
- createApplication = this.mutation(removeAuthorizationParam(createApplication))
101
42
  /**
102
43
  * List foundations
103
44
  */
@@ -158,6 +99,30 @@ class CloudPlatformClient extends ReactQueryNetworkClient {
158
99
  * Get a project by id
159
100
  */
160
101
  getProjectById = this.query(removeAuthorizationParam(getProject))
102
+ /**
103
+ * Get a list of dns records
104
+ */
105
+ listDnsRecords= this.query(removeAuthorizationParam(listDnsRecord))
106
+ /**
107
+ * Create a dns record
108
+ */
109
+ createDnsRecord = this.mutation(removeAuthorizationParam(createDnsRecord))
110
+ /**
111
+ * Get a list of networks
112
+ */
113
+ listNetworks= this.query(removeAuthorizationParam(listNetwork))
114
+ /**
115
+ * Create a network
116
+ */
117
+ createNetwork = this.mutation(removeAuthorizationParam(createNetwork))
118
+ /**
119
+ * Get a list of subnets
120
+ */
121
+ listSubnets= this.query(removeAuthorizationParam(listSubnet))
122
+ /**
123
+ * Create a subnet
124
+ */
125
+ createSubnet = this.mutation(removeAuthorizationParam(createSubnet))
161
126
  }
162
127
 
163
128
  export const cloudPlatformClient = new CloudPlatformClient()
@@ -3,6 +3,7 @@ import
3
3
  {
4
4
  createApplication,
5
5
  createDeployment,
6
+ createSchedule,
6
7
  defaults,
7
8
  getApplication,
8
9
  getApplicationHistory,
@@ -13,12 +14,13 @@ import
13
14
  getInstances,
14
15
  getLastDeploymentByRuntime,
15
16
  getRepositoryImages,
17
+ getScheduling,
16
18
  getSecrets,
17
19
  listApplications,
18
20
  listDeployments,
19
21
  listRepositories,
20
22
  listRuntimes,
21
- setAutoscalihng,
23
+ setAutoscaling,
22
24
  startApplication,
23
25
  stopApplication,
24
26
  } from '../api/cloudRuntimes'
@@ -112,7 +114,15 @@ class CloudRuntimesClient extends ReactQueryNetworkClient {
112
114
  /**
113
115
  * Edit application instances
114
116
  */
115
- editApplicationInstances = this.mutation(removeAuthorizationParam(setAutoscalihng))
117
+ editApplicationInstances = this.mutation(removeAuthorizationParam(setAutoscaling))
118
+ /**
119
+ * Configure a schedule for application
120
+ */
121
+ createSchedule = this.mutation(removeAuthorizationParam(createSchedule))
122
+ /**
123
+ * Get application scheduling
124
+ */
125
+ getScheduling = this.query(removeAuthorizationParam(getScheduling))
116
126
  }
117
127
 
118
128