Package: aws-prototyping-sdk.aws-arch
aws-arch (AWS Architecture)Library to provide metadata for AWS Services and AWS Resources.This package generates mappings between@aws-cdk/cfnspecandAWS Architecture Icons, and resolves resource metadata between these systems to infer a normalized definition of anAwsServiceandAwsResource.The primary aim of this package is to provide a consistent mechanism for other libraries to retrieve naming and assets associated with CloudFormation resources, and by extension CDK resources.Get Startedyarnadd'@aws-prototyping-sdk/aws-arch'import{AwsArchitecture}from"@aws-prototyping-sdk/aws-arch";consts3Bucket=AwsArchitecture.getResource("AWS::S3::Bucket");consts3Service=AwsArchitecture.getService(s3Bucket.service);console.log(s3Bucket);console.log(s3Service);// => console.log(s3Bucket);{"name":"Amazon Simple Storage Service Bucket","cfnType":"AWS::S3::Bucket","awsAssetName":"Amazon-Simple-Storage-Service_Bucket","awsAssetIcon":"resources/Amazon-Simple-Storage-Service_Bucket.png","service":"S3"}// => console.log(s3Service);{"provider":"AWS","name":"Amazon Simple Storage Service","cfnName":"S3","awsAssetIcon":"services/Amazon-Simple-Storage-Service.png","awsAssetName":"Amazon-Simple-Storage-Service"}Aws Achritecture IconsRetrievecategory,service, andresourceAWS Architecture Icons.Icon methods return relative asset key paths, as most frameworks have the concept of a base path (imagepaths). UseAwsArchitecture.resolveAssetPath(...)to get absolute path.Retrieve icon based on CloudFormation Resource TypeResource Iconconsts3Bucket=AwsArchitecture.getResource("AWS::S3::Bucket");consts3BucketPng=s3Bucket.icon("png");//=>"storage/s3/bucket.png"consts3BucketSvg=s3Bucket.icon("svg");//=>"storage/s3/bucket.svg"//ResolveabsolutepathforiconsAwsArchitecture.resolveAssetPath(s3BucketPng);//=>/User/example/.../node_modules/@aws-prototyping-sdk/aws-arc/assets/storage/s3/bucket.pngService Iconconsts3Service=AwsArchitecture.getResource("AWS::S3::Bucket").service;//equivalentto:`AwsArchitecture.getService("S3")`consts3ServicePng=s3Service.icon("png");//=>"storage/s3/service_icon.png"consts3ServiceSvg=s3Service.icon("svg");//=>"storage/s3/service_icon.svg"//ResolveabsolutepathforiconsAwsArchitecture.resolveAssetPath(s3ServicePng);//=>/User/example/.../node_modules/@aws-prototyping-sdk/aws-arc/assets/storage/s3/service_icon.pngCategory IconconststorageCategory=AwsArchitecture.getResource("AWS::S3::Bucket").service.category;//equivalentto:`AwsArchitecture.getCategory("storage")`conststorageCategoryPng=storageCategory.icon("png");//=>"storage/category_icon.png"conststorageCategorySvg=storageCategory.icon("svg");//=>"storage/category_icon.svg"//ResolveabsolutepathforiconsAwsArchitecture.resolveAssetPath(storageCategoryPng);//=>/User/example/.../node_modules/@aws-prototyping-sdk/aws-arc/assets/storage/category_icon.pngDevelopmentThis package auto-generates many types and asset files from external sources,
which are then auto mapped based on common patterns and explict mappings for edge-cases.The auto-generation is handled by/scriptsfiles which can be run via corresponding
package scripts (eg:npx projen generate:assets=>/scripts/generate-assets.ts).There is an implicit sequential order the scripts must be called in due to dependencies,
which is handled bynpx projen generatescript. Thegeneratescript is also invoked
prior tonpx projen buildif generated asset directory does not exist.For local development of packages that depend onaws-archpackage, you will need to
callnpx projen generate && npx projen compile(ornpx projen build) prior to locally
importing this package.To updateAWS Architecture Icons, change the url inASSET_PACKAGE_ZIP_URL.