Skip to main content

@aws-prototyping-sdk/aws-arch

Project description

aws-arch (AWS Architecture)

Library to provide metadata for AWS Services and AWS Resources.

This package generates mappings between @aws-cdk/cfnspec and AWS Architecture Icons, and resolves resource metadata between these systems to infer a normalized definition of an AwsService and AwsResource.

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 Started

yarn add '@aws-prototyping-sdk/aws-arch'
import { AwsArchitecture } from "@aws-prototyping-sdk/aws-arch";

const s3Bucket = AwsArchitecture.getResource("AWS::S3::Bucket");
const s3Service = 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 Icons

Retrieve category, service, and resource AWS Architecture Icons.

Icon methods return relative asset key paths, as most frameworks have the concept of a base path (imagepaths). Use AwsArchitecture.resolveAssetPath(...) to get absolute path.

Retrieve icon based on CloudFormation Resource Type

Resource Icon

const s3Bucket = AwsArchitecture.getResource("AWS::S3::Bucket");

const s3BucketPng = s3Bucket.icon("png"); // => "storage/s3/bucket.png"
const s3BucketSvg = s3Bucket.icon("svg"); // => "storage/s3/bucket.svg"

// Resolve absolute path for icons
AwsArchitecture.resolveAssetPath(s3BucketPng); // => /User/example/.../node_modules/@aws-prototyping-sdk/aws-arc/assets/storage/s3/bucket.png

Service Icon

const s3Service = AwsArchitecture.getResource("AWS::S3::Bucket").service;
// equivalent to: `AwsArchitecture.getService("S3")`

const s3ServicePng = s3Service.icon("png"); // => "storage/s3/service_icon.png"
const s3ServiceSvg = s3Service.icon("svg"); // => "storage/s3/service_icon.svg"

// Resolve absolute path for icons
AwsArchitecture.resolveAssetPath(s3ServicePng); // => /User/example/.../node_modules/@aws-prototyping-sdk/aws-arc/assets/storage/s3/service_icon.png

Category Icon

const storageCategory =
  AwsArchitecture.getResource("AWS::S3::Bucket").service.category;
// equivalent to: `AwsArchitecture.getCategory("storage")`

const storageCategoryPng = storageCategory.icon("png"); // => "storage/category_icon.png"
const storageCategorySvg = storageCategory.icon("svg"); // => "storage/category_icon.svg"

// Resolve absolute path for icons
AwsArchitecture.resolveAssetPath(storageCategoryPng); // => /User/example/.../node_modules/@aws-prototyping-sdk/aws-arc/assets/storage/category_icon.png

Development

This 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 /scripts files 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 by npx projen generate script. The generate script is also invoked prior to npx projen build if generated asset directory does not exist.

For local development of packages that depend on aws-arch package, you will need to call npx projen generate && npx projen compile (or npx projen build) prior to locally importing this package.

To update AWS Architecture Icons, change the url in ASSET_PACKAGE_ZIP_URL.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws_prototyping_sdk.aws_arch-0.14.21.tar.gz (19.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aws_prototyping_sdk.aws_arch-0.14.21-py3-none-any.whl (19.3 MB view details)

Uploaded Python 3

File details

Details for the file aws_prototyping_sdk.aws_arch-0.14.21.tar.gz.

File metadata

File hashes

Hashes for aws_prototyping_sdk.aws_arch-0.14.21.tar.gz
Algorithm Hash digest
SHA256 ab6e2e58ae583d72c10b316bbe364d6a9122ada87ef32d7a75f6c4e4e64a095f
MD5 796ff59bcb5b098cc92c1a450f0014e9
BLAKE2b-256 f1ddf3df5f1a3f938c5c32dd533694ce6becacea3950d83e2fe0f8e31f9e6c6f

See more details on using hashes here.

File details

Details for the file aws_prototyping_sdk.aws_arch-0.14.21-py3-none-any.whl.

File metadata

File hashes

Hashes for aws_prototyping_sdk.aws_arch-0.14.21-py3-none-any.whl
Algorithm Hash digest
SHA256 0d5417de0e63c710d03c634739a1a909a96e23e9d78e98027d9f4f2c803b459c
MD5 a65916ba907aa8784b39418ecb2d9968
BLAKE2b-256 dd30b4cb58a053d5b6dd19e4078f46d79f6307b1b8c392d2ff339343eb3e8481

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page