Merge pull request #4159 from backjo/feature/AwsCloudAccountResources

Change AWS Cloud Accounts from Component to Resource
This commit is contained in:
Patrik Oldsberg
2021-01-20 19:33:50 +01:00
committed by GitHub
3 changed files with 11 additions and 12 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Change AWS Account type from Component to Resource
@@ -45,7 +45,7 @@ describe('AwsOrganizationCloudAccountProcessor', () => {
location,
entity: {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
kind: 'Resource',
metadata: {
annotations: {
'amazonaws.com/arn':
@@ -58,7 +58,6 @@ describe('AwsOrganizationCloudAccountProcessor', () => {
},
spec: {
type: 'cloud-account',
lifecycle: 'unknown',
owner: 'unknown',
},
},
@@ -91,7 +90,7 @@ describe('AwsOrganizationCloudAccountProcessor', () => {
location,
entity: {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
kind: 'Resource',
metadata: {
annotations: {
'amazonaws.com/arn':
@@ -104,7 +103,6 @@ describe('AwsOrganizationCloudAccountProcessor', () => {
},
spec: {
type: 'cloud-account',
lifecycle: 'unknown',
owner: 'unknown',
},
},
@@ -13,10 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
ComponentEntityV1alpha1,
LocationSpec,
} from '@backstage/catalog-model';
import { LocationSpec, ResourceEntityV1alpha1 } from '@backstage/catalog-model';
import {
Account,
Organizations,
@@ -82,13 +79,13 @@ export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
return awsAccounts;
}
mapAccountToComponent(account: Account): ComponentEntityV1alpha1 {
mapAccountToComponent(account: Account): ResourceEntityV1alpha1 {
const { accountId, organizationId } = this.extractInformationFromArn(
account.Arn as string,
);
return {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
kind: 'Resource',
metadata: {
annotations: {
[ACCOUNTID_ANNOTATION]: accountId,
@@ -100,7 +97,6 @@ export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
},
spec: {
type: 'cloud-account',
lifecycle: 'unknown',
owner: 'unknown',
},
};
@@ -129,7 +125,7 @@ export class AwsOrganizationCloudAccountProcessor implements CatalogProcessor {
}
return true;
})
.forEach((entity: ComponentEntityV1alpha1) => {
.forEach((entity: ResourceEntityV1alpha1) => {
emit(results.entity(location, entity));
});