From 9d5738b3f5f8a96373ade501558fed7d793fd4fc Mon Sep 17 00:00:00 2001 From: Sean Tan Date: Tue, 10 Aug 2021 14:53:44 -0700 Subject: [PATCH] Fix format errors and other small changes per suggestion Signed-off-by: Sean Tan --- docs/integrations/aws-s3/locations.md | 24 ++++++++++--------- microsite/sidebars.json | 5 ++++ mkdocs.yml | 2 ++ packages/backend-common/package.json | 2 +- .../src/reading/AwsS3UrlReader.test.ts | 4 ++-- .../src/reading/AwsS3UrlReader.ts | 2 +- packages/integration/config.d.ts | 1 - packages/integration/src/awsS3/config.ts | 2 +- 8 files changed, 25 insertions(+), 17 deletions(-) diff --git a/docs/integrations/aws-s3/locations.md b/docs/integrations/aws-s3/locations.md index 3fa7a5f472..fe1c6050c2 100644 --- a/docs/integrations/aws-s3/locations.md +++ b/docs/integrations/aws-s3/locations.md @@ -15,26 +15,28 @@ plugin. ## Configuration -To use this integration, add configuration to your root `app-config.yaml`: +To use this integration, add configuration to your `app-config.yaml`: ```yaml -awsS3: - - host: amazonaws.com - accessKeyId: ${AWS_ACCESS_KEY_ID} - secretAccessKey: ${AWS_SECRET_ACCESS_KEY} +integrations: + awsS3: + - host: amazonaws.com + accessKeyId: ${AWS_ACCESS_KEY_ID} + secretAccessKey: ${AWS_SECRET_ACCESS_KEY} ``` Then make sure the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` are set when you run Backstage. Users with multiple AWS accounts may want to use a role for S3 storage that is -in a different AWS account. Using the roleArn parameter as seen below, you can +in a different AWS account. Using the `roleArn` parameter as seen below, you can instruct the AWS S3 reader to assume a role before accessing S3: ```yaml -awsS3: - - host: amazonaws.com - accessKeyId: ${AWS_ACCESS_KEY_ID} - secretAccessKey: ${AWS_SECRET_ACCESS_KEY} - roleArn: 'arn:aws:iam::xxxxxxxxxxxx:role/example-role' +integrations: + awsS3: + - host: amazonaws.com + accessKeyId: ${AWS_ACCESS_KEY_ID} + secretAccessKey: ${AWS_SECRET_ACCESS_KEY} + roleArn: 'arn:aws:iam::xxxxxxxxxxxx:role/example-role' ``` diff --git a/microsite/sidebars.json b/microsite/sidebars.json index c22a7e961d..d787fb28aa 100644 --- a/microsite/sidebars.json +++ b/microsite/sidebars.json @@ -104,6 +104,11 @@ ], "Integrations": [ "integrations/index", + { + "type": "subcategory", + "label": "AWS S3", + "ids": ["integrations/aws-s3/locations"] + }, { "type": "subcategory", "label": "Azure", diff --git a/mkdocs.yml b/mkdocs.yml index bd70104abc..a6e92b5bd1 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -79,6 +79,8 @@ nav: - FAQ: 'features/techdocs/FAQ.md' - Integrations: - Overview: 'integrations/index.md' + - AWS S3: + - Locations: 'integrations/aws-s3/locations.md' - Azure: - Locations: 'integrations/azure/locations.md' - Org Data: 'integrations/azure/org.md' diff --git a/packages/backend-common/package.json b/packages/backend-common/package.json index b091fac935..6d25ece793 100644 --- a/packages/backend-common/package.json +++ b/packages/backend-common/package.json @@ -40,7 +40,7 @@ "@types/dockerode": "^3.2.1", "@types/express": "^4.17.6", "archiver": "^5.0.2", - "aws-sdk": "^2.952.0", + "aws-sdk": "^2.840.0", "compression": "^1.7.4", "concat-stream": "^2.0.0", "cors": "^2.8.5", diff --git a/packages/backend-common/src/reading/AwsS3UrlReader.test.ts b/packages/backend-common/src/reading/AwsS3UrlReader.test.ts index 507ca165af..ddd9a012bc 100644 --- a/packages/backend-common/src/reading/AwsS3UrlReader.test.ts +++ b/packages/backend-common/src/reading/AwsS3UrlReader.test.ts @@ -147,7 +147,7 @@ describe('AwsS3UrlReader', () => { new AwsS3Integration( readAwsS3IntegrationConfig( new ConfigReader({ - host: '.amazonaws.com', + host: 'amazonaws.com', accessKeyId: 'fake-access-key', secretAccessKey: 'fake-secret-key', }), @@ -200,7 +200,7 @@ describe('AwsS3UrlReader', () => { new AwsS3Integration( readAwsS3IntegrationConfig( new ConfigReader({ - host: '.amazonaws.com', + host: 'amazonaws.com', accessKeyId: 'fake-access-key', secretAccessKey: 'fake-secret-key', }), diff --git a/packages/backend-common/src/reading/AwsS3UrlReader.ts b/packages/backend-common/src/reading/AwsS3UrlReader.ts index daadaba52d..d119115930 100644 --- a/packages/backend-common/src/reading/AwsS3UrlReader.ts +++ b/packages/backend-common/src/reading/AwsS3UrlReader.ts @@ -33,7 +33,7 @@ const parseURL = ( let { host, pathname } = new URL(url); /** - * Removes the trailing '/' from the pathname to be processed + * Removes the leading '/' from the pathname to be processed * as a parameter by AWS S3 SDK getObject method. */ pathname = pathname.substr(1); diff --git a/packages/integration/config.d.ts b/packages/integration/config.d.ts index fc6a094aa4..1defd9117c 100644 --- a/packages/integration/config.d.ts +++ b/packages/integration/config.d.ts @@ -168,7 +168,6 @@ export interface Config { awsS3?: Array<{ /** * The host of the target that this matches on, e.g. "amazonaws.com". - * * @visibility frontend */ host: string; diff --git a/packages/integration/src/awsS3/config.ts b/packages/integration/src/awsS3/config.ts index 8900425e57..5f9cd46a22 100644 --- a/packages/integration/src/awsS3/config.ts +++ b/packages/integration/src/awsS3/config.ts @@ -17,7 +17,7 @@ import { Config } from '@backstage/config'; import { isValidHost } from '../helpers'; -const AMAZON_AWS_HOST = '.amazonaws.com'; +const AMAZON_AWS_HOST = 'amazonaws.com'; /** * The configuration parameters for a single AWS S3 provider.