Giter Site home page Giter Site logo

gomathiselvis / amazon_cloud_code_generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ansible-collections/amazon_cloud_code_generator

0.0 1.0 0.0 1.06 MB

Tooling ued to generate the amazon.cloud collection

License: GNU General Public License v3.0

Shell 2.24% Python 95.36% Jinja 2.39%

amazon_cloud_code_generator's Introduction

amazon_cloud_code_generator

amazon_cloud_code_generator generates the amazon.cloud collection from the CloudFormation Resource Type Definition Schema or meta-schema.

Requirements

The amazon_cloud_code_generator relies on the CloudFormation client. Hence, the following requirements must be met:

  • boto3 >= 1.20.0
  • botocore >= 1.23.0
  • Python 3.9
  • tox

Usage

The amazon_cloud_code_generator core content is hosted in the amazon_cloud_code_generator/ directory, which contains the following subdirectories:

  • cmd/ - hosts the main logic of the amazon_cloud_code_generator.

    │   ├── generator.py  # Implements the logic to scrape the CloudFormation resource schema and performs all the pre-processing to produce the DOCUMENTATION block for each module
    │   ├── refresh_examples.py  # Implements the logic to update EXAMPLES block scraping all the tasks tagged with `tags: [docs]` from `amazon_cloud_code_generator/data/tests/integration/targets/`
    │   ├── refresh_modules.py  # Implements the logic to generate all the modules specified inside `resources.py` including all the utilities
    │   ├── resources.py  # Sets the AWS resource names we are going to generate  
    │   ├── utils.py  # Implements utility functions for the generator
    
  • config/ - Contains the modules.yaml file where, for each of the AWS resources we generate, an entry representing the module's name must be added. Additionally, you can also set other information that will be used in module's DOCUMENTATION like short_description, description, and so forth.

  • data/ - Contains the content that is copied to the generated collection. A high level overview of the subdirectory content is shown below:

    ├── plugins
    │   └── module_utils # Modules utils that are used by the collection plugins
    │           ├── core.py
    │           ├── utils.py
    │           └── waiters.py
    └── tests  # Contains the units and integrations tests
    │   ├── config.yml
    │   ├── integration
    │   │   ├── constraints.txt
    │   │   ├── requirements.txt
    │   │   └── targets
    │   │       ├── logs
    │   │       │   ├── aliases
    │   │       │   └── tasks
    │   │       │       └── main.yml
    │   │       ├── ...
    │   └── unit
    │       ├── constraints.txt
    │       ├── module_utils
    │       │   ├── test_core.py
    │       │   └── test_utils.py
    │       └── requirements.txt
    
  • templates/ - Hosts the templates files that generate each resource's plugin.

    ├── default_module.j2
    └── header.j2
    

The following command alllows amazon_cloud_code_generator to generate the content (for example, plugins, moudule_utils, tests, etc.) in the cloud subdirectory by default:

python -m amazon_cloud_code_generator.cmd.refresh_modules

A different target directory can be specified by using:

python -m amazon_cloud_code_generator.cmd.refresh_modules --target-dir /somewhere/else

When available, the documented EXAMPLE block of the generated modules can be updated by using the following command:

python -m amazon_cloud_code_generator.cmd.refresh_examples

How to refresh the amazon.cloud collection

Fork the original amazon.cloud collection repository to your account on GitHub. Ensure to have the path ~/.ansible/collections/ansible_collections/amazon/cloud and clone the repository from your fork:

mkdir -p ~/.ansible/collections/ansible_collections/amazon/cloud
git clone https://github.com/YOUR_USER/amazon.cloud ~/.ansible/collections/ansible_collections/amazon/cloud

Refresh the content of the modules by changing your path to ~/.ansible/collections/ansible_collections/amazon/cloud and running tox -e refresh_modules.

This command will refresh the content of the amazon.cloud collection plugins including EXAMPLE block and will format the plugins using the black formatter.

cd ~/.ansible/collections/ansible_collections/amazon/cloud
tox -e refresh_modules

You can also specify the next release version by passing the --next-version parameter as follows:

tox -e refresh_modules --next-version 0.2.0

Individual operations are also allowed.

For example, you can only format the Python code of the plugins using the black formatter by running:

tox -e black

You can also refresh the plugins documentation located in ~/.ansible/collections/ansible_collections/amazon/cloud/docs by running.

tox -e add_docs

Run ansible-test to validate the generated content using:

virtualenv -p python3.9 ~/tmp/venv-tmp-py39-aws
source ~/tmp/venv-tmp-py39-aws/bin/activate
pip install -r requirements.txt -r test-requirements.txt ansible
ansible-test sanity --requirements --local --python 3.9 -vvv

You can also execute all integration tests for the collection using:

ansible-test integration --requirements --docker

Contributing

We welcome community contributions and if you find problems, please open an issue or create a Pull Request. You can also join us in the: - #ansible-aws irc.libera.chat channel - #ansible (general use questions and support), #ansible-community (community and collection development questions), and other IRC channels.

The Amazon Web Services Working groups is holding a monthly community meeting at #ansible-aws IRC channel at 17:30 UTC every fourth Thursday of the month. If you have something to discuss (e.g. a PR that needs help), add your request to the meeting agenda and join the IRC #ansible-aws channel. Invite (import by URL): ics file

You don't know how to start? Refer to our contribution guide!

Code of Conduct

This project is governed by the Ansible Community code of conduct

Licensing

GNU General Public License v3.0 or later.

See COPYING to see the full text.

amazon_cloud_code_generator's People

Contributors

alinabuzachis avatar gomathiselvis avatar goneri avatar gravesm avatar jatorcasso avatar jillr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.