Skip to content

Commit f1a907e

Browse files
committed
feat(services): rename tables and properties to fix postgres long names errors
1 parent 7fc2231 commit f1a907e

14 files changed

Lines changed: 212 additions & 260 deletions

File tree

src/services/aksManagedCluster/schema.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,5 +193,5 @@ type azureAksManagedCluster implements azureResource
193193
skuName: String @search(by: [hash, regexp])
194194
skuTier: String @search(by: [hash, regexp])
195195
resourceGroup: [azureResourceGroup] @hasInverse(field: aksManagedClusters)
196-
virtualMachineScaleSets: [azureVirtualMachineScaleSet] @hasInverse(field: aksManagedClusters)
196+
virtualMachineScaleSets: [azureVmScaleSet] @hasInverse(field: aksManagedClusters)
197197
}

src/services/billing/schema.graphql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
type azureBilling implements azureBaseResource @key(fields: "id") {
22
subscriptionId: String @search(by: [hash, regexp])
33
region: String @search(by: [hash, regexp])
4-
totalCostMonthToDate: awsTotalBillingInfo
5-
totalCostLast30Days: awsTotalBillingInfo
6-
monthToDateDailyAverage: [awsServiceBillingInfo]
7-
last30DaysDailyAverage: [awsServiceBillingInfo]
8-
monthToDate: [awsServiceBillingInfo]
9-
last30Days: [awsServiceBillingInfo]
4+
totalCostMonthToDate: azureTotalBillingInfo
5+
totalCostLast30Days: azureTotalBillingInfo
6+
monthToDateDailyAverage: [azureServiceBillingInfo]
7+
last30DaysDailyAverage: [azureServiceBillingInfo]
8+
monthToDate: [azureServiceBillingInfo]
9+
last30Days: [azureServiceBillingInfo]
1010
}
1111

12-
type awsServiceBillingInfo
12+
type azureServiceBillingInfo
1313
@generate(
1414
query: { get: false, query: false, aggregate: false }
1515
mutation: { add: false, delete: false }
@@ -21,7 +21,7 @@ type awsServiceBillingInfo
2121
formattedCost: String @search(by: [hash, regexp])
2222
}
2323

24-
type awsTotalBillingInfo
24+
type azureTotalBillingInfo
2525
@generate(
2626
query: { get: false, query: false, aggregate: false }
2727
mutation: { add: false, delete: false }

src/services/cdnEndpoints/schema.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type azureCdnSigningParamIdentifier {
4040
paramName: String @search(by: [hash, regexp])
4141
}
4242

43-
type azureCdnResourceRef {
43+
type azureCdnResourceReference {
4444
id: String! @id @search(by: [hash, regexp])
4545
}
4646

@@ -54,7 +54,7 @@ type azureCdnDeliveryRuleActionParameter {
5454
customFragment: String @search(by: [hash, regexp])
5555
algorithm: String @search(by: [hash, regexp])
5656
parameterNameOverride: [azureCdnSigningParamIdentifier]
57-
originGroup: azureCdnResourceRef
57+
originGroup: azureCdnResourceReference
5858
sourcePattern: String @search(by: [hash, regexp])
5959
destination: String @search(by: [hash, regexp])
6060
preserveUnmatchedPath: Boolean @search

src/services/containerRegistry/format.ts

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import cuid from 'cuid'
2-
import { formatTagsFromMap } from '../../utils/format'
2+
import { formatTagsFromMap, transformSystemData } from '../../utils/format'
33
import { RawAzureContainerRegistry } from './data'
44
import { AzureContainerRegistry } from '../../types/generated'
55

@@ -84,13 +84,32 @@ export default ({
8484
dataEndpointEnabled,
8585
dataEndpointHostNames,
8686
privateEndpointConnections:
87-
privateEndpointConnections.map(({ id: privateEndpointId, privateLinkServiceConnectionState, ...rest }) => ({
88-
id: privateEndpointId || cuid(),
89-
privateLinkServiceConnectionStateStatus: privateLinkServiceConnectionState?.status,
90-
privateLinkServiceConnectionStateActionsRequired: privateLinkServiceConnectionState?.actionsRequired,
91-
privateLinkServiceConnectionStateDescription: privateLinkServiceConnectionState?.description,
92-
...rest,
93-
})) || [],
87+
privateEndpointConnections.map(
88+
({
89+
id: privateEndpointId,
90+
privateLinkServiceConnectionState,
91+
privateEndpoint,
92+
systemData,
93+
name: peName,
94+
type: peType,
95+
provisioningState: peProvisioningState,
96+
}) => ({
97+
id: privateEndpointId || cuid(),
98+
name: peName,
99+
type: peType,
100+
provisioningState: peProvisioningState,
101+
privateLinkServiceConnectionStateStatus:
102+
privateLinkServiceConnectionState?.status,
103+
privateLinkServiceConnectionStateActionsRequired:
104+
privateLinkServiceConnectionState?.actionsRequired,
105+
privateLinkServiceConnectionStateDescription:
106+
privateLinkServiceConnectionState?.description,
107+
privateEndpoint: {
108+
id: privateEndpoint.id || cuid(),
109+
},
110+
...transformSystemData(systemData),
111+
})
112+
) || [],
94113
publicNetworkAccess,
95114
networkRuleBypassOptions,
96115
zoneRedundancy,

src/services/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import chalk from 'chalk'
88
import { isEmpty, merge, unionBy } from 'lodash'
99
import path from 'path'
1010

11+
import { DocumentNode } from 'graphql'
1112
import {
1213
DEFAULT_REGION,
1314
DEFAULT_RESOURCES,
@@ -26,9 +27,9 @@ import {
2627
getClientSecretCredentials,
2728
getTokenCredentials
2829
} from '../utils/authUtils'
29-
import enhancers, { EnhancerConfig } from './base/enhancers'
3030
import { createDiffSecs } from '../utils/dateutils'
3131
import { obfuscateSensitiveString } from '../utils/format'
32+
import enhancers, { EnhancerConfig } from './base/enhancers'
3233

3334
export const enums = {
3435
services,
@@ -337,7 +338,7 @@ export default class Provider extends CloudGraph.Client {
337338
* getSchema is used to get the schema for provider
338339
* @returns A string of graphql sub schemas
339340
*/
340-
getSchema(): any {
341+
getSchema(): DocumentNode {
341342
const typesArray = loadFilesSync(path.join(__dirname), {
342343
recursive: true,
343344
extensions: ['graphql'],

src/services/recoveryInstances/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export default ({
184184
}: {
185185
service: RawAzureProtectedItemResource
186186
account: string
187-
}): AzureBackupInstance => {
187+
}): AzureRecoveryInstance => {
188188
const { id, name, type, region, eTag, properties, resourceGroupId } = service
189189
return {
190190
id: id || cuid(),

src/services/recoveryInstances/schema.graphql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type azureRecoveryInstanceItemExtendedInfo
1313
lastRefreshedAt: DateTime @search(by: [day])
1414
}
1515

16-
type azureBackupInstanceResourceHealth
16+
type azureRecoveryInstanceResourceHealth
1717
@generate(
1818
query: { get: false, query: true, aggregate: false }
1919
mutation: { add: false, delete: false }
@@ -47,14 +47,14 @@ type azureRecoveryInstanceExtendedProperties
4747
linuxVmApplicationName: String @search(by: [hash, regexp])
4848
}
4949

50-
type azureBackupInstanceKPIResourceHealth
50+
type azureRecoveryInstanceKPIResourceHealth
5151
@generate(
5252
query: { get: false, query: true, aggregate: false }
5353
mutation: { add: false, delete: false }
5454
subscription: false
5555
) {
5656
resourceHealthStatus: String @search(by: [hash, regexp])
57-
resourceHealthDetails: [azureBackupInstanceResourceHealth]
57+
resourceHealthDetails: [azureRecoveryInstanceResourceHealth]
5858
}
5959

6060
type azureRecoveryInstanceKpisHealths
@@ -66,7 +66,7 @@ type azureRecoveryInstanceKpisHealths
6666
@key(fields: "id") {
6767
id: String! @id
6868
key: String @search(by: [hash, regexp])
69-
value: azureBackupInstanceKPIResourceHealth
69+
value: azureRecoveryInstanceKPIResourceHealth
7070
}
7171

7272
type azureRecoveryInstanceErrorDetail
@@ -124,7 +124,7 @@ type azureRecoveryInstanceProperties
124124
extendedInfo: azureRecoveryInstanceItemExtendedInfo
125125
virtualMachineId: String @search(by: [hash, regexp])
126126
healthStatus: String @search(by: [hash, regexp])
127-
healthDetails: [azureBackupInstanceResourceHealth]
127+
healthDetails: [azureRecoveryInstanceResourceHealth]
128128
protectedItemDataId: String @search(by: [hash, regexp])
129129
extendedProperties: azureRecoveryInstanceExtendedProperties
130130
serverName: String @search(by: [hash, regexp])

src/services/recoveryPolicies/format.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
AzureRecoveryPolicyRetentionPolicyUnion,
2424
AzureRecoveryPolicySchedulePolicyUnion,
2525
} from '../../types/generated'
26+
import { RawAzureProtectionPolicyResource } from './data'
2627

2728
export interface RawAzureSchedulePolicy extends SchedulePolicy {
2829
scheduleFrequencyInMins?: number

src/services/recoveryVaults/format.ts

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -107,42 +107,7 @@ export default ({
107107
value: identity?.userAssignedIdentities[key],
108108
})),
109109
},
110-
properties: {
111-
...properties,
112-
moveDetails: {
113-
...properties?.moveDetails,
114-
completionTimeUtc: properties?.moveDetails?.completionTimeUtc?.toISOString(),
115-
startTimeUtc: properties?.moveDetails?.startTimeUtc?.toISOString(),
116-
},
117-
upgradeDetails: {
118-
...properties?.upgradeDetails,
119-
endTimeUtc: properties?.upgradeDetails?.endTimeUtc?.toISOString(),
120-
lastUpdatedTimeUtc: properties?.upgradeDetails?.lastUpdatedTimeUtc?.toISOString(),
121-
startTimeUtc: properties?.upgradeDetails?.startTimeUtc?.toISOString(),
122-
},
123-
privateEndpointConnections: properties?.privateEndpointConnections?.map(connection => ({
124-
id: connection?.id || cuid(),
125-
properties: {
126-
provisioningState: connection.properties?.provisioningState,
127-
privateEndpoint: connection.properties?.privateEndpoint,
128-
privateLinkServiceConnectionState: {
129-
status: connection.properties?.privateLinkServiceConnectionState?.status,
130-
description: connection.properties?.privateLinkServiceConnectionState?.description,
131-
actionsRequired: connection.properties?.privateLinkServiceConnectionState?.actionsRequired,
132-
}
133-
},
134-
name: connection.name,
135-
type: connection.type,
136-
location: connection.location
137-
})),
138-
},
139-
sku,
140-
createdBy: systemData?.createdBy,
141-
createdByType: systemData?.createdByType,
142-
createdAt: systemData?.createdAt?.toISOString(),
143-
lastModifiedBy: systemData?.lastModifiedBy,
144-
lastModifiedByType: systemData?.lastModifiedByType,
145-
lastModifiedAt: systemData?.lastModifiedAt?.toISOString(),
110+
...transformSystemData(systemData),
146111
tags: formatTagsFromMap(Tags),
147112
}
148-
}
113+
}

src/services/recoveryVaults/schema.graphql

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ type azureRecoveryVaultUpgradeDetails
1515
previousResourceId: String @search(by: [hash, regexp])
1616
}
1717

18+
type azureRecoveryVaultPrivateEndpoint
19+
@generate(
20+
query: { get: false, query: true, aggregate: false }
21+
mutation: { add: false, delete: false }
22+
subscription: false
23+
) {
24+
id: String @search(by: [hash, regexp])
25+
}
26+
1827
type azureRecoveryVaultPrivateLinkServiceConnectionState
1928
@generate(
2029
query: { get: false, query: true, aggregate: false }
@@ -26,7 +35,7 @@ type azureRecoveryVaultPrivateLinkServiceConnectionState
2635
actionsRequired: String @search(by: [hash, regexp])
2736
}
2837

29-
type azureRecoveryVaultPrivateEndpointConnection
38+
type azureRecoveryVaultPrivateEndpointConn
3039
@generate(
3140
query: { get: false, query: true, aggregate: false }
3241
mutation: { add: false, delete: false }

0 commit comments

Comments
 (0)