معرفی شرکت ها


b-cfn-api-v2-4.0.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Convenient wrapper around CfnApi.
ویژگی مقدار
سیستم عامل -
نام فایل b-cfn-api-v2-4.0.0
نام b-cfn-api-v2
نسخه کتابخانه 4.0.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده -
ایمیل نویسنده -
آدرس صفحه اصلی https://github.com/biomapas/B.CfnApiV2.git
آدرس اینترنتی https://pypi.org/project/b-cfn-api-v2/
مجوز Apache License 2.0
# B.CfnApiV2 ![Pipeline](https://github.com/Biomapas/B.CfnApiV2/workflows/Pipeline/badge.svg?branch=master) An API Gateway resource that adds convenient functionality over traditional `CfnApi` resource. It lets you easily enable authorization, stages, and CDNs. ### Description Essentially this resource is a wrapper resource for `aws_apigatewayv2` module's `CfnApi`. Meaning, that you can easily swap `CfnApi` and this `Api` resource with no major impact. But why would you want to switch a traditional `CfnApi` to this one. Mainly these convenient features: - Easy to add `CloudFront` distribution on top of the API (enabling CDN). - Easy to enable `Stage` and attached to the api. - Easy to add authorization with `UserPoolAuthorizer` & `ApiKeyAuthorizer`. ### Remarks [Biomapas](https://www.biomapas.com/) aims to modernise life-science industry by sharing its IT knowledge with other companies and the community. This is an open source library intended to be used by anyone. Improvements and pull requests are welcome. ### Related technology - Python3 - AWS CDK - AWS Lambda - AWS API Gateway - AWS CloudFront - AWS User Pool authorization ### Assumptions This project assumes you know what Lambda functions are and how code is being shared between them (Lambda layers). - Excellent knowledge in IaaC (Infrastructure as a Code) principles. - Excellent knowledge in Lambda functions and API Gateway service. - Good experience in AWS CDK and AWS CloudFormation. ### Useful sources - AWS CDK:<br>https://docs.aws.amazon.com/cdk/api/latest/docs/aws-construct-library.html - AWS CloudFormation:<br>https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html - AWS API Gateway:<br>https://docs.aws.amazon.com/apigateway/latest/developerguide/welcome.html - AWS API Gateway V2:<br>https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html - Custom User Pool Authorizer:<br>https://github.com/Biomapas/B.CfnCustomUserPoolAuthorizer - Custom api key authorizer:<br>https://github.com/Biomapas/B.CfnCustomApiKeyAuthorizer - Custom user pool authorizer:<br>https://github.com/Biomapas/B.CfnCustomUserPoolAuthorizer ### Install Before installing this library, ensure you have these tools setup: - Python / Pip - AWS CDK To install this project from source run: ``` pip install . ``` Or you can install it from a PyPi repository: ``` pip install b-cfn-api-v2 ``` ### Usage & Examples The traditional way of creating an API looks something like this: ```python from aws_cdk.aws_apigatewayv2 import CfnApi CfnApi( scope=Stack(), id='Api', name='Api', description='Sample description.', protocol_type='HTTP', cors_configuration=CfnApi.CorsProperty( allow_methods=['GET', 'PUT', 'POST', 'OPTIONS', 'DELETE'], allow_origins=['*'], allow_headers=[ 'Content-Type', 'Authorization' ], max_age=300 ) ) ``` To create our resource `Api` is exactly the same:<br> (It works since `Api` is a pure wrapper of `CfnApi` resource.) ```python from b_cfn_api_v2.api import Api Api( scope=Stack(), id='Api', name='Api', description='Sample description.', protocol_type='HTTP', cors_configuration=Api.CorsProperty( allow_methods=['GET', 'PUT', 'POST', 'OPTIONS', 'DELETE'], allow_origins=['*'], allow_headers=[ 'Content-Type', 'Authorization' ], max_age=300 ) ) ``` Three main advantages of this `Api` resource: - **Easy to enable default stage.** ```python from b_cfn_api_v2.api import Api api = Api(...) api.enable_default_stage('dev') ``` - **Easy to enable authorization.** ```python from b_cfn_api_v2.api import Api from b_cfn_custom_userpool_authorizer.config.user_pool_config import UserPoolConfig api = Api(...) # Your authorized endpoint will require `Authorization` # supplied in headers. # Read more: # https://github.com/Biomapas/B.CfnCustomUserPoolAuthorizer api.enable_user_pool_authorizer(UserPoolConfig( user_pool_id='id', user_pool_region='region', user_pool_client_id='client' )) # Your authorized endpoint will require `ApiKey` and `ApiSecret` # supplied in headers. # Read more: # https://github.com/Biomapas/B.CfnCustomApiKeyAuthorizer api.enable_api_key_authorizer() ``` - **Easy to enable CDN.** ```python from b_cfn_api_v2.api import Api from aws_cdk.aws_cloudfront import CachePolicy api = Api(...) api.enable_cdn(default_behavior_cache_policy=CachePolicy.CACHING_OPTIMIZED) ``` ### Testing This package has integration tests based on **pytest**. To run tests simply run: ``` pytest b_cfn_api_v2_test/integration/tests ``` ### Contribution Found a bug? Want to add or suggest a new feature? Contributions of any kind are gladly welcome. You may contact us directly, create a pull-request or an issue in github platform. Lets modernize the world together. # Release history ### 4.0.0 * Fix origin paths between pure api or its cloudfront distribution. Both should require stage name to be entered as a part of a URL. This is a breaking change. ### 3.1.0 * Enable easy stage logging. ### 3.0.0 * Upgrade breaking dependencies. ### 2.0.1 * Make dependencies range more loose with maximum version not reaching `2.0.0`. ### 2.0.0 * Use the newest `2.0.0` custom api keys authorizer which now hashes api secrets and is no longer compatible with previous versions. ### 1.1.1 * Update readme. ### 1.1.0 * Implement api keys custom authorizer (https://github.com/Biomapas/B.CfnCustomApiKeyAuthorizer). ### 1.0.0 * Fully documented, tested, and working version release. ### 0.0.1 * Initial build.


نیازمندی

مقدار نام
<2.0.0,>=1.0.0 b-cfn-custom-userpool-authorizer
<3.0.0,>=2.2.0 b-cfn-custom-api-key-authorizer
<2.0.0,>=1.90.0 aws-cdk.assets
<2.0.0,>=1.90.0 aws-cdk.aws-acmpca
<2.0.0,>=1.90.0 aws-cdk.aws-apigatewayv2
<2.0.0,>=1.90.0 aws-cdk.aws-applicationautoscaling
<2.0.0,>=1.90.0 aws-cdk.aws-autoscaling-common
<2.0.0,>=1.90.0 aws-cdk.aws-certificatemanager
<2.0.0,>=1.90.0 aws-cdk.aws-cloudformation
<2.0.0,>=1.90.0 aws-cdk.aws-cloudfront
<2.0.0,>=1.90.0 aws-cdk.aws-cloudfront-origins
<2.0.0,>=1.90.0 aws-cdk.aws-cloudwatch
<2.0.0,>=1.90.0 aws-cdk.aws-codeguruprofiler
<2.0.0,>=1.90.0 aws-cdk.aws-codestarnotifications
<2.0.0,>=1.90.0 aws-cdk.aws-cognito
<2.0.0,>=1.90.0 aws-cdk.aws-dynamodb
<2.0.0,>=1.90.0 aws-cdk.aws-ec2
<2.0.0,>=1.90.0 aws-cdk.aws-ecr
<2.0.0,>=1.90.0 aws-cdk.aws-ecr-assets
<2.0.0,>=1.90.0 aws-cdk.aws-efs
<2.0.0,>=1.90.0 aws-cdk.aws-elasticloadbalancingv2
<2.0.0,>=1.90.0 aws-cdk.aws-events
<2.0.0,>=1.90.0 aws-cdk.aws-iam
<2.0.0,>=1.90.0 aws-cdk.aws-kinesis
<2.0.0,>=1.90.0 aws-cdk.aws-kms
<2.0.0,>=1.90.0 aws-cdk.aws-lambda
<2.0.0,>=1.90.0 aws-cdk.aws-logs
<2.0.0,>=1.90.0 aws-cdk.aws-route53
<2.0.0,>=1.90.0 aws-cdk.aws-s3
<2.0.0,>=1.90.0 aws-cdk.aws-s3-assets
<2.0.0,>=1.90.0 aws-cdk.aws-signer
<2.0.0,>=1.90.0 aws-cdk.aws-sns
<2.0.0,>=1.90.0 aws-cdk.aws-sqs
<2.0.0,>=1.90.0 aws-cdk.aws-ssm
<2.0.0,>=1.90.0 aws-cdk.cloud-assembly-schema
<2.0.0,>=1.90.0 aws-cdk.core
<2.0.0,>=1.90.0 aws-cdk.custom-resources
<2.0.0,>=1.90.0 aws-cdk.cx-api
<2.0.0,>=1.90.0 aws-cdk.region-info


نحوه نصب


نصب پکیج whl b-cfn-api-v2-4.0.0:

    pip install b-cfn-api-v2-4.0.0.whl


نصب پکیج tar.gz b-cfn-api-v2-4.0.0:

    pip install b-cfn-api-v2-4.0.0.tar.gz