Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@azure/identity": "^2.0.4",
"@azure/storage-blob": "^12.8.0",
"@azure/storage-queue": "^12.9.0",
"@cloudgraph/sdk": "0.20.0",
"@cloudgraph/sdk": "0.22.0",
"@graphql-tools/load-files": "^6.5.3",
"@graphql-tools/merge": "^8.2.3",
"@microsoft/microsoft-graph-client": "^3.0.2",
Expand Down
28 changes: 23 additions & 5 deletions src/services/actionGroup/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cuid from 'cuid'
import { generateUniqueId } from '@cloudgraph/sdk'
import { RawAzureActionGroup } from './data'
import { AzureActionGroup } from '../../types/generated'
import { formatTagsFromMap } from '../../utils/format'
Expand All @@ -24,17 +24,35 @@ export default ({
Tags = {},
} = service
return {
id: id || cuid(),
id,
name,
type,
region,
subscriptionId,
resourceGroupId,
enabled,
groupShortName,
emailReceivers: emailReceivers.map(e => ({ id: cuid(), ...e })),
smsReceivers: smsReceivers.map(s => ({ id: cuid(), ...s })),
webhookReceivers: webhookReceivers.map(w => ({ id: cuid(), ...w })),
emailReceivers: emailReceivers.map(e => ({
id: generateUniqueId({
id,
...e,
}),
...e,
})),
smsReceivers: smsReceivers.map(s => ({
id: generateUniqueId({
id,
...s,
}),
...s,
})),
webhookReceivers: webhookReceivers.map(w => ({
id: generateUniqueId({
id,
...w,
}),
...w,
})),
tags: formatTagsFromMap(Tags),
}
}
26 changes: 16 additions & 10 deletions src/services/activityLogAlerts/format.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import cuid from 'cuid'
import { generateUniqueId } from '@cloudgraph/sdk'
import { RawAzureActivityLogAlert } from './data'
import { AzureActivityLogAlert } from '../../types/generated'
import { formatTagsFromMap } from '../../utils/format'

export default ({
service,
account: subscriptionId
account: subscriptionId,
}: {
service: RawAzureActivityLogAlert
account: string
}) : AzureActivityLogAlert => {
}): AzureActivityLogAlert => {
const {
id,
name,
Expand All @@ -23,7 +23,7 @@ export default ({
Tags = {},
} = service
return {
id: id || cuid(),
id,
name,
type,
region,
Expand All @@ -32,7 +32,7 @@ export default ({
enabled,
condition: {
allOf: condition?.allOf?.map(leaf => ({
id: cuid(),
id: generateUniqueId({ id, ...leaf }),
field: leaf?.field,
equals: leaf?.equals,
})),
Expand All @@ -41,11 +41,17 @@ export default ({
actionGroups: actions?.actionGroups?.map(group => ({
id: group.actionGroupId,
actionGroupId: group.actionGroupId,
webhookProperties: Object.entries(group?.webhookProperties || {}).map(([key, value]) => ({
id: cuid(),
key,
value
})),
webhookProperties: Object.entries(group?.webhookProperties || {}).map(
([key, value]) => ({
id: generateUniqueId({
id,
actionGroupId: group.actionGroupId,
key
}),
key,
value,
})
),
})),
},
description,
Expand Down
5 changes: 2 additions & 3 deletions src/services/adApplication/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cuid from 'cuid'
import { AzureAdApplication } from '../../types/generated'
import { formatTagsFromMap } from '../../utils/format'
import { RawAzureADApplication } from './data'
Expand Down Expand Up @@ -42,7 +41,7 @@ export default ({
} = {},
} = service
return {
id: id || cuid(),
id,
region,
appId,
applicationTemplateId,
Expand All @@ -52,7 +51,7 @@ export default ({
({ appId: preAuthAppId }) => preAuthAppId
),
appRoles: appRoles.map(({ id: appRoleId, ...restOfAppRole }) => ({
id: appRoleId || cuid(),
id: appRoleId,
...restOfAppRole,
})),
createdDateTime,
Expand Down
21 changes: 15 additions & 6 deletions src/services/adGroup/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cuid from 'cuid'
import { generateUniqueId } from '@cloudgraph/sdk'
import { AzureAdGroup } from '../../types/generated'
import { RawAzureADGroup } from './data'

Expand Down Expand Up @@ -38,7 +38,7 @@ export default ({ service }: { service: RawAzureADGroup }): AzureAdGroup => {
settings = [],
} = service
return {
id: id || cuid(),
id,
deletedDateTime,
classification,
createdDateTime,
Expand Down Expand Up @@ -67,11 +67,20 @@ export default ({ service }: { service: RawAzureADGroup }): AzureAdGroup => {
allowExternalSenders,
isSubscribedByMail,
isArchived,
appRoleAssignments: appRoleAssignments.map(aRA => ({ id: cuid(), ...aRA })),
permissionGrants: permissionGrants.map(pG => ({ id: cuid(), ...pG })),
appRoleAssignments: appRoleAssignments.map(aRA => ({
id: aRA.id,
...aRA,
})),
permissionGrants: permissionGrants.map(pG => ({
id: pG.id,
...pG,
})),
settings: settings.map(({ id: sId, values: sValues = [], ...s }) => ({
id: sId || cuid(),
values: sValues.map(sValue => ({ id: cuid(), ...sValue })),
id: sId,
values: sValues.map(sValue => ({
id: generateUniqueId({ id, ...sValue }),
...sValue,
})),
...s,
})),
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cuid from 'cuid'
import { AzureAdIdentitySecurityDefaultsEnforcementPolicy } from '../../types/generated'
import { RawAzureADIdentitySecurityDefaultsEnforcementPolicyClient } from './data'

Expand All @@ -8,15 +7,9 @@ export default ({
service: RawAzureADIdentitySecurityDefaultsEnforcementPolicyClient
account: string
}): AzureAdIdentitySecurityDefaultsEnforcementPolicy => {
const {
id,
region,
description,
displayName,
isEnabled,
} = service
const { id, region, description, displayName, isEnabled } = service
return {
id: id || cuid(),
id,
region,
description,
displayName,
Expand Down
11 changes: 5 additions & 6 deletions src/services/adServicePrincipal/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cuid from 'cuid'
import { AzureAdServicePrincipal } from '../../types/generated'
import { formatTagsFromMap } from '../../utils/format'
import { RawAzureADServicePrincipal } from './data'
Expand Down Expand Up @@ -42,7 +41,7 @@ export default ({
endpoints = [],
} = service
return {
id: id || cuid(),
id,
region,
deletedDateTime,
accountEnabled,
Expand All @@ -54,7 +53,7 @@ export default ({
appOwnerOrganizationId,
appRoleAssignmentRequired,
appRoles: appRoles.map(({ id: aRId, ...aR }) => ({
id: aRId || cuid(),
id: aRId,
...aR,
})),
description,
Expand All @@ -73,15 +72,15 @@ export default ({
tags: formatTagsFromMap(Tags),
tokenEncryptionKeyId,
appRoleAssignedTo: appRoleAssignedTo.map(({ id: aRaTId, ...aRaT }) => ({
id: aRaTId || cuid(),
id: aRaTId,
...aRaT,
})),
appRoleAssignments: appRoleAssignments.map(({ id: aRAId, ...aRA }) => ({
id: aRAId || cuid(),
id: aRAId,
...aRA,
})),
endpoints: endpoints.map(({ id: eId, ...e }) => ({
id: eId || cuid(),
id: eId,
...e,
})),
}
Expand Down
8 changes: 5 additions & 3 deletions src/services/adUser/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import cuid from 'cuid'
import { AzureAdUser } from '../../types/generated'
import { RawAzureADUser } from './data'

Expand Down Expand Up @@ -52,7 +51,7 @@ export default ({
appRoleAssignments = [],
} = service
return {
id: id || cuid(),
id,
deletedDateTime,
accountEnabled,
ageGroup,
Expand Down Expand Up @@ -91,6 +90,9 @@ export default ({
userType,
preferredName,
responsibilities,
appRoleAssignments: appRoleAssignments.map(aRA => ({ id: cuid(), ...aRA })),
appRoleAssignments: appRoleAssignments.map(aRA => ({
id: aRA.id,
...aRA,
})),
}
}
6 changes: 3 additions & 3 deletions src/services/aksManagedCluster/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ManagedClusterAADProfile,
ManagedClusterAgentPoolProfile,
} from '@azure/arm-containerservice'
import cuid from 'cuid'
import { generateUniqueId } from '@cloudgraph/sdk'
import {
AzureAksManagedCluster,
AzureAksManagedClusterAadProfile,
Expand All @@ -26,7 +26,7 @@ const formatAgentPoolProfiles = (
tags,
...rest
}) => ({
id: cuid(),
id: generateUniqueId({ powerStateCode, upgradeMaxSurge, ...rest }),
powerStateCode,
upgradeMaxSurge,
...rest,
Expand Down Expand Up @@ -113,7 +113,7 @@ export default ({
{}

return {
id: id || cuid(),
id,
subscriptionId: account,
name,
type,
Expand Down
4 changes: 1 addition & 3 deletions src/services/appInsights/format.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import cuid from 'cuid'

import { AzureAppInsights } from '../../types/generated'
import { formatTagsFromMap } from '../../utils/format'
import { RawAzureAppInsight } from './data'
Expand Down Expand Up @@ -36,7 +34,7 @@ export default ({
} = service

return {
id: id || cuid(),
id,
type,
etag,
resourceGroupId,
Expand Down
6 changes: 3 additions & 3 deletions src/services/appServiceEnvironment/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cuid from 'cuid'
import { generateUniqueId } from '@cloudgraph/sdk'
import { formatTagsFromMap } from '../../utils/format'
import { RawAzureAppServiceEnvironment } from './data'
import { AzureAppServiceEnvironment } from '../../types/generated'
Expand Down Expand Up @@ -36,7 +36,7 @@ export default ({
zoneRedundant,
} = service
return {
id: id || cuid(),
id,
subscriptionId: account,
name,
kind,
Expand All @@ -54,7 +54,7 @@ export default ({
frontEndScaleFactor,
suspended,
clusterSettings: clusterSettings?.map(({ name: settingsName, value }) => ({
id: cuid(),
id: generateUniqueId({ id, settingsName }),
name: settingsName,
value,
})),
Expand Down
12 changes: 9 additions & 3 deletions src/services/appServicePlan/format.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cuid from 'cuid'
import { generateUniqueId } from '@cloudgraph/sdk'
import { Capability } from '@azure/arm-appservice'
import { formatTagsFromMap } from '../../utils/format'
import { RawAzureAppServicePlan } from './data'
Expand Down Expand Up @@ -41,7 +41,7 @@ export default ({
zoneRedundant,
} = service
return {
id: id || cuid(),
id,
subscriptionId: subscription || account,
name,
type,
Expand All @@ -61,7 +61,13 @@ export default ({
resourceGroupId,
skuDescription: {
capabilities:
capabilities?.map((c: Capability) => ({ id: cuid(), ...c })) || [],
capabilities?.map((c: Capability) => ({
id: generateUniqueId({
id,
...c,
}),
...c,
})) || [],
...restOfSku,
},
spotExpirationTime: spotExpirationTime?.toISOString(),
Expand Down
Loading