Skip to content

Commit 00d6681

Browse files
committed
Merge branch 'main' into umutuzgur/sc-23256/pwt-native-code-package-simple
2 parents 6c68959 + a40576b commit 00d6681

File tree

6 files changed

+182
-0
lines changed

6 files changed

+182
-0
lines changed

Diff for: packages/cli/e2e/__tests__/deploy.spec.ts

+3
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ Update and Unchanged:
245245
Dashboard: dashboard-1
246246
MaintenanceWindow: maintenance-window-1
247247
PrivateLocation: private-location-1
248+
StatusPage: test-page-1
249+
StatusPageService: bar-service
250+
StatusPageService: foo-service
248251
`)
249252
expect(resultTwo.stdout).toContain(
250253
`Create:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* eslint-disable no-new */
2+
3+
import { StatusPage, StatusPageService } from 'checkly/constructs'
4+
5+
const fooService = new StatusPageService('foo-service', {
6+
name: 'Foo',
7+
})
8+
9+
const barService = new StatusPageService('bar-service', {
10+
name: 'Bar',
11+
})
12+
13+
new StatusPage('test-page-1', {
14+
name: 'Test Status Page 1',
15+
url: 'checkly-internal-test-status-page-18671',
16+
cards: [{
17+
name: 'Card 1',
18+
services: [
19+
fooService,
20+
barService,
21+
],
22+
}],
23+
})

Diff for: packages/cli/src/constructs/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ export * from './tcp-check'
2929
export * from './incidentio-alert-channel'
3030
export * from './msteams-alert-channel'
3131
export * from './telegram-alert-channel'
32+
export * from './status-page'
33+
export * from './status-page-service'
3234
export * from './playwright-check'

Diff for: packages/cli/src/constructs/project.ts

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type { Runtime } from '../rest/runtimes'
88
import {
99
Check, AlertChannelSubscription, AlertChannel, CheckGroup, MaintenanceWindow, Dashboard,
1010
PrivateLocation, HeartbeatCheck, PrivateLocationCheckAssignment, PrivateLocationGroupAssignment,
11+
StatusPage, StatusPageService,
1112
} from './'
1213
import { ResourceSync } from '../rest/projects'
1314
import { PrivateLocationApi } from '../rest/private-locations'
@@ -33,6 +34,8 @@ export interface ProjectData {
3334
'private-location-check-assignment': Record<string, PrivateLocationCheckAssignment>,
3435
'private-location-group-assignment': Record<string, PrivateLocationGroupAssignment>,
3536
dashboard: Record<string, Dashboard>,
37+
'status-page': Record<string, StatusPage>,
38+
'status-page-service': Record<string, StatusPageService>,
3639
}
3740

3841
export class Project extends Construct {
@@ -49,6 +52,8 @@ export class Project extends Construct {
4952
'private-location-check-assignment': {},
5053
'private-location-group-assignment': {},
5154
dashboard: {},
55+
'status-page': {},
56+
'status-page-service': {},
5257
}
5358

5459
static readonly __checklyType = 'project'
@@ -99,6 +104,8 @@ export class Project extends Construct {
99104
...this.synthesizeRecord(this.data['private-location-check-assignment']),
100105
...this.synthesizeRecord(this.data['private-location-group-assignment']),
101106
...this.synthesizeRecord(this.data.dashboard),
107+
...this.synthesizeRecord(this.data['status-page-service']),
108+
...this.synthesizeRecord(this.data['status-page']),
102109
],
103110
}
104111
}

Diff for: packages/cli/src/constructs/status-page-service.ts

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Construct } from './construct'
2+
import { Session } from './project'
3+
4+
export interface StatusPageServiceProps {
5+
/**
6+
* The name of the service.
7+
*/
8+
name: string
9+
}
10+
11+
/**
12+
* Creates a Service for Status Pages
13+
*/
14+
export class StatusPageService extends Construct {
15+
name: string
16+
17+
static readonly __checklyType = 'status-page-service'
18+
19+
/**
20+
* Constructs the Status Page Service instance
21+
*
22+
* @param logicalId unique project-scoped resource name identification
23+
* @param props status page service configuration properties
24+
*
25+
* {@link https://checklyhq.com/docs/cli/constructs-reference/#statuspageservice Read more in the docs}
26+
*/
27+
constructor (logicalId: string, props: StatusPageServiceProps) {
28+
super(StatusPageService.__checklyType, logicalId)
29+
this.name = props.name
30+
31+
Session.registerConstruct(this)
32+
}
33+
34+
synthesize (): any|null {
35+
return {
36+
name: this.name,
37+
}
38+
}
39+
}

Diff for: packages/cli/src/constructs/status-page.ts

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import { Construct } from './construct'
2+
import { Session } from './project'
3+
import { StatusPageService } from './status-page-service'
4+
import { Ref } from './ref'
5+
6+
export interface StatusPageCardProps {
7+
/**
8+
* The name of the card.
9+
*/
10+
name: string
11+
/**
12+
* A list of services to include in the card.
13+
*/
14+
services?: StatusPageService[]
15+
}
16+
17+
export type StatusPageTheme = 'AUTO' | 'DARK' | 'LIGHT'
18+
19+
export interface StatusPageProps {
20+
/**
21+
* The name of the status page.
22+
*/
23+
name: string
24+
/**
25+
* The URL of the status page.
26+
*/
27+
url: string
28+
/**
29+
* A list of cards to add to your status page.
30+
*/
31+
cards: StatusPageCardProps[]
32+
/**
33+
* A custom user domain, e.g. "status.example.com". See the docs on updating your DNS and SSL usage.
34+
*/
35+
customDomain?: string
36+
/**
37+
* A URL pointing to an image file that serves as the logo for the status page.
38+
*/
39+
logo?: string
40+
/**
41+
* The URL that clicking the logo should redirect the user to.
42+
*/
43+
redirectTo?: string
44+
/**
45+
* A URL pointing to an image file to be used as the favicon for the status page.
46+
*/
47+
favicon?: string
48+
/**
49+
* The default theme of the status page.
50+
*/
51+
defaultTheme?: StatusPageTheme
52+
}
53+
54+
/**
55+
* Creates a Status Page
56+
*/
57+
export class StatusPage extends Construct {
58+
name: string
59+
cards: StatusPageCardProps[]
60+
url: string
61+
customDomain?: string
62+
logo?: string
63+
redirectTo?: string
64+
favicon?: string
65+
defaultTheme?: StatusPageTheme
66+
67+
static readonly __checklyType = 'status-page'
68+
69+
/**
70+
* Constructs the Status Page instance
71+
*
72+
* @param logicalId unique project-scoped resource name identification
73+
* @param props status page configuration properties
74+
*
75+
* {@link https://checklyhq.com/docs/cli/constructs-reference/#statuspage Read more in the docs}
76+
*/
77+
constructor (logicalId: string, props: StatusPageProps) {
78+
super(StatusPage.__checklyType, logicalId)
79+
this.name = props.name
80+
this.url = props.url
81+
this.cards = props.cards
82+
this.customDomain = props.customDomain
83+
this.logo = props.logo
84+
this.redirectTo = props.redirectTo
85+
this.favicon = props.favicon
86+
this.defaultTheme = props.defaultTheme
87+
88+
Session.registerConstruct(this)
89+
}
90+
91+
synthesize (): any|null {
92+
return {
93+
name: this.name,
94+
url: this.url,
95+
customDomain: this.customDomain,
96+
logo: this.logo,
97+
redirectTo: this.redirectTo,
98+
favicon: this.favicon,
99+
defaultTheme: this.defaultTheme,
100+
cards: this.cards.map(card => ({
101+
name: card.name,
102+
services: card
103+
.services
104+
?.map((service) => Ref.from(service.logicalId)),
105+
})),
106+
}
107+
}
108+
}

0 commit comments

Comments
 (0)