-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathformat.ts
More file actions
89 lines (85 loc) · 1.91 KB
/
format.ts
File metadata and controls
89 lines (85 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { generateUniqueId } from '@cloudgraph/sdk'
import { RawAwsOpsWorksApp } from './data'
import { AwsOpsWorksApp } from '../../types/generated'
import { opsworksAppArn } from '../../utils/generateArns'
export default ({
service,
account: accountId,
region,
}: {
service: RawAwsOpsWorksApp
account: string
region: string
}): AwsOpsWorksApp => {
const {
AppId: appId,
StackId: stackId,
Shortname: shortname,
Name: name,
Description: description,
DataSources: dataSources,
Type: type,
AppSource: appSource,
Domains: domains,
EnableSsl: enableSsl,
SslConfiguration: sslConfiguration,
Attributes: attributes,
CreatedAt: createdAt,
Environment: environment,
} = service
const arn = opsworksAppArn({ region, account: accountId, name: name })
return {
id: appId,
accountId,
arn,
region,
stackId,
shortname,
name,
description,
dataSources: dataSources.map(ds => ({
id: generateUniqueId({
arn,
...ds,
}),
type: ds.Type,
arn: ds.Arn,
databaseName: ds.DatabaseName,
})),
type,
appSource: {
type: appSource?.Type,
url: appSource?.Url,
username: appSource?.Username,
password: appSource?.Password,
sshKey: appSource?.SshKey,
revision: appSource?.Revision,
},
domains,
enableSsl,
sslConfiguration: {
certificate: sslConfiguration?.Certificate,
privateKey: sslConfiguration?.PrivateKey,
chain: sslConfiguration?.Chain,
},
attributes: Object.keys(attributes).map(key => ({
id: generateUniqueId({
arn,
key,
value: attributes[key],
}),
key,
value: attributes[key],
})),
createdAt,
environment: environment.map(e => ({
id: generateUniqueId({
arn,
...e,
}),
key: e.Key,
value: e.Value,
secure: e.Secure,
}))
}
}