Files
oci-portal-dash/src/api/mock.ts
T

1753 lines
47 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type {
SecuritySetting,
AuditEvent,
BootVolume,
BootVolumeAttachment,
Compartment,
ComputeShape,
ConsoleConnection,
CostItem,
IamUser,
IamUserDetail,
IdentityProvider,
IdentitySetting,
ImageInfo,
Instance,
InstanceTraffic,
Ipv6Report,
LimitItem,
LogEvent,
LogWebhookInfo,
NotificationRecipients,
NotifyEventsSetting,
OciConfig,
Overview,
PasswordPolicy,
RegionInfo,
RegionSubscription,
SecurityList,
SignOnRule,
Subnet,
SubscriptionDetail,
SystemLog,
Task,
TaskLog,
TaskSetting,
TelegramSetting,
Vcn,
Volume,
VolumeAttachment,
} from '@/types/api'
/** mock 数据集:与设计稿展示数据保持一致,便于对照验收 */
function cfg(p: Partial<OciConfig> & Pick<OciConfig, 'id' | 'alias'>): OciConfig {
return {
group: '',
userOcid: 'ocid1.user.oc1..aaaa',
tenancyOcid: `ocid1.tenancy.oc1..${p.alias}xxxx`,
fingerprint: 'e2:d4:00:11:22:33',
region: 'eu-frankfurt-1',
tenancyName: p.alias ?? '',
homeRegionKey: 'FRA',
accountType: 'free',
subscriptionId: 'ocid1.organizationssubscription.oc1..xxx',
paymentModel: 'FREE_TRIAL',
subscriptionTier: 'FREE',
promotionStatus: 'EXPIRED',
promotionAmount: 279,
promotionExpires: '2026-02-21T00:00:00Z',
aliveStatus: 'alive',
lastError: '',
lastVerifiedAt: '2026-07-03T15:40:00+08:00',
multiRegion: false,
multiCompartment: false,
proxyId: null,
proxyName: '',
createdAt: '2026-05-14T10:00:00+08:00',
updatedAt: '2026-07-03T15:40:00+08:00',
...p,
}
}
export const mockProxies = [
{
id: 1,
name: '东京 socks5',
type: 'socks5',
host: '203.0.113.50',
port: 1080,
username: 'relay',
passwordSet: true,
country: '日本',
city: '东京',
geoAt: '2026-07-05T12:00:00+08:00',
usedBy: 1,
createdAt: '2026-07-01T10:00:00+08:00',
},
{
id: 2,
name: '本地 http',
type: 'http',
host: '127.0.0.1',
port: 7890,
username: '',
passwordSet: false,
country: '',
city: '',
geoAt: '2026-07-05T12:00:00+08:00',
usedBy: 0,
createdAt: '2026-07-03T09:30:00+08:00',
},
]
export const mockConfigs: OciConfig[] = [
cfg({
id: 1,
alias: 'XXXX主号',
group: '生产',
tenancyName: 'XXXXmain',
accountType: 'paid',
paymentModel: 'PAYG',
subscriptionTier: 'FREE_AND_PAID',
promotionStatus: 'EXPIRED',
multiRegion: true,
multiCompartment: true,
// 与 mockProxies[0].usedBy = 1 呼应:主号经东京 socks5 出站
proxyId: 1,
proxyName: '东京 socks5',
}),
cfg({
id: 2,
alias: '试用期',
group: '教育',
tenancyName: 'trialacct',
region: 'us-ashburn-1',
homeRegionKey: 'IAD',
accountType: 'trial',
subscriptionTier: 'FREE_AND_TRIAL',
promotionStatus: 'ACTIVE',
promotionExpires: '2026-07-31T00:00:00Z',
}),
cfg({
id: 3,
alias: '新加坡备用',
tenancyName: 'sgbackup',
region: 'ap-singapore-1',
homeRegionKey: 'SIN',
}),
cfg({
id: 4,
alias: '首尔小鸡',
group: '教育',
tenancyName: 'seoulchick',
region: 'ap-seoul-1',
homeRegionKey: 'ICN',
accountType: 'trial',
promotionStatus: 'ACTIVE',
promotionExpires: '2026-07-18T00:00:00Z',
}),
cfg({
id: 5,
alias: '东京主号',
tenancyName: 'tokyomain',
region: 'ap-tokyo-1',
homeRegionKey: 'NRT',
aliveStatus: 'dead',
lastError: 'NotAuthenticated: key expired',
lastVerifiedAt: '2026-07-03T13:40:00+08:00',
}),
cfg({
id: 6,
alias: '伦敦过期',
tenancyName: 'londonold',
region: 'uk-london-1',
homeRegionKey: 'LHR',
aliveStatus: 'dead',
lastError: 'NotAuthenticated: tenancy suspended',
lastVerifiedAt: '2026-07-02T15:00:00+08:00',
}),
cfg({ id: 7, alias: '抢机备号', tenancyName: 'snatchbak' }),
]
function inst(p: Partial<Instance> & Pick<Instance, 'id' | 'displayName'>): Instance {
return {
lifecycleState: 'RUNNING',
shape: 'VM.Standard.A1.Flex',
ocpus: 4,
memoryInGBs: 24,
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
region: 'eu-frankfurt-1',
compartmentId: 'ocid1.compartment.oc1..root',
imageId: 'ocid1.image.oc1.eu-frankfurt-1.ubuntu2404',
imageName: 'Canonical-Ubuntu-24.04-aarch64-2026.05.15-0',
subnetId: 'ocid1.subnet.oc1.eu-frankfurt-1.pub',
privateIp: '10.0.1.2',
publicIp: '130.61.88.147',
ipv6Addresses: ['2603:c020:400d:aa01::1'],
freeformTags: { env: 'prod' },
definedTags: {
'Oracle-Tags': { CreatedBy: 'default/admin', CreatedOn: '2026-05-20T14:32:00.000Z' },
},
timeCreated: '2026-05-20T14:32:00Z',
...p,
}
}
/** 按配置 id 组织的实例 mock */
export const mockInstances: Record<number, Instance[]> = {
1: [
inst({
id: 'ocid1.instance.oc1..web-fra-01',
displayName: 'web-fra-01',
freeformTags: { env: 'prod', RootPassword: 'n^m4#wvErNeESq2K' },
}),
inst({
id: 'ocid1.instance.oc1..web-fra-02',
displayName: 'web-fra-02',
ocpus: 2,
memoryInGBs: 12,
publicIp: '130.61.92.33',
privateIp: '10.0.1.3',
ipv6Addresses: [],
}),
inst({
id: 'ocid1.instance.oc1..app-fra-03',
displayName: 'app-fra-03',
ocpus: 2,
memoryInGBs: 12,
publicIp: '141.147.62.190',
privateIp: '10.0.1.4',
ipv6Addresses: [],
}),
],
2: [
inst({
id: 'ocid1.instance.oc1..dev-ash-01',
displayName: 'dev-ash-01',
shape: 'VM.Standard.E2.1.Micro',
ocpus: 1,
memoryInGBs: 1,
region: 'us-ashburn-1',
availabilityDomain: 'RssO:US-ASHBURN-1-AD-2',
publicIp: '129.153.44.92',
ipv6Addresses: [],
}),
],
3: [
inst({
id: 'ocid1.instance.oc1..db-sgp-01',
displayName: 'db-sgp-01',
shape: 'VM.Standard.E4.Flex',
ocpus: 2,
memoryInGBs: 16,
region: 'ap-singapore-1',
availabilityDomain: 'RssO:AP-SINGAPORE-1-AD-1',
publicIp: '152.69.204.18',
ipv6Addresses: [],
}),
],
4: [
inst({
id: 'ocid1.instance.oc1..proxy-icn-01',
displayName: 'proxy-icn-01',
shape: 'VM.Standard.E2.1.Micro',
ocpus: 1,
memoryInGBs: 1,
lifecycleState: 'STOPPED',
region: 'ap-seoul-1',
availabilityDomain: 'RssO:AP-SEOUL-1-AD-1',
publicIp: '144.24.71.206',
ipv6Addresses: [],
}),
],
5: [
inst({
id: 'ocid1.instance.oc1..backup-nrt-01',
displayName: 'backup-nrt-01',
ocpus: 1,
memoryInGBs: 6,
lifecycleState: 'STOPPED',
region: 'ap-tokyo-1',
availabilityDomain: 'RssO:AP-TOKYO-1-AD-1',
publicIp: '140.238.51.77',
ipv6Addresses: [],
}),
],
6: [],
7: [
inst({
id: 'ocid1.instance.oc1..snatch-fra-a1',
displayName: 'snatch-fra-a1',
lifecycleState: 'PROVISIONING',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-2',
publicIp: '',
ipv6Addresses: [],
}),
],
}
export const mockTasks: Task[] = [
{
id: 1,
name: '每日全量测活',
type: 'health_check',
cronExpr: '0 3 * * *',
payload: '{"ociConfigIds":[]}',
status: 'active',
lastRunAt: '2026-07-03T03:00:00+08:00',
lastError: '',
runCount: 46,
createdAt: '2026-05-18T00:00:00+08:00',
updatedAt: '2026-07-03T03:00:00+08:00',
},
{
id: 6,
name: '每日成本同步',
type: 'cost',
cronExpr: '30 3 * * *',
payload: '{"ociConfigIds":[]}',
status: 'active',
lastRunAt: '2026-07-03T03:30:00+08:00',
lastError: '',
runCount: 21,
createdAt: '2026-06-12T00:00:00+08:00',
updatedAt: '2026-07-03T03:30:00+08:00',
},
{
id: 2,
name: '法兰克福 A1 抢机 ×2',
type: 'snatch',
cronExpr: '*/5 * * * *',
payload: '{"ociConfigId":7,"count":2}',
status: 'active',
lastRunAt: '2026-07-03T17:02:00+08:00',
lastError: 'Out of host capacity (AD-1)',
runCount: 217,
createdAt: '2026-06-20T00:00:00+08:00',
updatedAt: '2026-07-03T17:02:00+08:00',
},
{
id: 3,
name: '新加坡 A1 抢机',
type: 'snatch',
cronExpr: '*/10 * * * *',
payload: '{"ociConfigId":3,"count":1}',
status: 'paused',
lastRunAt: '2026-07-02T22:40:00+08:00',
lastError: '',
runCount: 89,
createdAt: '2026-06-25T00:00:00+08:00',
updatedAt: '2026-07-02T22:40:00+08:00',
},
{
id: 4,
name: '首尔 E2 抢机',
type: 'snatch',
cronExpr: '*/5 * * * *',
payload: '{"ociConfigId":4,"count":1}',
status: 'succeeded',
lastRunAt: '2026-07-01T14:25:00+08:00',
lastError: '',
runCount: 132,
createdAt: '2026-06-28T00:00:00+08:00',
updatedAt: '2026-07-01T14:25:00+08:00',
},
{
id: 7,
name: '东京 A1 抢机',
type: 'snatch',
cronExpr: '*/5 * * * *',
payload: '{"ociConfigId":5,"count":1,"totalCount":1,"authFailCount":3}',
status: 'failed',
lastRunAt: '2026-07-03T14:10:00+08:00',
lastError: '连续 3 次 NotAuthenticated,任务已熔断停止: NotAuthenticated: key expired',
runCount: 58,
createdAt: '2026-06-30T00:00:00+08:00',
updatedAt: '2026-07-03T14:10:00+08:00',
},
{
id: 5,
name: 'XXXX 每小时测活',
type: 'health_check',
cronExpr: '7 * * * *',
payload: '{"ociConfigIds":[1,2,3,4]}',
status: 'active',
lastRunAt: '2026-07-03T17:07:00+08:00',
lastError: '',
runCount: 312,
createdAt: '2026-06-01T00:00:00+08:00',
updatedAt: '2026-07-03T17:07:00+08:00',
},
]
export const mockTaskLogs: Record<number, TaskLog[]> = {
1: [
{
id: 101,
taskId: 1,
success: true,
message: 'checked 21: 21 alive, 0 dead',
durationMs: 3912,
createdAt: '2026-07-03T03:00:04+08:00',
},
],
6: [
{
id: 601,
taskId: 6,
success: true,
message: 'synced usage for 3 tenants, skipped 4 free',
durationMs: 5210,
createdAt: '2026-07-03T03:30:05+08:00',
},
],
2: [
{
id: 201,
taskId: 2,
success: false,
message: 'Out of host capacity (AD-1)',
durationMs: 1204,
createdAt: '2026-07-03T17:02:01+08:00',
},
{
id: 200,
taskId: 2,
success: false,
message: 'Out of host capacity (AD-1)',
durationMs: 987,
createdAt: '2026-07-03T16:57:01+08:00',
},
{
id: 199,
taskId: 2,
success: false,
message: 'Out of host capacity (AD-2)',
durationMs: 1102,
createdAt: '2026-07-03T16:52:01+08:00',
},
{
id: 180,
taskId: 2,
success: true,
message: 'launched 1/2: ocid1.instance.oc1.eu-frankfurt-1.antheljt…mc25a, 1 remaining',
durationMs: 42381,
createdAt: '2026-07-02T09:15:00+08:00',
},
],
4: [
{
id: 401,
taskId: 4,
success: true,
message: 'launched ocid1.instance.oc1.ap-seoul-1.anuwg…7k2ma, task succeeded',
durationMs: 38754,
createdAt: '2026-07-01T14:25:39+08:00',
},
],
7: [
{
id: 703,
taskId: 7,
success: false,
message: '连续 3 次 NotAuthenticated,任务已熔断停止: NotAuthenticated: key expired',
durationMs: 842,
createdAt: '2026-07-03T14:10:01+08:00',
},
{
id: 702,
taskId: 7,
success: false,
message: 'no instance created: vm: NotAuthenticated: key expired',
durationMs: 913,
createdAt: '2026-07-03T14:05:01+08:00',
},
{
id: 701,
taskId: 7,
success: false,
message: 'no instance created: vm: NotAuthenticated: key expired',
durationMs: 887,
createdAt: '2026-07-03T14:00:01+08:00',
},
],
5: [
{
id: 501,
taskId: 5,
success: true,
message: 'checked 4: 4 alive, 0 dead',
durationMs: 1533,
createdAt: '2026-07-03T17:07:02+08:00',
},
],
}
export const mockRegionSubs: RegionSubscription[] = [
{
key: 'FRA',
name: 'eu-frankfurt-1',
status: 'READY',
isHomeRegion: true,
alias: 'Germany Central (Frankfurt)',
},
{
key: 'AMS',
name: 'eu-amsterdam-1',
status: 'READY',
isHomeRegion: false,
alias: 'Netherlands NW (Amsterdam)',
},
{
key: 'ICN',
name: 'ap-seoul-1',
status: 'IN_PROGRESS',
isHomeRegion: false,
alias: 'South Korea Central (Seoul)',
},
]
export const mockLimits: LimitItem[] = [
// A1:三个 AD 均有配额 + 区域总额(镜像真实免费租户形态)
{
name: 'standard-a1-core-count',
scopeType: 'AD',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
value: 4,
used: 4,
available: 0,
},
{
name: 'standard-a1-core-count',
scopeType: 'AD',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-2',
value: 4,
},
{
name: 'standard-a1-core-count',
scopeType: 'AD',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-3',
value: 4,
},
{ name: 'standard-a1-core-regional-count', scopeType: 'REGION', value: 4 },
{
name: 'standard-a1-memory-count',
scopeType: 'AD',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
value: 24,
used: 24,
available: 0,
},
// Micro:仅 AD-2 有配额(AD 受限 shape,驱动创建表单自动落位)
{
name: 'standard-e2-micro-core-count',
scopeType: 'AD',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
value: 0,
},
{
name: 'standard-e2-micro-core-count',
scopeType: 'AD',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-2',
value: 2,
used: 1,
available: 1,
},
{
name: 'standard-e2-micro-core-count',
scopeType: 'AD',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-3',
value: 0,
},
{
name: 'standard-e4-core-count',
scopeType: 'AD',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
value: 6,
used: 2,
available: 4,
},
{ name: 'vcn-count', scopeType: 'REGION', value: 50, used: 2, available: 48 },
{ name: 'volume-backup-count', scopeType: 'REGION', value: 100, used: 6, available: 94 },
]
export const mockSubscriptions: SubscriptionDetail[] = [
{
id: 'ocid1.organizationssubscription.oc1..xxx',
serviceName: 'CLOUDCM',
classicSubscriptionId: 'xxx',
paymentModel: 'FREE_TRIAL',
subscriptionTier: 'FREE_AND_TRIAL',
lifecycleState: 'ACTIVE',
programType: '',
customerCountryCode: 'DE',
cloudAmountCurrency: 'EUR',
csiNumber: '',
regionAssignment: '',
isGovernmentSubscription: false,
promotions: [
{
duration: 30,
durationUnit: 'DAYS',
amount: 279,
status: 'ACTIVE',
isIntentToPay: false,
currencyUnit: 'EUR',
timeStarted: '2026-01-22T01:19:25Z',
timeExpired: '2026-07-31T00:00:00Z',
},
],
startDate: '2026-01-22T01:19:25Z',
endDate: null,
timeCreated: '2026-01-22T01:19:25.174Z',
timeUpdated: '2026-01-22T01:35:51.021Z',
},
{
id: 'ocid1.organizationssubscription.oc1..yyy',
serviceName: 'OCICORP',
classicSubscriptionId: 'yyy',
paymentModel: 'PAYG',
subscriptionTier: 'FREE_AND_PAID',
lifecycleState: 'ACTIVE',
programType: 'STANDARD',
customerCountryCode: 'DE',
cloudAmountCurrency: 'EUR',
csiNumber: '',
regionAssignment: '',
isGovernmentSubscription: false,
promotions: [],
startDate: '2026-03-02T00:00:00Z',
endDate: null,
timeCreated: '2026-03-02T00:00:00.000Z',
timeUpdated: '2026-03-02T00:00:00.000Z',
},
{
id: 'ocid1.organizationssubscription.oc1..idcs',
serviceName: 'IDCS',
classicSubscriptionId: 'zzz',
paymentModel: '',
subscriptionTier: '',
lifecycleState: 'ACTIVE',
programType: '',
customerCountryCode: 'DE',
cloudAmountCurrency: '',
csiNumber: '',
regionAssignment: '',
isGovernmentSubscription: false,
promotions: [],
startDate: '2026-01-22T01:19:25Z',
endDate: null,
timeCreated: '2026-01-22T01:19:25.174Z',
timeUpdated: '2026-01-22T01:19:25.174Z',
},
]
export const mockUsers: IamUser[] = [
{
id: 'ocid1.user..apiadmin',
name: 'api-admin',
description: '当前 API Key 签名用户',
email: 'admin@XXXX.io',
emailVerified: true,
mfaActivated: true,
lifecycleState: 'ACTIVE',
isCurrentUser: true,
timeCreated: '2026-05-14T00:00:00Z',
lastLoginTime: '2026-07-03T09:00:00Z',
},
{
id: 'ocid1.user..consoleadmin',
name: 'console-admin',
description: '控制台管理员',
email: 'console-admin@XXXX.io',
emailVerified: true,
mfaActivated: true,
lifecycleState: 'ACTIVE',
isCurrentUser: false,
timeCreated: '2026-05-20T00:00:00Z',
lastLoginTime: null,
},
{
id: 'ocid1.user..devzhang',
name: 'dev-zhang',
description: '开发',
email: 'zhang@XXXX.io',
emailVerified: false,
mfaActivated: false,
lifecycleState: 'ACTIVE',
isCurrentUser: false,
timeCreated: '2026-06-02T00:00:00Z',
lastLoginTime: null,
},
{
id: 'ocid1.user..fedwang',
name: 'XXXX_fed/wang.defa',
description: '联邦用户 · Keycloak',
email: '',
emailVerified: false,
mfaActivated: false,
lifecycleState: 'ACTIVE',
isCurrentUser: false,
timeCreated: '2026-06-11T00:00:00Z',
lastLoginTime: '2026-07-02T20:00:00Z',
},
]
// 域档案:apiadmin 双管理员,consoleadmin 仅管理员组,devzhang 普通域用户,
// fedwang 不在身份域中(演示经典 IAM 用户的禁用态)
export const mockUserDetails: Record<string, IamUserDetail> = {
'ocid1.user..apiadmin': {
inDomain: true,
givenName: 'API',
familyName: 'Admin',
isDomainAdmin: true,
inAdminGroup: true,
},
'ocid1.user..consoleadmin': {
inDomain: true,
givenName: 'Console',
familyName: 'Admin',
isDomainAdmin: false,
inAdminGroup: true,
},
'ocid1.user..devzhang': {
inDomain: true,
givenName: 'Zhang',
familyName: 'Dev',
isDomainAdmin: false,
inAdminGroup: false,
},
}
// 审计事件按时间倒序,含 401/404 失败事件(状态 >=400 标红演示);
// eventId 统一后缀派生,详情接口按它反查
const mockAuditEventsBase: Omit<AuditEvent, 'eventId'>[] = [
{
eventTime: '2026-07-07T09:42:00Z',
eventName: 'TerminateInstance',
source: 'ComputeApi',
resourceName: 'web-1',
compartmentName: 'XXXX (root)',
principalName: 'api-admin',
ipAddress: '203.0.113.10',
status: '204',
requestAction: 'DELETE',
requestPath: '/20160918/instances/ocid1.instance.oc1.eu-frankfurt-1.aaaa',
},
{
eventTime: '2026-07-07T09:40:00Z',
eventName: 'LaunchInstance',
source: 'ComputeApi',
resourceName: 'arm-snatch-1',
compartmentName: 'XXXX (root)',
principalName: 'api-admin',
ipAddress: '203.0.113.10',
status: '500',
requestAction: 'POST',
requestPath: '/20160918/instances',
},
{
eventTime: '2026-07-07T08:15:00Z',
eventName: 'UpdateVcn',
source: 'VcnApi',
resourceName: 'vcn-20260509-0252',
compartmentName: 'network',
principalName: 'console-admin',
ipAddress: '198.51.100.7',
status: '200',
requestAction: 'PUT',
requestPath: '/20160918/vcns/ocid1.vcn.oc1.eu-frankfurt-1.bbbb',
},
{
eventTime: '2026-07-07T06:30:00Z',
eventName: 'GetUser',
source: 'IdentityControlPlane',
resourceName: 'dev-zhang',
compartmentName: 'XXXX (root)',
principalName: 'dev-zhang',
ipAddress: '198.51.100.24',
status: '404',
requestAction: 'GET',
requestPath: '/20160918/users/ocid1.user.oc1..missing',
},
{
eventTime: '2026-07-07T03:12:00Z',
eventName: 'InstanceAction',
source: 'ComputeApi',
resourceName: 'db-1',
compartmentName: 'prod',
principalName: 'api-admin',
ipAddress: '203.0.113.10',
status: '200',
requestAction: 'POST',
requestPath: '/20160918/instances/ocid1.instance.oc1.eu-frankfurt-1.cccc',
},
{
eventTime: '2026-07-06T22:47:00Z',
eventName: 'ListEvents',
source: 'Audit',
resourceName: '',
compartmentName: 'XXXX (root)',
principalName: 'console-admin',
ipAddress: '198.51.100.7',
status: '200',
requestAction: 'GET',
requestPath: '/20190901/auditEvents',
},
{
eventTime: '2026-07-06T20:05:00Z',
eventName: 'CreateSwiftPassword',
source: 'IdentityControlPlane',
resourceName: 'dev-zhang',
compartmentName: 'XXXX (root)',
principalName: 'dev-zhang',
ipAddress: '198.51.100.24',
status: '401',
requestAction: 'POST',
requestPath: '/20160918/users/ocid1.user..devzhang/swiftPasswords',
},
{
eventTime: '2026-07-06T15:58:00Z',
eventName: 'UpdateSecurityList',
source: 'VcnApi',
resourceName: 'Default Security List',
compartmentName: 'network',
principalName: 'XXXX_fed/wang.defa',
ipAddress: '192.0.2.88',
status: '200',
requestAction: 'PUT',
requestPath: '/20160918/securityLists/ocid1.securitylist.oc1.eu-frankfurt-1.dddd',
},
{
eventTime: '2026-07-06T12:00:00Z',
eventName: '',
source: 'CloudGuardResponderEngine',
resourceName: '',
compartmentName: 'XXXX (root)',
principalName: '',
ipAddress: '',
status: '',
requestAction: '',
requestPath: '',
},
]
export const mockAuditEvents: AuditEvent[] = mockAuditEventsBase.map((e, i) => ({
...e,
eventId: `mock-audit-evt-${i + 1}`,
}))
export const mockIdps: IdentityProvider[] = [
{
id: '54a0260f7a75',
name: 'XXXX-keycloak',
type: 'SAML',
enabled: true,
partnerProviderId: 'https://auth.example.test/realms/oci',
jitEnabled: true,
timeCreated: '2026-06-10T00:00:00Z',
},
{
id: '8800aa11bb22',
name: 'test-okta',
type: 'SAML',
enabled: false,
partnerProviderId: 'https://test.okta.example/app/xyz',
jitEnabled: true,
timeCreated: '2026-06-15T00:00:00Z',
},
]
export const mockSignOnRules: SignOnRule[] = [
{
id: '873aa3fa1a72',
name: 'skip-mfa-keycloak',
sequence: 1,
authenticationFactor: 'IDP',
conditionAttribute: 'subject.authenticatedBy',
conditionValue: '["54a0260f7a75"]',
builtIn: false,
},
{
id: 'builtin-default',
name: 'Default Rule',
sequence: 2,
authenticationFactor: 'IDP_PLUS_2FA',
conditionAttribute: '',
conditionValue: '',
builtIn: true,
},
]
export const mockPolicies: PasswordPolicy[] = [
{
id: 'defaultPasswordPolicy',
name: 'defaultPasswordPolicy',
priority: 3,
passwordStrength: 'Custom',
passwordExpiresAfter: 120,
minLength: 12,
numPasswordsInHistory: 4,
},
{
id: 'standardPasswordPolicy',
name: 'StandardPasswordPolicy',
priority: 2,
passwordStrength: 'Standard',
passwordExpiresAfter: 0,
minLength: 8,
},
{
id: 'simplePasswordPolicy',
name: 'SimplePasswordPolicy',
priority: 1,
passwordStrength: 'Simple',
passwordExpiresAfter: 0,
minLength: 8,
},
]
export const mockRecipients: NotificationRecipients = {
recipients: ['admin@XXXX.io', 'ops@XXXX.io'],
testModeEnabled: true,
}
export const mockIdentitySetting: IdentitySetting = {
id: 'IdentitySettings',
primaryEmailRequired: false,
}
export const mockCosts: CostItem[] = [
{
timeStart: '2026-06-27T00:00:00Z',
groupValue: 'COMPUTE',
computedAmount: 5.2,
computedQuantity: 96,
currency: 'USD',
unit: 'OCPU_HOURS',
},
{
timeStart: '2026-06-28T00:00:00Z',
groupValue: 'COMPUTE',
computedAmount: 5.8,
computedQuantity: 96,
currency: 'USD',
unit: 'OCPU_HOURS',
},
{
timeStart: '2026-06-29T00:00:00Z',
groupValue: 'COMPUTE',
computedAmount: 5.4,
computedQuantity: 96,
currency: 'USD',
unit: 'OCPU_HOURS',
},
{
timeStart: '2026-06-30T00:00:00Z',
groupValue: 'COMPUTE',
computedAmount: 6.1,
computedQuantity: 96,
currency: 'USD',
unit: 'OCPU_HOURS',
},
{
timeStart: '2026-07-01T00:00:00Z',
groupValue: 'COMPUTE',
computedAmount: 6.6,
computedQuantity: 96,
currency: 'USD',
unit: 'OCPU_HOURS',
},
{
timeStart: '2026-07-02T00:00:00Z',
groupValue: 'COMPUTE',
computedAmount: 6.3,
computedQuantity: 96,
currency: 'USD',
unit: 'OCPU_HOURS',
},
{
timeStart: '2026-07-03T00:00:00Z',
groupValue: 'COMPUTE',
computedAmount: 6.8,
computedQuantity: 96,
currency: 'USD',
unit: 'OCPU_HOURS',
},
{
timeStart: '2026-07-01T00:00:00Z',
groupValue: 'BLOCK_STORAGE',
computedAmount: 1.4,
computedQuantity: 300,
currency: 'USD',
unit: 'GB_MONTHS',
},
{
timeStart: '2026-07-02T00:00:00Z',
groupValue: 'BLOCK_STORAGE',
computedAmount: 1.4,
computedQuantity: 300,
currency: 'USD',
unit: 'GB_MONTHS',
},
]
export const mockTraffic: InstanceTraffic = {
instanceId: 'ocid1.instance.oc1..web-fra-01',
inboundBytes: 96.2 * 1024 ** 3,
outboundBytes: 128.4 * 1024 ** 3,
vnics: [
{
vnicId: 'ocid1.vnic..main',
inbound: [
{ timestamp: '2026-06-27T00:00:00Z', bytes: 12.1 * 1024 ** 3 },
{ timestamp: '2026-06-28T00:00:00Z', bytes: 13.8 * 1024 ** 3 },
{ timestamp: '2026-06-29T00:00:00Z', bytes: 12.9 * 1024 ** 3 },
{ timestamp: '2026-06-30T00:00:00Z', bytes: 14.5 * 1024 ** 3 },
{ timestamp: '2026-07-01T00:00:00Z', bytes: 15.2 * 1024 ** 3 },
{ timestamp: '2026-07-02T00:00:00Z', bytes: 13.4 * 1024 ** 3 },
{ timestamp: '2026-07-03T00:00:00Z', bytes: 14.3 * 1024 ** 3 },
],
outbound: [
{ timestamp: '2026-06-27T00:00:00Z', bytes: 16.2 * 1024 ** 3 },
{ timestamp: '2026-06-28T00:00:00Z', bytes: 18.5 * 1024 ** 3 },
{ timestamp: '2026-06-29T00:00:00Z', bytes: 17.1 * 1024 ** 3 },
{ timestamp: '2026-06-30T00:00:00Z', bytes: 19.8 * 1024 ** 3 },
{ timestamp: '2026-07-01T00:00:00Z', bytes: 21.5 * 1024 ** 3 },
{ timestamp: '2026-07-02T00:00:00Z', bytes: 17.9 * 1024 ** 3 },
{ timestamp: '2026-07-03T00:00:00Z', bytes: 17.4 * 1024 ** 3 },
],
},
],
}
export const mockVcns: Record<number, Vcn[]> = {
1: [
{
id: 'ocid1.vcn.oc1..autovcn',
displayName: 'oci-portal-auto-vcn',
lifecycleState: 'AVAILABLE',
compartmentId: 'ocid1.compartment.oc1..root',
cidrBlocks: ['10.0.0.0/16'],
ipv6CidrBlocks: ['2603:c020:8026:9c00::/56'],
dnsLabel: 'ociportal',
defaultRouteTableId: 'ocid1.routetable..default',
defaultSecurityListId: 'ocid1.securitylist..default',
timeCreated: '2026-05-20T14:30:00Z',
},
{
id: 'ocid1.vcn.oc1..webvcn',
displayName: 'web-prod-vcn',
lifecycleState: 'AVAILABLE',
compartmentId: 'ocid1.compartment.oc1..root',
cidrBlocks: ['10.10.0.0/16'],
ipv6CidrBlocks: [],
dnsLabel: 'webprod',
defaultRouteTableId: 'ocid1.routetable..web',
defaultSecurityListId: 'ocid1.securitylist..web',
timeCreated: '2026-06-01T09:00:00Z',
},
],
3: [
{
id: 'ocid1.vcn.oc1..sgpvcn',
displayName: 'oci-portal-auto-vcn',
lifecycleState: 'AVAILABLE',
compartmentId: 'ocid1.compartment.oc1..root',
cidrBlocks: ['10.0.0.0/16'],
ipv6CidrBlocks: ['2603:c020:400d:aa00::/56'],
dnsLabel: 'ociportal',
defaultRouteTableId: 'ocid1.routetable..sgp',
defaultSecurityListId: 'ocid1.securitylist..sgp',
timeCreated: '2026-06-10T00:00:00Z',
},
],
4: [
{
id: 'ocid1.vcn.oc1..icnvcn',
displayName: 'seoul-vcn',
lifecycleState: 'AVAILABLE',
compartmentId: 'ocid1.compartment.oc1..root',
cidrBlocks: ['192.168.0.0/16'],
ipv6CidrBlocks: [],
dnsLabel: 'seoul',
defaultRouteTableId: 'ocid1.routetable..icn',
defaultSecurityListId: 'ocid1.securitylist..icn',
timeCreated: '2026-06-28T00:00:00Z',
},
],
}
export const mockSubnets: Subnet[] = [
{
id: 'ocid1.subnet.oc1..pub',
vcnId: 'ocid1.vcn.oc1..autovcn',
displayName: 'public-subnet',
lifecycleState: 'AVAILABLE',
cidrBlock: '10.0.1.0/24',
ipv6CidrBlock: '2603:c020:8026:9c00::/64',
dnsLabel: 'pub',
prohibitPublicIp: false,
availabilityDomain: '',
routeTableId: 'ocid1.routetable..default',
timeCreated: '2026-05-20T14:31:00Z',
},
{
id: 'ocid1.subnet.oc1..priv',
vcnId: 'ocid1.vcn.oc1..autovcn',
displayName: 'private-subnet',
lifecycleState: 'AVAILABLE',
cidrBlock: '10.0.2.0/24',
ipv6CidrBlock: '',
dnsLabel: 'priv',
prohibitPublicIp: true,
availabilityDomain: '',
routeTableId: 'ocid1.routetable..default',
timeCreated: '2026-05-21T10:00:00Z',
},
{
id: 'ocid1.subnet.oc1..webpub',
vcnId: 'ocid1.vcn.oc1..webvcn',
displayName: 'web-public-subnet',
lifecycleState: 'AVAILABLE',
cidrBlock: '10.10.1.0/24',
ipv6CidrBlock: '',
dnsLabel: 'webpub',
prohibitPublicIp: false,
availabilityDomain: '',
routeTableId: 'ocid1.routetable..web',
timeCreated: '2026-06-01T09:05:00Z',
},
]
export const mockSecurityLists: SecurityList[] = [
{
id: 'ocid1.securitylist..default',
vcnId: 'ocid1.vcn.oc1..autovcn',
displayName: 'Default Security List for oci-portal-auto-vcn',
lifecycleState: 'AVAILABLE',
ingressRules: [
{ protocol: 'all', source: '0.0.0.0/0', isStateless: false },
{ protocol: 'all', source: '::/0', isStateless: false },
],
egressRules: [
{ protocol: 'all', destination: '0.0.0.0/0', isStateless: false },
{ protocol: 'all', destination: '::/0', isStateless: false },
],
timeCreated: '2026-05-20T14:30:30Z',
},
{
id: 'ocid1.securitylist..strictweb',
vcnId: 'ocid1.vcn.oc1..autovcn',
displayName: 'strict-web',
lifecycleState: 'AVAILABLE',
ingressRules: [
{
protocol: '6',
source: '0.0.0.0/0',
isStateless: false,
portMin: 22,
portMax: 22,
description: 'ssh',
},
{
protocol: '6',
source: '0.0.0.0/0',
isStateless: false,
portMin: 80,
portMax: 80,
description: 'http',
},
{
protocol: '6',
source: '0.0.0.0/0',
isStateless: false,
portMin: 443,
portMax: 443,
description: 'https',
},
],
egressRules: [{ protocol: 'all', destination: '0.0.0.0/0', isStateless: false }],
timeCreated: '2026-06-01T09:10:00Z',
},
]
export const mockIpv6Report: Ipv6Report = {
steps: [
{ step: 'vcn-ipv6-cidr', status: 'done', detail: '2603:c020:8026:9c00::/56' },
{ step: 'subnet-ipv6-cidr', status: 'done', detail: 'public-subnet 2603:c020:8026:9c00::/64' },
{ step: 'route-ipv6-default', status: 'skipped', detail: '::/0 -> oci-portal-igw 已存在' },
{ step: 'seclist-ipv6-egress', status: 'done', detail: 'egress ::/0 allowed' },
],
}
export const mockBootVolumes: Record<number, BootVolume[]> = {
1: [
{
id: 'ocid1.bootvolume..webfra01',
displayName: 'web-fra-01 (Boot Volume)',
lifecycleState: 'AVAILABLE',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
sizeInGBs: 50,
vpusPerGB: 10,
imageId: 'ocid1.image.oc1.eu-frankfurt-1.ubuntu2404',
imageName: 'Canonical-Ubuntu-24.04-aarch64-2026.05.15-0',
attachedInstanceId: 'ocid1.instance.oc1..web-fra-02',
attachedInstanceName: 'web-fra-02',
timeCreated: '2026-05-20T14:32:00Z',
},
{
id: 'ocid1.bootvolume..webfra02',
displayName: 'web-fra-02 (Boot Volume)',
lifecycleState: 'AVAILABLE',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
sizeInGBs: 50,
vpusPerGB: 10,
imageId: 'ocid1.image.oc1.eu-frankfurt-1.ubuntu2404',
imageName: 'Canonical-Ubuntu-24.04-aarch64-2026.05.15-0',
attachedInstanceId: 'ocid1.instance.oc1..web-fra-02',
attachedInstanceName: 'web-fra-02',
timeCreated: '2026-05-22T10:00:00Z',
},
{
id: 'ocid1.bootvolume..oldweb',
displayName: 'old-web (Boot Volume)',
lifecycleState: 'AVAILABLE',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
sizeInGBs: 47,
vpusPerGB: 10,
imageId: 'ocid1.image.oc1.eu-frankfurt-1.ubuntu2204',
imageName: 'Canonical-Ubuntu-22.04-2026.04.02-0',
attachedInstanceId: '',
timeCreated: '2026-04-10T00:00:00Z',
},
],
3: [
{
id: 'ocid1.bootvolume..dbsgp01',
displayName: 'db-sgp-01 (Boot Volume)',
lifecycleState: 'AVAILABLE',
availabilityDomain: 'RssO:AP-SINGAPORE-1-AD-1',
sizeInGBs: 100,
vpusPerGB: 20,
imageId: 'ocid1.image.oc1.ap-singapore-1.ol9',
imageName: 'Oracle-Linux-9.5-2026.06.01-0',
attachedInstanceId: 'ocid1.instance.oc1..db-sgp-01',
timeCreated: '2026-06-10T00:00:00Z',
},
],
4: [
{
id: 'ocid1.bootvolume..proxyicn',
displayName: 'proxy-icn-01 (Boot Volume)',
lifecycleState: 'AVAILABLE',
availabilityDomain: 'RssO:AP-SEOUL-1-AD-1',
sizeInGBs: 50,
vpusPerGB: 10,
imageId: 'ocid1.image.oc1.ap-seoul-1.ubuntu2404',
imageName: 'Canonical-Ubuntu-24.04-Minimal-aarch64-2026.06.18-0',
attachedInstanceId: 'ocid1.instance.oc1..proxy-icn-01',
timeCreated: '2026-06-28T00:00:00Z',
},
],
}
export const mockBvAttachments: BootVolumeAttachment[] = [
{
id: 'ocid1.bootvolumeattachment..a1',
instanceId: 'ocid1.instance.oc1..web-fra-01',
bootVolumeId: 'ocid1.bootvolume..webfra01',
lifecycleState: 'ATTACHED',
displayName: '',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
},
]
export const mockVolAttachments: VolumeAttachment[] = [
{
id: 'ocid1.volumeattachment..v1',
instanceId: 'ocid1.instance.oc1..web-fra-01',
volumeId: 'ocid1.volume..datavol01',
lifecycleState: 'ATTACHED',
displayName: 'data-vol-01',
device: '/dev/oracleoci/oraclevdb',
isReadOnly: false,
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
},
]
/** 按配置 id 组织的 compartment mock(不含租户根) */
export const mockCompartments: Record<number, Compartment[]> = {
1: [
{
id: 'ocid1.compartment.oc1..dev',
name: 'dev',
description: '开发环境资源',
parentId: 'ocid1.tenancy.oc1..XXXX主号xxxx',
lifecycleState: 'ACTIVE',
timeCreated: '2026-05-20T00:00:00Z',
},
{
id: 'ocid1.compartment.oc1..prodnet',
name: 'prod-network',
description: '生产网络资源',
parentId: 'ocid1.tenancy.oc1..XXXX主号xxxx',
lifecycleState: 'ACTIVE',
timeCreated: '2026-06-01T00:00:00Z',
},
],
}
export const mockOverview: Overview = {
tenants: { total: 7, alive: 5, dead: 2, byType: { paid: 1, trial: 2, free: 4 } },
check: {
hasActiveTask: true,
coveredConfigs: 7,
totalConfigs: 7,
instanceCount: 8,
lastCheckedAt: '2026-07-03T03:00:04+08:00',
},
cost: {
hasActiveTask: true,
coveredConfigs: 3,
currency: 'USD',
total: 43.6,
days: [
{ day: '2026-06-27', amount: 5.2 },
{ day: '2026-06-28', amount: 5.8 },
{ day: '2026-06-29', amount: 5.4 },
{ day: '2026-06-30', amount: 6.1 },
{ day: '2026-07-01', amount: 8.0 },
{ day: '2026-07-02', amount: 7.7 },
{ day: '2026-07-03', amount: 6.8 },
],
},
tasks: { total: 6, active: 4, healthCheck: 2, cost: 1, snatch: 3 },
}
/** OCI 全区域(可订阅列表用,比已订阅的 mockRegionSubs 更全) */
// 与后端一致:全局按 alias 字典序
export const mockRegions: RegionInfo[] = [
{ alias: 'Australia East (Sydney)', key: 'SYD', name: 'ap-sydney-1' },
{ alias: 'France Central (Paris)', key: 'CDG', name: 'eu-paris-1' },
{ alias: 'Germany Central (Frankfurt)', key: 'FRA', name: 'eu-frankfurt-1' },
{ alias: 'Japan East (Tokyo)', key: 'NRT', name: 'ap-tokyo-1' },
{ alias: 'Netherlands NW (Amsterdam)', key: 'AMS', name: 'eu-amsterdam-1' },
{ alias: 'Singapore (Singapore)', key: 'SIN', name: 'ap-singapore-1' },
{ alias: 'South Korea Central (Seoul)', key: 'ICN', name: 'ap-seoul-1' },
{ alias: 'UK South (London)', key: 'LHR', name: 'uk-london-1' },
{ alias: 'US East (Ashburn)', key: 'IAD', name: 'us-ashburn-1' },
{ alias: 'US West (Phoenix)', key: 'PHX', name: 'us-phoenix-1' },
{ alias: 'US West (San Jose)', key: 'SJC', name: 'us-sanjose-1' },
]
export const mockImages: ImageInfo[] = [
{
id: 'ocid1.image.oc1.eu-frankfurt-1.ubuntu2404arm',
displayName: 'Canonical-Ubuntu-24.04-aarch64-2026.04.30-1',
operatingSystem: 'Canonical Ubuntu',
operatingSystemVersion: '24.04',
sizeInMBs: 47694,
timeCreated: '2026-04-30T00:00:00Z',
},
{
id: 'ocid1.image.oc1.eu-frankfurt-1.ubuntu2404armold',
displayName: 'Canonical-Ubuntu-24.04-aarch64-2026.01.15-0',
operatingSystem: 'Canonical Ubuntu',
operatingSystemVersion: '24.04',
sizeInMBs: 47512,
timeCreated: '2026-01-15T00:00:00Z',
},
{
id: 'ocid1.image.oc1.eu-frankfurt-1.ubuntu2404x86',
displayName: 'Canonical-Ubuntu-24.04-2026.04.30-1',
operatingSystem: 'Canonical Ubuntu',
operatingSystemVersion: '24.04',
sizeInMBs: 51230,
timeCreated: '2026-04-30T00:00:00Z',
},
{
id: 'ocid1.image.oc1.eu-frankfurt-1.ol9arm',
displayName: 'Oracle-Linux-9.5-aarch64-2026.05.15-0',
operatingSystem: 'Oracle Linux',
operatingSystemVersion: '9.5',
sizeInMBs: 42100,
timeCreated: '2026-05-15T00:00:00Z',
},
{
id: 'ocid1.image.oc1.eu-frankfurt-1.debian12',
displayName: 'Debian-12-aarch64-2026.03.20-0',
operatingSystem: 'Debian',
operatingSystemVersion: '12',
sizeInMBs: 38900,
timeCreated: '2026-03-20T00:00:00Z',
},
]
export const mockAds = [
'RssO:EU-FRANKFURT-1-AD-1',
'RssO:EU-FRANKFURT-1-AD-2',
'RssO:EU-FRANKFURT-1-AD-3',
]
export const mockShapes: ComputeShape[] = [
{
name: 'VM.Standard.A1.Flex',
billingType: 'LIMITED_FREE',
isFlexible: true,
ocpusMin: 1,
ocpusMax: 80,
memoryMinGBs: 1,
memoryMaxGBs: 512,
processorDescription: '3.0 GHz Ampere® Altra™',
quotaNames: [
'standard-a1-memory-count',
'standard-a1-memory-regional-count',
'standard-a1-core-count',
'standard-a1-core-regional-count',
],
},
{
name: 'VM.Standard.E2.1.Micro',
billingType: 'ALWAYS_FREE',
isFlexible: false,
ocpus: 1,
memoryInGBs: 1,
processorDescription: '2.0 GHz AMD EPYC™ 7551',
quotaNames: ['standard-e2-micro-core-count'],
},
{
name: 'VM.Standard.E4.Flex',
billingType: 'PAID',
isFlexible: true,
ocpusMin: 1,
ocpusMax: 64,
memoryMinGBs: 1,
memoryMaxGBs: 1024,
processorDescription: '2.55 GHz AMD EPYC™ 7J13',
quotaNames: ['standard-e4-core-count', 'standard-e4-memory-count'],
},
{
name: 'VM.Standard.E5.Flex',
billingType: 'PAID',
isFlexible: true,
ocpusMin: 1,
ocpusMax: 94,
memoryMinGBs: 1,
memoryMaxGBs: 1049,
processorDescription: '2.4 GHz AMD EPYC™ 9J14',
},
{
name: 'VM.Standard3.Flex',
billingType: 'PAID',
isFlexible: true,
ocpusMin: 1,
ocpusMax: 32,
memoryMinGBs: 1,
memoryMaxGBs: 512,
processorDescription: '2.6 GHz Intel® Xeon® Platinum 8358',
},
{
name: 'BM.Standard.E4.128',
billingType: 'PAID',
isFlexible: false,
ocpus: 128,
memoryInGBs: 2048,
processorDescription: '2.55 GHz AMD EPYC™ 7J13',
},
]
export const mockVolumes: Record<number, Volume[]> = {
1: [
{
id: 'ocid1.volume..datavol01',
displayName: 'data-vol-01',
lifecycleState: 'AVAILABLE',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
sizeInGBs: 100,
vpusPerGB: 10,
timeCreated: '2026-05-25T00:00:00Z',
},
{
id: 'ocid1.volume..datavol02',
displayName: 'data-vol-02',
lifecycleState: 'AVAILABLE',
availabilityDomain: 'RssO:EU-FRANKFURT-1-AD-1',
sizeInGBs: 50,
vpusPerGB: 10,
timeCreated: '2026-06-15T00:00:00Z',
},
],
}
export const mockConsoleConns: ConsoleConnection[] = [
{
id: 'ocid1.instanceconsoleconnection..c1',
instanceId: 'ocid1.instance.oc1..web-fra-01',
lifecycleState: 'ACTIVE',
connectionString:
'ssh -o ProxyCommand="ssh -W %h:%p -p 443 ocid1.instanceconsoleconnection..c1@instance-console.eu-frankfurt-1.oci.oraclecloud.com" ocid1.instance.oc1..web-fra-01',
vncConnectionString:
'ssh -o ProxyCommand="ssh -W %h:%p -p 443 ocid1.instanceconsoleconnection..c1@instance-console.eu-frankfurt-1.oci.oraclecloud.com" -N -L localhost:5900:ocid1.instance.oc1..web-fra-01:5900 ocid1.instance.oc1..web-fra-01',
},
// DELETED 终态记录:OCI 会保留一段时间,前端应过滤不展示
{
id: 'ocid1.instanceconsoleconnection..c0',
instanceId: 'ocid1.instance.oc1..web-fra-01',
lifecycleState: 'DELETED',
connectionString:
'ssh -o ProxyCommand="ssh -W %h:%p -p 443 ocid1.instanceconsoleconnection..c0@instance-console.eu-frankfurt-1.oci.oraclecloud.com" ocid1.instance.oc1..web-fra-01',
vncConnectionString:
'ssh -o ProxyCommand="ssh -W %h:%p -p 443 ocid1.instanceconsoleconnection..c0@instance-console.eu-frankfurt-1.oci.oraclecloud.com" -N -L localhost:5900:ocid1.instance.oc1..web-fra-01:5900 ocid1.instance.oc1..web-fra-01',
},
]
// mock 态可变:保存后回读能看到变化,便于演示设置流程
export const mockTelegramSetting: TelegramSetting = {
enabled: true,
chatId: '123456789',
tokenSet: true,
tokenTail: 'k9Qw',
}
// mock 态可变:保存后回读能看到变化;缺省全开与后端语义一致
export const mockNotifyEvents: NotifyEventsSetting = {
taskFail: true,
taskRecover: true,
snatchSuccess: true,
tenantDead: true,
taskStop: true,
loginLock: true,
logEventInstance: true,
logEventIdentity: true,
logEventPolicy: true,
logEventRegion: true,
logEventLogin: true,
}
// mock 态可变:保存后回读能看到变化;缺省 3 与后端语义一致
export const mockTaskSetting: TaskSetting = { snatchAuthFailLimit: 3 }
export const mockSecuritySetting: SecuritySetting = {
loginFailLimit: 5,
loginLockMinutes: 15,
ipRateRps: 10,
ipRateBurst: 30,
realIpHeader: '',
appUrl: '',
}
// 系统操作日志:倒序排列;含失败登录(401)与失败写操作,便于验收状态标红
export const mockSystemLogs: SystemLog[] = [
{
id: 14,
username: 'admin',
method: 'POST',
path: '/api/v1/oci-configs/:id/instances',
status: 200,
durationMs: 9572,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-06T15:42:11+08:00',
},
{
id: 13,
username: 'admin',
method: 'PUT',
path: '/api/v1/settings/telegram',
status: 200,
durationMs: 12,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-06T15:38:47+08:00',
},
{
id: 12,
username: 'root',
method: 'POST',
path: '/api/v1/auth/login',
status: 401,
durationMs: 87,
clientIp: '198.51.100.23',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
errMsg: '用户名、密码或验证码错误',
createdAt: '2026-07-06T14:03:52+08:00',
},
{
id: 11,
username: 'admin',
method: 'POST',
path: '/api/v1/auth/login',
status: 200,
durationMs: 104,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-06T09:15:20+08:00',
},
{
id: 10,
username: 'admin',
method: 'DELETE',
path: '/api/v1/oci-configs/:id/instances/:instanceId',
status: 200,
durationMs: 3210,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-05T22:40:05+08:00',
},
{
id: 9,
username: 'admin',
method: 'POST',
path: '/api/v1/oci-configs/:id/instances/:instanceId/action',
status: 502,
durationMs: 1840,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
errMsg: '请求失败',
createdAt: '2026-07-05T22:31:44+08:00',
},
{
id: 8,
username: 'admin',
method: 'POST',
path: '/api/v1/tasks',
status: 201,
durationMs: 9,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-05T20:12:30+08:00',
},
{
id: 7,
username: 'admin',
method: 'PUT',
path: '/api/v1/tasks/:id',
status: 200,
durationMs: 8,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-05T20:10:02+08:00',
},
{
id: 6,
username: 'admin',
method: 'POST',
path: '/api/v1/oci-configs/:id/verify',
status: 200,
durationMs: 2380,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-04T18:55:19+08:00',
},
{
id: 5,
username: 'admin',
method: 'PUT',
path: '/api/v1/oci-configs/:id',
status: 200,
durationMs: 15,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-04T18:52:40+08:00',
},
{
id: 4,
username: 'admin',
method: 'POST',
path: '/api/v1/oci-configs',
status: 400,
durationMs: 6,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
errMsg: '请求失败',
createdAt: '2026-07-04T18:50:08+08:00',
},
{
id: 3,
username: 'guest',
method: 'POST',
path: '/api/v1/auth/login',
status: 401,
durationMs: 92,
clientIp: '198.51.100.23',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
errMsg: '用户名、密码或验证码错误',
createdAt: '2026-07-04T03:22:37+08:00',
},
{
id: 2,
username: 'admin',
method: 'POST',
path: '/api/v1/oci-configs/:id/subnets',
status: 200,
durationMs: 1420,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-03T16:08:59+08:00',
},
{
id: 1,
username: 'admin',
method: 'POST',
path: '/api/v1/oci-configs/:id/vcns',
status: 200,
durationMs: 1980,
clientIp: '203.0.113.7',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36',
createdAt: '2026-07-03T16:07:12+08:00',
},
]
// 日志回传事件:倒序排列;含一条未解析与一条截断样本,便于验收徽标与占位
export const mockLogEvents: LogEvent[] = [
{
id: 3,
ociConfigId: 1,
messageId: 'msg-0003',
eventType: '',
source: '',
sourceIp: '',
eventTime: null,
payload: 'opaque test message published from console',
truncated: false,
processed: false,
receivedAt: '2026-07-07T10:12:40+08:00',
},
{
id: 2,
ociConfigId: 5,
messageId: 'msg-0002',
eventType: 'com.oraclecloud.ComputeApi.TerminateInstance',
source: 'ComputeApi',
sourceIp: '203.0.113.7',
eventTime: '2026-07-07T09:58:02+08:00',
payload:
'{"eventType":"com.oraclecloud.ComputeApi.TerminateInstance","source":"ComputeApi","eventTime":"2026-07-07T01:58:02Z","data":{"compartmentName":"root","resourceName":"tokyo-a1-1"}}',
truncated: true,
processed: true,
receivedAt: '2026-07-07T09:58:10+08:00',
},
{
id: 1,
ociConfigId: 1,
messageId: 'msg-0001',
eventType: 'com.oraclecloud.identityControlPlane.UpdateUser',
source: 'IdentityControlPlane',
sourceIp: '198.51.100.23',
eventTime: '2026-07-06T22:14:33+08:00',
payload:
'{"eventType":"com.oraclecloud.identityControlPlane.UpdateUser","source":"IdentityControlPlane","eventTime":"2026-07-06T14:14:33Z","data":{"resourceName":"api.user"}}',
truncated: false,
processed: true,
receivedAt: '2026-07-06T22:14:40+08:00',
},
]
// 回传回调地址:mock 态可变,生成 / 撤销后回读可见
export const mockLogWebhooks = new Map<number, LogWebhookInfo>()
// OCI 侧回传链路:mock 态记录「已一键创建」的租户
export const mockLogRelays = new Map<number, boolean>()