-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathformat.ts
More file actions
42 lines (40 loc) · 1.01 KB
/
format.ts
File metadata and controls
42 lines (40 loc) · 1.01 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
import { google } from '@google-cloud/resource-manager/build/protos/protos'
import { GcpOrganization } from '../../types/generated'
import { RawGcpOrganization } from './data'
import { toISOString } from '../../utils/dateutils'
import { enumKeyToString, formatKeyValuesFromMap } from '../../utils/format'
export default ({
service,
region,
}: {
service: RawGcpOrganization
region: string
}): GcpOrganization => {
const {
id,
projectId,
name,
displayName,
directoryCustomerId,
state,
createTime,
updateTime,
deleteTime,
etag,
tags = {},
} = service
return {
id,
projectId,
region,
name,
displayName,
directoryCustomerId,
state: enumKeyToString(google.cloud.resourcemanager.v3.Organization.State, state),
createTime: toISOString(createTime?.seconds?.toString()),
updateTime: toISOString(updateTime?.seconds?.toString()),
deleteTime: toISOString(deleteTime?.seconds?.toString()),
etag,
tags: formatKeyValuesFromMap(tags),
}
}