Merge pull request #25013 from yayfeng/setup_user_agent_aws_sdk

Setup user agent header for AWS sdk client
This commit is contained in:
Ben Lambert
2024-07-19 14:16:08 +02:00
committed by GitHub
6 changed files with 12 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/plugin-events-backend-module-aws-sqs': patch
'@backstage/plugin-catalog-backend-module-aws': patch
'@backstage/backend-common': patch
---
Setup user agent header for AWS sdk clients, this enables users to better track API calls made from Backstage to AWS APIs through things like CloudTrail.
@@ -213,6 +213,7 @@ export class AwsCodeCommitUrlReader implements UrlReaderService {
);
const codeCommit = new CodeCommitClient({
customUserAgent: 'backstage-aws-codecommit-url-reader',
region: region,
credentials: credentials,
});
@@ -222,6 +222,7 @@ export class AwsS3UrlReader implements UrlReaderService {
);
const s3 = new S3Client({
customUserAgent: 'backstage-aws-s3-url-reader',
region: region,
credentials: credentials,
endpoint: integration.config.endpoint,
@@ -106,6 +106,7 @@ export class AwsEKSClusterProcessor implements CatalogProcessor {
}
const eksClient = new EKS({
customUserAgent: 'backstage-aws-catalog-eks-cluster-processor',
credentials,
credentialDefaultProvider: providerFunction,
region,
@@ -154,6 +154,7 @@ export class AwsS3EntityProvider implements EntityProvider {
accountId ? { accountId } : undefined,
);
this.s3 = new S3({
customUserAgent: 'backstage-aws-catalog-s3-entity-provider',
apiVersion: '2006-03-01',
credentialDefaultProvider: () => credProvider.sdkCredentialProvider,
endpoint: this.integration.config.endpoint,
@@ -76,6 +76,7 @@ export class AwsSqsConsumingEventPublisher {
};
this.sqs = new SQSClient({
customUserAgent: 'backstage-aws-events-sqs-publisher',
region: config.region,
endpoint: config.endpoint,
});