Skip to content

Commit 48c4e56

Browse files
authored
Merge pull request #87 from cloudgraphdev/alpha
Beta release
2 parents 060a4db + 78e47c7 commit 48c4e56

File tree

17 files changed

+612
-1
lines changed

17 files changed

+612
-1
lines changed

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
# [0.68.0-alpha.1](https://github.com/cloudgraphdev/cloudgraph-provider-azure/compare/0.67.0...0.68.0-alpha.1) (2023-10-02)
2+
3+
4+
### Features
5+
6+
* **azure:** Add ContainerApp services ([6a0c656](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/6a0c656e3b99361ada25cbc40f58cba90cd0bef5))
7+
8+
# [0.67.0](https://github.com/cloudgraphdev/cloudgraph-provider-azure/compare/0.66.0...0.67.0) (2023-07-19)
9+
10+
11+
### Bug Fixes
12+
13+
* Added missing attribute for cosmosdb schema ([cde0c79](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/cde0c791374d648f77541b1189ddbd3062ea67aa))
14+
15+
16+
### Features
17+
18+
* add publicIp missing services ([33ae7da](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/33ae7da24dd69264344016bf4af3b25a6264c43d))
19+
* Added missing subnets ids and endpoint policies for subnets ([baa0a6e](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/baa0a6e72510f70e217a5c516479db8d5d05294f))
20+
* **azure:** Add missing dataFactory services ([2b9a48b](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/2b9a48b9e848aad2775069167dcb406ad0dc8f77))
21+
* **azure:** add missing mySQL Server services ([90131c8](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/90131c83d231a8ef3d2f29b23412e978688e32dc))
22+
* **azure:** Add missing postgreSql server services ([8aeff96](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/8aeff969f44cfa8751fefacbbca6597cf7213cd1))
23+
* **azure:** Add missing SQL Server services ([41bffd4](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/41bffd48c728303d0d697509c9efa9a5c7442166))
24+
* **azure:** add route table services ([5573e8e](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/5573e8eeee9387d50e440e7d1aecd4c529f3c531))
25+
* **azure:** Support missing storageBlob and storageContainer services ([b179ebf](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/b179ebf76107a6285c978067b79f544e995df66f))
26+
* collect crawl error logs ([bd58d1d](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/bd58d1dce0cd55d86828b0a463d41061352f2517))
27+
* Exposed containersIds for cosmosdb account ([8b45320](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/8b4532048fc8137539489adb38eee101ff867039))
28+
* Fetched records for private dns ([83cbdd8](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/83cbdd809f81e750d5abc83bf503dba47e12fe50))
29+
* Fetched virtual network links for private zone ([414ceec](https://github.com/cloudgraphdev/cloudgraph-provider-azure/commit/414ceece3af505c18a76d6141d63a8d85e20067b))
30+
131
# [0.67.0-beta.1](https://github.com/cloudgraphdev/cloudgraph-provider-azure/compare/0.66.0...0.67.0-beta.1) (2023-07-19)
232

333

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudgraph/cg-provider-azure",
3-
"version": "0.67.0-beta.1",
3+
"version": "0.68.0-alpha.1",
44
"description": "CloudGraph provider plugin for Azure used to fetch Azure cloud data.",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org/",
@@ -31,6 +31,7 @@
3131
"terraform:cleanup": "rimraf ./tests/terraform/{.terraform,.terraform.lock.hcl,tfplan} ./tests/terraform/*.{tfstate,tfplan,backup}"
3232
},
3333
"dependencies": {
34+
"@azure/arm-appcontainers": "^2.0.0",
3435
"@azure/arm-appinsights": "^4.0.0",
3536
"@azure/arm-appservice": "^11.0.0",
3637
"@azure/arm-authorization": "^8.4.1",

src/enums/serviceMap.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import AzureCdnOrigins from '../services/cdnOrigins'
2424
import AzureCdnProfiles from '../services/cdnProfiles'
2525
import AzureCognitiveServicesAccount from '../services/cognitiveServicesAccount'
2626
import AzureContainerRegistry from '../services/containerRegistry'
27+
import AzureContainerApp from '../services/containerApp'
28+
import AzureContainerAppEnvironment from '../services/containerAppEnvironment'
2729
import AzureDataCollectionRule from '../services/dataCollectionRule'
2830
import AzureDataFactory from '../services/dataFactory'
2931
import AzureDatabaseManagedSqlInstance from '../services/databaseManagedSqlInstance'
@@ -131,6 +133,8 @@ export default {
131133
[services.cdnProfiles]: AzureCdnProfiles,
132134
[services.cognitiveServicesAccount]: AzureCognitiveServicesAccount,
133135
[services.containerRegistry]: AzureContainerRegistry,
136+
[services.containerApp]: AzureContainerApp,
137+
[services.containerAppEnvironment]: AzureContainerAppEnvironment,
134138
[services.cosmosDb]: AzureCosmosDb,
135139
[services.dataCollectionRule]: AzureDataCollectionRule,
136140
[services.dataFactory]: AzureDataFactory,

src/enums/services.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export default {
2929
cdnProfiles: 'cdnProfiles',
3030
cognitiveServicesAccount: 'cognitiveServicesAccount',
3131
containerRegistry: 'containerRegistry',
32+
containerApp: 'containerApp',
33+
containerAppEnvironment: 'containerAppEnvironment',
3234
cosmosDb: 'cosmosDb',
3335
dataCollectionRule: 'dataCollectionRule',
3436
dataFactory: 'dataFactory',

src/properties/logger.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ export default {
7070
`Found ${num} CDN origin groups`,
7171
foundContainerRegistries: (num: number): string =>
7272
`Found ${num} container registries`,
73+
foundContainerApps: (num: number): string => `Found ${num} container apps`,
74+
foundContainerAppEnvironment: (num: number): string =>
75+
`Found ${num} container environments`,
7376
/* Cosmos DB */
7477
foundCosmosDbAccounts: (num: number): string =>
7578
`Found ${num} cosmos DB accounts`,

src/services/containerApp/data.ts

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import { ContainerApp, ContainerAppsAPIClient } from '@azure/arm-appcontainers'
2+
3+
import CloudGraph from '@cloudgraph/sdk'
4+
5+
import azureLoggerText from '../../properties/logger'
6+
import { AzureServiceInput, TagMap } from '../../types'
7+
import { tryCatchWrapper } from '../../utils/index'
8+
import { regionMap } from '../../enums/regions'
9+
10+
const { logger } = CloudGraph
11+
const lt = { ...azureLoggerText }
12+
const serviceName = 'ContainerApp'
13+
14+
export interface RawAzureContainerApp
15+
extends Omit<ContainerApp, 'location' | 'tags'> {
16+
resourceGroupId?: string
17+
region: string
18+
customDomainVerificationId?: string
19+
environmentId?: string
20+
latestReadyRevisionName?: string
21+
latestRevisionFqdn?: string
22+
latestRevisionName?: string
23+
location?: string
24+
managedEnvironmentId?: string
25+
provisioningState?: string
26+
workloadProfileName?: string
27+
Tags: TagMap
28+
}
29+
30+
export default async ({
31+
config,
32+
}: AzureServiceInput): Promise<{
33+
[property: string]: RawAzureContainerApp[]
34+
}> => {
35+
try {
36+
const { tokenCredentials, subscriptionId } = config
37+
const client = new ContainerAppsAPIClient(tokenCredentials, subscriptionId)
38+
39+
const containerApps: RawAzureContainerApp[] = []
40+
const result = { global: [] }
41+
await tryCatchWrapper(
42+
async () => {
43+
for await (const containerApp of client.containerApps.listBySubscription()) {
44+
if (containerApp) {
45+
const { tags, ...rest } = containerApp
46+
47+
containerApps.push({
48+
...rest,
49+
id: rest.id.replace('/containerapps/', '/containerApps/'), // fix casing in Id
50+
region: containerApp.location || regionMap.global,
51+
Tags: tags || {},
52+
})
53+
}
54+
}
55+
},
56+
{
57+
service: serviceName,
58+
client,
59+
scope: 'containerApps',
60+
operation: 'listBySubscription',
61+
}
62+
)
63+
logger.debug(lt.foundContainerApps(containerApps.length))
64+
65+
containerApps.map(({ region, ...rest }) => {
66+
result.global.push({
67+
...rest,
68+
region,
69+
})
70+
})
71+
return result
72+
} catch (e) {
73+
logger.error(e)
74+
return {}
75+
}
76+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { RawAzureContainerApp } from './data'
2+
import { formatTagsFromMap } from '../../utils/format'
3+
import { AzureContainerApp } from '../../types/generated'
4+
5+
export default ({
6+
service,
7+
account: subscriptionId,
8+
}: {
9+
service: RawAzureContainerApp
10+
account: string
11+
}): AzureContainerApp => {
12+
const {
13+
id,
14+
name,
15+
type,
16+
region,
17+
resourceGroupId,
18+
customDomainVerificationId,
19+
environmentId,
20+
latestReadyRevisionName,
21+
latestRevisionFqdn,
22+
latestRevisionName,
23+
location,
24+
managedEnvironmentId,
25+
provisioningState,
26+
workloadProfileName,
27+
Tags = {},
28+
} = service
29+
return {
30+
id,
31+
name,
32+
type,
33+
region,
34+
resourceGroupId,
35+
customDomainVerificationId,
36+
environmentId,
37+
latestReadyRevisionName,
38+
latestRevisionFqdn,
39+
latestRevisionName,
40+
location,
41+
managedEnvironmentId,
42+
provisioningState,
43+
workloadProfileName,
44+
subscriptionId,
45+
tags: formatTagsFromMap(Tags),
46+
}
47+
}

src/services/containerApp/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Service } from '@cloudgraph/sdk'
2+
import BaseService from '../base'
3+
import format from './format'
4+
import mutation from './mutation'
5+
import getData from './data'
6+
7+
export default class AzureContainerApp extends BaseService implements Service {
8+
format = format.bind(this)
9+
10+
getData = getData.bind(this)
11+
12+
mutation = mutation
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default `mutation($input: [AddazureContainerAppInput!]!) {
2+
addazureContainerApp(input: $input, upsert: true) {
3+
numUids
4+
}
5+
}`
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type azureContainerApp implements azureResource
2+
@generate(
3+
query: { get: true, query: true, aggregate: true }
4+
mutation: { add: true, delete: false }
5+
)
6+
@key(fields: "id") {
7+
location: String @search(by: [hash, regexp])
8+
provisioningState: String @search(by: [hash, regexp])
9+
managedEnvironmentId: String @search(by: [hash, regexp])
10+
environmentId: String @search(by: [hash, regexp])
11+
workloadProfileName: String @search(by: [hash, regexp])
12+
latestRevisionName: String @search(by: [hash, regexp])
13+
latestReadyRevisionName: String @search(by: [hash, regexp])
14+
latestRevisionFqdn: String @search(by: [hash, regexp])
15+
customDomainVerificationId: String @search(by: [hash, regexp])
16+
}

0 commit comments

Comments
 (0)