@backstage/plugin-catalog-backend-module-aws 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @backstage/plugin-catalog-backend-module-aws
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - bffec1c96a: Fix S3 object URL creation at AwsS3EntityProvider by
8
+
9
+ - handle absence of region config,
10
+ - handle regions with region-less URIs (us-east-1),
11
+ - apply URI encoding,
12
+ - and simplify the logic overall.
13
+
14
+ - Updated dependencies
15
+ - @backstage/backend-common@0.13.3
16
+ - @backstage/plugin-catalog-backend@1.1.2
17
+ - @backstage/backend-tasks@0.3.1
18
+ - @backstage/integration@1.2.0
19
+ - @backstage/config@1.0.1
20
+ - @backstage/catalog-model@1.0.2
21
+
22
+ ## 0.1.5-next.1
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+ - @backstage/backend-common@0.13.3-next.2
28
+ - @backstage/plugin-catalog-backend@1.1.2-next.2
29
+ - @backstage/backend-tasks@0.3.1-next.1
30
+ - @backstage/config@1.0.1-next.0
31
+ - @backstage/catalog-model@1.0.2-next.0
32
+ - @backstage/integration@1.2.0-next.1
33
+
34
+ ## 0.1.5-next.0
35
+
36
+ ### Patch Changes
37
+
38
+ - bffec1c96a: Fix S3 object URL creation at AwsS3EntityProvider by
39
+
40
+ - handle absence of region config,
41
+ - handle regions with region-less URIs (us-east-1),
42
+ - apply URI encoding,
43
+ - and simplify the logic overall.
44
+
45
+ - Updated dependencies
46
+ - @backstage/backend-common@0.13.3-next.0
47
+ - @backstage/integration@1.2.0-next.0
48
+ - @backstage/plugin-catalog-backend@1.1.2-next.0
49
+ - @backstage/backend-tasks@0.3.1-next.0
50
+
3
51
  ## 0.1.4
4
52
 
5
53
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -244,7 +244,6 @@ function readAwsS3Config(id, config) {
244
244
  class AwsS3EntityProvider {
245
245
  constructor(config, integration, logger, schedule) {
246
246
  this.config = config;
247
- this.integration = integration;
248
247
  this.logger = logger.child({
249
248
  target: this.getProviderName()
250
249
  });
@@ -342,14 +341,8 @@ class AwsS3EntityProvider {
342
341
  }
343
342
  createObjectUrl(key) {
344
343
  const bucketName = this.config.bucketName;
345
- const endpoint = this.integration.config.endpoint;
346
- if (endpoint) {
347
- if (endpoint.startsWith(`https://${bucketName}.`)) {
348
- return `${endpoint}/${key}`;
349
- }
350
- return `${endpoint}/${bucketName}/${key}`;
351
- }
352
- return `https://${bucketName}.s3.${this.config.region}.amazonaws.com/${key}`;
344
+ const endpoint = this.s3.endpoint.href;
345
+ return encodeURI(`${endpoint}${bucketName}/${key}`);
353
346
  }
354
347
  }
355
348
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/awsOrganization/config.ts","../src/processors/AwsOrganizationCloudAccountProcessor.ts","../src/processors/AwsS3DiscoveryProcessor.ts","../src/credentials/AwsCredentials.ts","../src/providers/config.ts","../src/providers/AwsS3EntityProvider.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\n/**\n * The configuration parameters for a single AWS Organization Processor\n */\nexport type AwsOrganizationProviderConfig = {\n /**\n * The role to assume for the processor.\n */\n roleArn?: string;\n};\n\nexport function readAwsOrganizationConfig(\n config: Config,\n): AwsOrganizationProviderConfig {\n const providerConfig = config.getOptionalConfig('provider');\n\n const roleArn = providerConfig?.getOptionalString('roleArn');\n return {\n roleArn,\n };\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ResourceEntityV1alpha1 } from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport AWS, { Credentials, Organizations } from 'aws-sdk';\nimport { Account, ListAccountsResponse } from 'aws-sdk/clients/organizations';\nimport { Logger } from 'winston';\nimport {\n AwsOrganizationProviderConfig,\n readAwsOrganizationConfig,\n} from '../awsOrganization/config';\n\nconst AWS_ORGANIZATION_REGION = 'us-east-1';\nconst LOCATION_TYPE = 'aws-cloud-accounts';\n\nconst ACCOUNTID_ANNOTATION = 'amazonaws.com/account-id';\nconst ARN_ANNOTATION = 'amazonaws.com/arn';\nconst ORGANIZATION_ANNOTATION = 'amazonaws.com/organization-id';\n\n/**\n * A processor for ingesting AWS Accounts from AWS Organizations.\n *\n * If custom authentication is needed, it can be achieved by configuring the\n * global AWS.credentials object.\n *\n * @public\n */\nexport class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {\n private readonly organizations: Organizations;\n private readonly provider: AwsOrganizationProviderConfig;\n\n static fromConfig(config: Config, options: { logger: Logger }) {\n const c = config.getOptionalConfig('catalog.processors.awsOrganization');\n return new AwsOrganizationCloudAccountProcessor({\n ...options,\n provider: c ? readAwsOrganizationConfig(c) : {},\n });\n }\n\n private static buildCredentials(\n config: AwsOrganizationProviderConfig,\n ): Credentials | undefined {\n const roleArn = config.roleArn;\n if (!roleArn) {\n return undefined;\n }\n\n return new AWS.ChainableTemporaryCredentials({\n params: {\n RoleSessionName: 'backstage-aws-organization-processor',\n RoleArn: roleArn,\n },\n });\n }\n\n private constructor(options: { provider: AwsOrganizationProviderConfig }) {\n this.provider = options.provider;\n const credentials = AwsOrganizationCloudAccountProcessor.buildCredentials(\n this.provider,\n );\n this.organizations = new AWS.Organizations({\n credentials,\n region: AWS_ORGANIZATION_REGION,\n }); // Only available in us-east-1\n }\n\n getProcessorName(): string {\n return 'AwsOrganizationCloudAccountProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== LOCATION_TYPE) {\n return false;\n }\n\n (await this.getAwsAccounts())\n .map(account => this.mapAccountToComponent(account))\n .filter(entity => {\n if (location.target !== '') {\n if (entity.metadata.annotations) {\n return (\n entity.metadata.annotations[ORGANIZATION_ANNOTATION] ===\n location.target\n );\n }\n return false;\n }\n return true;\n })\n .forEach(entity => {\n emit(processingResult.entity(location, entity));\n });\n\n return true;\n }\n\n private normalizeName(name: string): string {\n return name\n .trim()\n .toLocaleLowerCase('en-US')\n .replace(/[^a-zA-Z0-9\\-]/g, '-');\n }\n\n private extractInformationFromArn(arn: string): {\n accountId: string;\n organizationId: string;\n } {\n const parts = arn.split('/');\n\n return {\n accountId: parts[parts.length - 1],\n organizationId: parts[parts.length - 2],\n };\n }\n\n private async getAwsAccounts(): Promise<Account[]> {\n let awsAccounts: Account[] = [];\n let isInitialAttempt = true;\n let nextToken = undefined;\n while (isInitialAttempt || nextToken) {\n isInitialAttempt = false;\n const orgAccounts: ListAccountsResponse = await this.organizations\n .listAccounts({ NextToken: nextToken })\n .promise();\n if (orgAccounts.Accounts) {\n awsAccounts = awsAccounts.concat(orgAccounts.Accounts);\n }\n nextToken = orgAccounts.NextToken;\n }\n\n return awsAccounts;\n }\n\n private mapAccountToComponent(account: Account): ResourceEntityV1alpha1 {\n const { accountId, organizationId } = this.extractInformationFromArn(\n account.Arn as string,\n );\n return {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Resource',\n metadata: {\n annotations: {\n [ACCOUNTID_ANNOTATION]: accountId,\n [ARN_ANNOTATION]: account.Arn || '',\n [ORGANIZATION_ANNOTATION]: organizationId,\n },\n name: this.normalizeName(account.Name || ''),\n namespace: 'default',\n },\n spec: {\n type: 'cloud-account',\n owner: 'unknown',\n },\n };\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UrlReader } from '@backstage/backend-common';\nimport { isError } from '@backstage/errors';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n CatalogProcessorParser,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport limiterFactory from 'p-limit';\n\n/**\n * A processor for automatic discovery of entities from S3 buckets. Handles the\n * `s3-discovery` location type, and target bucket URLs e.g. on the form\n * `https://testbucket.s3.us-east-2.amazonaws.com`.\n *\n * @public\n */\nexport class AwsS3DiscoveryProcessor implements CatalogProcessor {\n constructor(private readonly reader: UrlReader) {}\n\n getProcessorName(): string {\n return 'AwsS3DiscoveryProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n optional: boolean,\n emit: CatalogProcessorEmit,\n parser: CatalogProcessorParser,\n ): Promise<boolean> {\n if (location.type !== 's3-discovery') {\n return false;\n }\n\n try {\n const output = await this.doRead(location.target);\n for (const item of output) {\n for await (const parseResult of parser({\n data: item.data,\n location: { type: location.type, target: item.url },\n })) {\n emit(parseResult);\n }\n }\n } catch (error) {\n const message = `Unable to read ${location.type}, ${error}`;\n\n if (isError(error) && error.name === 'NotFoundError') {\n if (!optional) {\n emit(processingResult.notFoundError(location, message));\n }\n } else {\n emit(processingResult.generalError(location, message));\n }\n }\n return true;\n }\n\n private async doRead(\n location: string,\n ): Promise<{ data: Buffer; url: string }[]> {\n const limiter = limiterFactory(5);\n const response = await this.reader.readTree(location);\n const responseFiles = await response.files();\n const output = responseFiles.map(async file => ({\n url: file.path,\n data: await limiter(file.content),\n }));\n return Promise.all(output);\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport aws, { Credentials } from 'aws-sdk';\nimport { CredentialsOptions } from 'aws-sdk/lib/credentials';\n\nexport class AwsCredentials {\n /**\n * If accessKeyId and secretAccessKey are missing, the DefaultAWSCredentialsProviderChain will be used:\n * https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html\n */\n static create(\n config: {\n accessKeyId?: string;\n secretAccessKey?: string;\n roleArn?: string;\n },\n roleSessionName: string,\n ): Credentials | CredentialsOptions | undefined {\n if (!config) {\n return undefined;\n }\n\n const accessKeyId = config.accessKeyId;\n const secretAccessKey = config.secretAccessKey;\n let explicitCredentials: Credentials | undefined;\n\n if (accessKeyId && secretAccessKey) {\n explicitCredentials = new Credentials({\n accessKeyId,\n secretAccessKey,\n });\n }\n\n const roleArn = config.roleArn;\n if (roleArn) {\n return new aws.ChainableTemporaryCredentials({\n masterCredentials: explicitCredentials,\n params: {\n RoleArn: roleArn,\n RoleSessionName: roleSessionName,\n },\n });\n }\n\n return explicitCredentials;\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { AwsS3Config } from './types';\n\nconst DEFAULT_PROVIDER_ID = 'default';\n\nexport function readAwsS3Configs(config: Config): AwsS3Config[] {\n const configs: AwsS3Config[] = [];\n\n const providerConfigs = config.getOptionalConfig('catalog.providers.awsS3');\n if (!providerConfigs) {\n return configs;\n }\n\n if (providerConfigs.has('bucketName')) {\n // simple/single config variant\n configs.push(readAwsS3Config(DEFAULT_PROVIDER_ID, providerConfigs));\n\n return configs;\n }\n\n for (const id of providerConfigs.keys()) {\n configs.push(readAwsS3Config(id, providerConfigs.getConfig(id)));\n }\n\n return configs;\n}\n\nfunction readAwsS3Config(id: string, config: Config): AwsS3Config {\n const bucketName = config.getString('bucketName');\n const region = config.getOptionalString('region');\n const prefix = config.getOptionalString('prefix');\n\n return {\n id,\n bucketName,\n region,\n prefix,\n };\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TaskRunner } from '@backstage/backend-tasks';\nimport { Config } from '@backstage/config';\nimport { AwsS3Integration, ScmIntegrations } from '@backstage/integration';\nimport {\n EntityProvider,\n EntityProviderConnection,\n LocationSpec,\n locationSpecToLocationEntity,\n} from '@backstage/plugin-catalog-backend';\nimport { AwsCredentials } from '../credentials/AwsCredentials';\nimport { readAwsS3Configs } from './config';\nimport { AwsS3Config } from './types';\nimport { S3 } from 'aws-sdk';\nimport { ListObjectsV2Output } from 'aws-sdk/clients/s3';\nimport * as uuid from 'uuid';\nimport { Logger } from 'winston';\n\n// TODO: event-based updates using S3 events (+ queue like SQS)?\n/**\n * Provider which discovers catalog files (any name) within an S3 bucket.\n *\n * Use `AwsS3EntityProvider.fromConfig(...)` to create instances.\n *\n * @public\n */\nexport class AwsS3EntityProvider implements EntityProvider {\n private readonly logger: Logger;\n private readonly s3: S3;\n private readonly scheduleFn: () => Promise<void>;\n private connection?: EntityProviderConnection;\n\n static fromConfig(\n configRoot: Config,\n options: {\n logger: Logger;\n schedule: TaskRunner;\n },\n ): AwsS3EntityProvider[] {\n const providerConfigs = readAwsS3Configs(configRoot);\n\n // Even though the awsS3 integration allows a config array\n // there is no *real* support for multiple configs.\n // Usually, there will be just the integration for the default host.\n // In case, a config custom endpoint is used, the host from this endpoint\n // will be extracted and used as host (e.g., localhost when used with LocalStack)\n // and the default integration will be added as second integration.\n // In this case, we still want the first one though, but have no means to select it\n // just from the bucket name (and region).\n const integration = ScmIntegrations.fromConfig(configRoot).awsS3.list()[0];\n if (!integration) {\n throw new Error('No integration found for awsS3');\n }\n\n return providerConfigs.map(\n providerConfig =>\n new AwsS3EntityProvider(\n providerConfig,\n integration,\n options.logger,\n options.schedule,\n ),\n );\n }\n\n private constructor(\n private readonly config: AwsS3Config,\n private readonly integration: AwsS3Integration,\n logger: Logger,\n schedule: TaskRunner,\n ) {\n this.logger = logger.child({\n target: this.getProviderName(),\n });\n\n this.s3 = new S3({\n apiVersion: '2006-03-01',\n credentials: AwsCredentials.create(\n integration.config,\n 'backstage-aws-s3-provider',\n ),\n endpoint: integration.config.endpoint,\n region: this.config.region,\n s3ForcePathStyle: integration.config.s3ForcePathStyle,\n });\n\n this.scheduleFn = this.createScheduleFn(schedule);\n }\n\n private createScheduleFn(schedule: TaskRunner): () => Promise<void> {\n return async () => {\n const taskId = `${this.getProviderName()}:refresh`;\n return schedule.run({\n id: taskId,\n fn: async () => {\n const logger = this.logger.child({\n class: AwsS3EntityProvider.prototype.constructor.name,\n taskId,\n taskInstanceId: uuid.v4(),\n });\n\n try {\n await this.refresh(logger);\n } catch (error) {\n logger.error(error);\n }\n },\n });\n };\n }\n\n /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */\n getProviderName(): string {\n return `awsS3-provider:${this.config.id}`;\n }\n\n /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.connect} */\n async connect(connection: EntityProviderConnection): Promise<void> {\n this.connection = connection;\n await this.scheduleFn();\n }\n\n async refresh(logger: Logger) {\n if (!this.connection) {\n throw new Error('Not initialized');\n }\n\n logger.info('Discovering AWS S3 objects');\n\n const keys = await this.listAllObjectKeys();\n logger.info(`Discovered ${keys.length} AWS S3 objects`);\n\n const locations = keys.map(key => this.createLocationSpec(key));\n\n await this.connection.applyMutation({\n type: 'full',\n entities: locations.map(location => {\n return {\n locationKey: this.getProviderName(),\n entity: locationSpecToLocationEntity({ location }),\n };\n }),\n });\n\n logger.info(`Committed ${locations.length} Locations for AWS S3 objects`);\n }\n\n private async listAllObjectKeys(): Promise<string[]> {\n const keys: string[] = [];\n\n let continuationToken: string | undefined = undefined;\n let output: ListObjectsV2Output;\n do {\n const request = this.s3.listObjectsV2({\n Bucket: this.config.bucketName,\n ContinuationToken: continuationToken,\n Prefix: this.config.prefix,\n });\n\n output = await request.promise();\n if (output.Contents) {\n output.Contents.forEach(item => {\n if (item.Key && !item.Key.endsWith('/')) {\n keys.push(item.Key);\n }\n });\n }\n continuationToken = output.NextContinuationToken;\n } while (continuationToken);\n\n return keys;\n }\n\n private createLocationSpec(key: string): LocationSpec {\n return {\n type: 'url',\n target: this.createObjectUrl(key),\n presence: 'required',\n };\n }\n\n private createObjectUrl(key: string): string {\n const bucketName = this.config.bucketName;\n const endpoint = this.integration.config.endpoint;\n\n if (endpoint) {\n if (endpoint.startsWith(`https://${bucketName}.`)) {\n return `${endpoint}/${key}`;\n }\n\n return `${endpoint}/${bucketName}/${key}`;\n }\n\n return `https://${bucketName}.s3.${this.config.region}.amazonaws.com/${key}`;\n }\n}\n"],"names":["AWS","processingResult","isError","limiterFactory","Credentials","aws","S3","integration","ScmIntegrations","uuid","locationSpecToLocationEntity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,yBAAyB,CAAC,MAAM,EAAE;AAClD,EAAE,MAAM,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC9D,EAAE,MAAM,OAAO,GAAG,cAAc,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,cAAc,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAChG,EAAE,OAAO;AACT,IAAI,OAAO;AACX,GAAG,CAAC;AACJ;;ACCA,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAC5C,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAC3C,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AACxD,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAC3C,MAAM,uBAAuB,GAAG,+BAA+B,CAAC;AACzD,MAAM,oCAAoC,CAAC;AAClD,EAAE,OAAO,UAAU,CAAC,MAAM,EAAE,OAAO,EAAE;AACrC,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,oCAAoC,CAAC,CAAC;AAC7E,IAAI,OAAO,IAAI,oCAAoC,CAAC;AACpD,MAAM,GAAG,OAAO;AAChB,MAAM,QAAQ,EAAE,CAAC,GAAG,yBAAyB,CAAC,CAAC,CAAC,GAAG,EAAE;AACrD,KAAK,CAAC,CAAC;AACP,GAAG;AACH,EAAE,OAAO,gBAAgB,CAAC,MAAM,EAAE;AAClC,IAAI,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAA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scoveryProcessor.ts","../src/credentials/AwsCredentials.ts","../src/providers/config.ts","../src/providers/AwsS3EntityProvider.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\n\n/**\n * The configuration parameters for a single AWS Organization Processor\n */\nexport type AwsOrganizationProviderConfig = {\n /**\n * The role to assume for the processor.\n */\n roleArn?: string;\n};\n\nexport function readAwsOrganizationConfig(\n config: Config,\n): AwsOrganizationProviderConfig {\n const providerConfig = config.getOptionalConfig('provider');\n\n const roleArn = providerConfig?.getOptionalString('roleArn');\n return {\n roleArn,\n };\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ResourceEntityV1alpha1 } from '@backstage/catalog-model';\nimport { Config } from '@backstage/config';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport AWS, { Credentials, Organizations } from 'aws-sdk';\nimport { Account, ListAccountsResponse } from 'aws-sdk/clients/organizations';\nimport { Logger } from 'winston';\nimport {\n AwsOrganizationProviderConfig,\n readAwsOrganizationConfig,\n} from '../awsOrganization/config';\n\nconst AWS_ORGANIZATION_REGION = 'us-east-1';\nconst LOCATION_TYPE = 'aws-cloud-accounts';\n\nconst ACCOUNTID_ANNOTATION = 'amazonaws.com/account-id';\nconst ARN_ANNOTATION = 'amazonaws.com/arn';\nconst ORGANIZATION_ANNOTATION = 'amazonaws.com/organization-id';\n\n/**\n * A processor for ingesting AWS Accounts from AWS Organizations.\n *\n * If custom authentication is needed, it can be achieved by configuring the\n * global AWS.credentials object.\n *\n * @public\n */\nexport class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {\n private readonly organizations: Organizations;\n private readonly provider: AwsOrganizationProviderConfig;\n\n static fromConfig(config: Config, options: { logger: Logger }) {\n const c = config.getOptionalConfig('catalog.processors.awsOrganization');\n return new AwsOrganizationCloudAccountProcessor({\n ...options,\n provider: c ? readAwsOrganizationConfig(c) : {},\n });\n }\n\n private static buildCredentials(\n config: AwsOrganizationProviderConfig,\n ): Credentials | undefined {\n const roleArn = config.roleArn;\n if (!roleArn) {\n return undefined;\n }\n\n return new AWS.ChainableTemporaryCredentials({\n params: {\n RoleSessionName: 'backstage-aws-organization-processor',\n RoleArn: roleArn,\n },\n });\n }\n\n private constructor(options: { provider: AwsOrganizationProviderConfig }) {\n this.provider = options.provider;\n const credentials = AwsOrganizationCloudAccountProcessor.buildCredentials(\n this.provider,\n );\n this.organizations = new AWS.Organizations({\n credentials,\n region: AWS_ORGANIZATION_REGION,\n }); // Only available in us-east-1\n }\n\n getProcessorName(): string {\n return 'AwsOrganizationCloudAccountProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== LOCATION_TYPE) {\n return false;\n }\n\n (await this.getAwsAccounts())\n .map(account => this.mapAccountToComponent(account))\n .filter(entity => {\n if (location.target !== '') {\n if (entity.metadata.annotations) {\n return (\n entity.metadata.annotations[ORGANIZATION_ANNOTATION] ===\n location.target\n );\n }\n return false;\n }\n return true;\n })\n .forEach(entity => {\n emit(processingResult.entity(location, entity));\n });\n\n return true;\n }\n\n private normalizeName(name: string): string {\n return name\n .trim()\n .toLocaleLowerCase('en-US')\n .replace(/[^a-zA-Z0-9\\-]/g, '-');\n }\n\n private extractInformationFromArn(arn: string): {\n accountId: string;\n organizationId: string;\n } {\n const parts = arn.split('/');\n\n return {\n accountId: parts[parts.length - 1],\n organizationId: parts[parts.length - 2],\n };\n }\n\n private async getAwsAccounts(): Promise<Account[]> {\n let awsAccounts: Account[] = [];\n let isInitialAttempt = true;\n let nextToken = undefined;\n while (isInitialAttempt || nextToken) {\n isInitialAttempt = false;\n const orgAccounts: ListAccountsResponse = await this.organizations\n .listAccounts({ NextToken: nextToken })\n .promise();\n if (orgAccounts.Accounts) {\n awsAccounts = awsAccounts.concat(orgAccounts.Accounts);\n }\n nextToken = orgAccounts.NextToken;\n }\n\n return awsAccounts;\n }\n\n private mapAccountToComponent(account: Account): ResourceEntityV1alpha1 {\n const { accountId, organizationId } = this.extractInformationFromArn(\n account.Arn as string,\n );\n return {\n apiVersion: 'backstage.io/v1alpha1',\n kind: 'Resource',\n metadata: {\n annotations: {\n [ACCOUNTID_ANNOTATION]: accountId,\n [ARN_ANNOTATION]: account.Arn || '',\n [ORGANIZATION_ANNOTATION]: organizationId,\n },\n name: this.normalizeName(account.Name || ''),\n namespace: 'default',\n },\n spec: {\n type: 'cloud-account',\n owner: 'unknown',\n },\n };\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UrlReader } from '@backstage/backend-common';\nimport { isError } from '@backstage/errors';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n CatalogProcessorParser,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-backend';\nimport limiterFactory from 'p-limit';\n\n/**\n * A processor for automatic discovery of entities from S3 buckets. Handles the\n * `s3-discovery` location type, and target bucket URLs e.g. on the form\n * `https://testbucket.s3.us-east-2.amazonaws.com`.\n *\n * @public\n */\nexport class AwsS3DiscoveryProcessor implements CatalogProcessor {\n constructor(private readonly reader: UrlReader) {}\n\n getProcessorName(): string {\n return 'AwsS3DiscoveryProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n optional: boolean,\n emit: CatalogProcessorEmit,\n parser: CatalogProcessorParser,\n ): Promise<boolean> {\n if (location.type !== 's3-discovery') {\n return false;\n }\n\n try {\n const output = await this.doRead(location.target);\n for (const item of output) {\n for await (const parseResult of parser({\n data: item.data,\n location: { type: location.type, target: item.url },\n })) {\n emit(parseResult);\n }\n }\n } catch (error) {\n const message = `Unable to read ${location.type}, ${error}`;\n\n if (isError(error) && error.name === 'NotFoundError') {\n if (!optional) {\n emit(processingResult.notFoundError(location, message));\n }\n } else {\n emit(processingResult.generalError(location, message));\n }\n }\n return true;\n }\n\n private async doRead(\n location: string,\n ): Promise<{ data: Buffer; url: string }[]> {\n const limiter = limiterFactory(5);\n const response = await this.reader.readTree(location);\n const responseFiles = await response.files();\n const output = responseFiles.map(async file => ({\n url: file.path,\n data: await limiter(file.content),\n }));\n return Promise.all(output);\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport aws, { Credentials } from 'aws-sdk';\nimport { CredentialsOptions } from 'aws-sdk/lib/credentials';\n\nexport class AwsCredentials {\n /**\n * If accessKeyId and secretAccessKey are missing, the DefaultAWSCredentialsProviderChain will be used:\n * https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html\n */\n static create(\n config: {\n accessKeyId?: string;\n secretAccessKey?: string;\n roleArn?: string;\n },\n roleSessionName: string,\n ): Credentials | CredentialsOptions | undefined {\n if (!config) {\n return undefined;\n }\n\n const accessKeyId = config.accessKeyId;\n const secretAccessKey = config.secretAccessKey;\n let explicitCredentials: Credentials | undefined;\n\n if (accessKeyId && secretAccessKey) {\n explicitCredentials = new Credentials({\n accessKeyId,\n secretAccessKey,\n });\n }\n\n const roleArn = config.roleArn;\n if (roleArn) {\n return new aws.ChainableTemporaryCredentials({\n masterCredentials: explicitCredentials,\n params: {\n RoleArn: roleArn,\n RoleSessionName: roleSessionName,\n },\n });\n }\n\n return explicitCredentials;\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Config } from '@backstage/config';\nimport { AwsS3Config } from './types';\n\nconst DEFAULT_PROVIDER_ID = 'default';\n\nexport function readAwsS3Configs(config: Config): AwsS3Config[] {\n const configs: AwsS3Config[] = [];\n\n const providerConfigs = config.getOptionalConfig('catalog.providers.awsS3');\n if (!providerConfigs) {\n return configs;\n }\n\n if (providerConfigs.has('bucketName')) {\n // simple/single config variant\n configs.push(readAwsS3Config(DEFAULT_PROVIDER_ID, providerConfigs));\n\n return configs;\n }\n\n for (const id of providerConfigs.keys()) {\n configs.push(readAwsS3Config(id, providerConfigs.getConfig(id)));\n }\n\n return configs;\n}\n\nfunction readAwsS3Config(id: string, config: Config): AwsS3Config {\n const bucketName = config.getString('bucketName');\n const region = config.getOptionalString('region');\n const prefix = config.getOptionalString('prefix');\n\n return {\n id,\n bucketName,\n region,\n prefix,\n };\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TaskRunner } from '@backstage/backend-tasks';\nimport { Config } from '@backstage/config';\nimport { AwsS3Integration, ScmIntegrations } from '@backstage/integration';\nimport {\n EntityProvider,\n EntityProviderConnection,\n LocationSpec,\n locationSpecToLocationEntity,\n} from '@backstage/plugin-catalog-backend';\nimport { AwsCredentials } from '../credentials/AwsCredentials';\nimport { readAwsS3Configs } from './config';\nimport { AwsS3Config } from './types';\nimport { S3 } from 'aws-sdk';\nimport { ListObjectsV2Output } from 'aws-sdk/clients/s3';\nimport * as uuid from 'uuid';\nimport { Logger } from 'winston';\n\n// TODO: event-based updates using S3 events (+ queue like SQS)?\n/**\n * Provider which discovers catalog files (any name) within an S3 bucket.\n *\n * Use `AwsS3EntityProvider.fromConfig(...)` to create instances.\n *\n * @public\n */\nexport class AwsS3EntityProvider implements EntityProvider {\n private readonly logger: Logger;\n private readonly s3: S3;\n private readonly scheduleFn: () => Promise<void>;\n private connection?: EntityProviderConnection;\n\n static fromConfig(\n configRoot: Config,\n options: {\n logger: Logger;\n schedule: TaskRunner;\n },\n ): AwsS3EntityProvider[] {\n const providerConfigs = readAwsS3Configs(configRoot);\n\n // Even though the awsS3 integration allows a config array\n // there is no *real* support for multiple configs.\n // Usually, there will be just the integration for the default host.\n // In case, a custom endpoint is used, the host from this endpoint\n // will be extracted and used as host (e.g., localhost when used with LocalStack)\n // and the default integration will be added as second integration.\n // In this case, we still want the first one though, but have no means to select it\n // just from the bucket name (and region).\n const integration = ScmIntegrations.fromConfig(configRoot).awsS3.list()[0];\n if (!integration) {\n throw new Error('No integration found for awsS3');\n }\n\n return providerConfigs.map(\n providerConfig =>\n new AwsS3EntityProvider(\n providerConfig,\n integration,\n options.logger,\n options.schedule,\n ),\n );\n }\n\n private constructor(\n private readonly config: AwsS3Config,\n integration: AwsS3Integration,\n logger: Logger,\n schedule: TaskRunner,\n ) {\n this.logger = logger.child({\n target: this.getProviderName(),\n });\n\n this.s3 = new S3({\n apiVersion: '2006-03-01',\n credentials: AwsCredentials.create(\n integration.config,\n 'backstage-aws-s3-provider',\n ),\n endpoint: integration.config.endpoint,\n region: this.config.region,\n s3ForcePathStyle: integration.config.s3ForcePathStyle,\n });\n\n this.scheduleFn = this.createScheduleFn(schedule);\n }\n\n private createScheduleFn(schedule: TaskRunner): () => Promise<void> {\n return async () => {\n const taskId = `${this.getProviderName()}:refresh`;\n return schedule.run({\n id: taskId,\n fn: async () => {\n const logger = this.logger.child({\n class: AwsS3EntityProvider.prototype.constructor.name,\n taskId,\n taskInstanceId: uuid.v4(),\n });\n\n try {\n await this.refresh(logger);\n } catch (error) {\n logger.error(error);\n }\n },\n });\n };\n }\n\n /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.getProviderName} */\n getProviderName(): string {\n return `awsS3-provider:${this.config.id}`;\n }\n\n /** {@inheritdoc @backstage/plugin-catalog-backend#EntityProvider.connect} */\n async connect(connection: EntityProviderConnection): Promise<void> {\n this.connection = connection;\n await this.scheduleFn();\n }\n\n async refresh(logger: Logger) {\n if (!this.connection) {\n throw new Error('Not initialized');\n }\n\n logger.info('Discovering AWS S3 objects');\n\n const keys = await this.listAllObjectKeys();\n logger.info(`Discovered ${keys.length} AWS S3 objects`);\n\n const locations = keys.map(key => this.createLocationSpec(key));\n\n await this.connection.applyMutation({\n type: 'full',\n entities: locations.map(location => {\n return {\n locationKey: this.getProviderName(),\n entity: locationSpecToLocationEntity({ location }),\n };\n }),\n });\n\n logger.info(`Committed ${locations.length} Locations for AWS S3 objects`);\n }\n\n private async listAllObjectKeys(): Promise<string[]> {\n const keys: string[] = [];\n\n let continuationToken: string | undefined = undefined;\n let output: ListObjectsV2Output;\n do {\n const request = this.s3.listObjectsV2({\n Bucket: this.config.bucketName,\n ContinuationToken: continuationToken,\n Prefix: this.config.prefix,\n });\n\n output = await request.promise();\n if (output.Contents) {\n output.Contents.forEach(item => {\n if (item.Key && !item.Key.endsWith('/')) {\n keys.push(item.Key);\n }\n });\n }\n continuationToken = output.NextContinuationToken;\n } while (continuationToken);\n\n return keys;\n }\n\n private createLocationSpec(key: string): LocationSpec {\n return {\n type: 'url',\n target: this.createObjectUrl(key),\n presence: 'required',\n };\n }\n\n private createObjectUrl(key: string): string {\n const bucketName = this.config.bucketName;\n const endpoint = this.s3.endpoint.href;\n\n return encodeURI(`${endpoint}${bucketName}/${key}`);\n }\n}\n"],"names":["AWS","processingResult","isError","limiterFactory","Credentials","aws","S3","integration","ScmIntegrations","uuid","locationSpecToLocationEntity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,yBAAyB,CAAC,MAAM,EAAE;AAClD,EAAE,MAAM,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC9D,EAAE,MAAM,OAAO,GAAG,cAAc,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,cAAc,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAChG,EAAE,OAAO;AACT,IAAI,OAAO;AACX,GAAG,CAAC;AACJ;;ACCA,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAC5C,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAC3C,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AACxD,MAAM,c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/index.d.ts CHANGED
@@ -52,7 +52,6 @@ declare class AwsS3DiscoveryProcessor implements CatalogProcessor {
52
52
  */
53
53
  declare class AwsS3EntityProvider implements EntityProvider {
54
54
  private readonly config;
55
- private readonly integration;
56
55
  private readonly logger;
57
56
  private readonly s3;
58
57
  private readonly scheduleFn;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend-module-aws",
3
3
  "description": "A Backstage catalog backend module that helps integrate towards AWS",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -33,13 +33,13 @@
33
33
  "start": "backstage-cli package start"
34
34
  },
35
35
  "dependencies": {
36
- "@backstage/backend-common": "^0.13.2",
37
- "@backstage/backend-tasks": "^0.3.0",
38
- "@backstage/catalog-model": "^1.0.1",
39
- "@backstage/config": "^1.0.0",
36
+ "@backstage/backend-common": "^0.13.3",
37
+ "@backstage/backend-tasks": "^0.3.1",
38
+ "@backstage/catalog-model": "^1.0.2",
39
+ "@backstage/config": "^1.0.1",
40
40
  "@backstage/errors": "^1.0.0",
41
- "@backstage/integration": "^1.1.0",
42
- "@backstage/plugin-catalog-backend": "^1.1.0",
41
+ "@backstage/integration": "^1.2.0",
42
+ "@backstage/plugin-catalog-backend": "^1.1.2",
43
43
  "@backstage/types": "^1.0.0",
44
44
  "aws-sdk": "^2.840.0",
45
45
  "lodash": "^4.17.21",
@@ -48,7 +48,7 @@
48
48
  "winston": "^3.2.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@backstage/cli": "^0.17.0",
51
+ "@backstage/cli": "^0.17.1",
52
52
  "@types/lodash": "^4.14.151",
53
53
  "aws-sdk-mock": "^5.2.1",
54
54
  "yaml": "^1.9.2"
@@ -58,5 +58,5 @@
58
58
  "config.d.ts"
59
59
  ],
60
60
  "configSchema": "config.d.ts",
61
- "gitHead": "e0e44c433319711c2fb8b175db411a621f7aaec2"
61
+ "gitHead": "96323f280ba32ee526c5b151cda42260aee927c9"
62
62
  }