Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

feat: add custom awsCredentialManager option #324

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions plugins/aws-proton-backend/src/actions/create/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import { Config } from '@backstage/config';
import { createTemplateAction } from '@backstage/plugin-scaffolder-backend';
import { CreateServiceCommand, ProtonClient } from '@aws-sdk/client-proton';
import { DefaultAwsCredentialsManager } from '@backstage/integration-aws-node';
import { AwsCredentialsManager, DefaultAwsCredentialsManager } from '@backstage/integration-aws-node';
import fs from 'fs-extra';

export function createAwsProtonServiceAction(options: { config: Config }) {
export function createAwsProtonServiceAction(options: { config: Config, awsCredentialsManager?: AwsCredentialsManager }) {
const { config } = options;
const awsCredentialsManager = DefaultAwsCredentialsManager.fromConfig(config);
const awsCredentialsManager = options.awsCredentialsManager || DefaultAwsCredentialsManager.fromConfig(config);
return createTemplateAction<{
serviceName: string;
templateName: string;
Expand Down
5 changes: 3 additions & 2 deletions plugins/aws-proton-backend/src/service/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import { errorHandler } from '@backstage/backend-common';
import { Config } from '@backstage/config';
import { DefaultAwsCredentialsManager } from '@backstage/integration-aws-node';
import { DefaultAwsCredentialsManager, AwsCredentialsManager } from '@backstage/integration-aws-node';
import express from 'express';
import Router from 'express-promise-router';
import { Logger } from 'winston';
Expand All @@ -22,13 +22,14 @@ import { AwsProtonApi } from '../api';
export interface RouterOptions {
logger: Logger;
config: Config;
awsCredentialsManager?: AwsCredentialsManager
}

export async function createRouter(
options: RouterOptions,
): Promise<express.Router> {
const { logger, config } = options;
const awsCredentialsManager = DefaultAwsCredentialsManager.fromConfig(config);
const awsCredentialsManager = options.awsCredentialsManager || DefaultAwsCredentialsManager.fromConfig(config);
const awsProtonApi = new AwsProtonApi(logger, awsCredentialsManager);

const router = Router();
Expand Down
Loading