|
| 1 | +# Cookiecutter for CloudBlue Connect Reports |
| 2 | + |
| 3 | +Powered by [Cookiecutter](https://github.com/cookiecutter/cookiecutter), Cookiecutter for CloudBlue Connect Reports provides a framework for boostraping your custom reports for Connect. |
| 4 | + |
| 5 | +With this project you can write your own reports to execute either locally or using the reports module of Connect. |
| 6 | + |
| 7 | +In order to create your own custom report you will need to get familiar with the [Connect Rest API](https://connect.cloudblue.com/community/api/) and it's OpenAPI implementation using the [connect-openapi-client](https://github.com/cloudblue/connect-python-openapi-client). |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +* Works fit python 3.8 and 3.9 |
| 12 | +* Bootstraps a custom report project within seconds |
| 13 | +* Provides all needed dependencies |
| 14 | +* Provides basic testing functionality including right mockers |
| 15 | +* Compatible with github Actions |
| 16 | +* Configures project licensing |
| 17 | + |
| 18 | +## Usage |
| 19 | + |
| 20 | +Creating a project that provides a report package that could be run either using the [Connect CLI](https://github.com/cloudblue/connect-cli) or directly in [Connect](https://connect.cloudblue.com) is simple. |
| 21 | + |
| 22 | +First of all, install in your local machine Cookiecutter, for example you can do it using pip: |
| 23 | + |
| 24 | + $ pip install cookiecutter |
| 25 | + |
| 26 | +Once cookiecutter is installed you can instantiate it against this repository: |
| 27 | + |
| 28 | + $ cookiecutter https://github.com/cloudblue/connect-report-python-boilerplate |
| 29 | + |
| 30 | + You'll be prompted for some values. Provide them and a Connect project will be created for you. |
| 31 | + |
| 32 | +**Warning**: Please change sample data with your own desired information |
| 33 | + |
| 34 | + project_name [My Awesome Project]: My Awesome Project |
| 35 | + project_slug [my_awesome_project]: |
| 36 | + description [My reports are really usefull!]: |
| 37 | + package_name [reports]: |
| 38 | + initial_report_name [My Awesome Report]: My Awesome Report |
| 39 | + initial_report_slug [my_awesome_report]: |
| 40 | + initial_report_description [This report provides all data i need]: |
| 41 | + author [Globex Corporation]: ISV Inc |
| 42 | + version [0.1.0]: 1.0.0 |
| 43 | + Select license: |
| 44 | + 1 - Apache Software License 2.0 |
| 45 | + 2 - MIT |
| 46 | + 3 - BSD |
| 47 | + Choose from 1, 2, 3 [1]: 1 |
| 48 | + use_github_actions [y]: y |
| 49 | + Done! Your report project is ready to go! |
| 50 | + |
| 51 | +Now you can access your recently created project folder and take a look arround it: |
| 52 | + |
| 53 | + $ cd my_awesome_report |
| 54 | + $ ls |
| 55 | + |
| 56 | +Starting here, if you want you can put your project on a git repository, for example at github: |
| 57 | + |
| 58 | + $ git init |
| 59 | + $ git add . |
| 60 | + $ git commit -m "first commit" |
| 61 | + $ git remote add origin https://github.com/cloudblue/my_custom_report.git |
| 62 | + $ git push -u origin master |
| 63 | + |
| 64 | +In the use case that you decided to use github actions, you will notice that a first CI task will run, this one will run the sample test |
| 65 | + |
| 66 | +## Creating your own report |
| 67 | + |
| 68 | +The creation of a requires some knowladge of [Connect Rest API](https://connect.cloudblue.com/community/api/) and the [connect-openapi-client](https://github.com/cloudblue/connect-python-openapi-client). |
| 69 | + |
| 70 | +First, edit the reports.json file, this file is a descriptor that can be read by Connect as well as Connect CLI to understand your package. Please ensure that all properties are defined. On the parameters list, you can define the parameters that will be asked to be populated by who runs the report, just select the ones you need as described in our community portal. |
| 71 | + |
| 72 | +The code of your report must be defined at your entrypoint, here is where system will find your function that will receive an instantiated client, this client is the openapi one and can work with our API, additionally you will get a function that you must invoke in order to update the progress |
| 73 | + |
| 74 | +Job done? Try to run it locally! |
| 75 | + |
| 76 | + $ ccli report list -d ./my_awesome_project |
| 77 | + |
| 78 | + ************************************************************ |
| 79 | + |
| 80 | + My Awesome Project version 1.0.0 |
| 81 | + |
| 82 | + ************************************************************ |
| 83 | + |
| 84 | + Welcome to My Awesome Project ! |
| 85 | + |
| 86 | + My reports are really usefull! |
| 87 | + |
| 88 | + License |
| 89 | + |
| 90 | + My Awesome Project is licensed under the Apache Software License 2.0 license. |
| 91 | + |
| 92 | + |
| 93 | + ************************************************************ |
| 94 | + |
| 95 | + List of available reports: |
| 96 | + |
| 97 | + Report ID: my_awesome_report - Report name: My Awesome Project |
| 98 | + |
| 99 | +Now if you want you can execute it also using ccli |
| 100 | + |
| 101 | + $ ccli report execute my_awesome_report_1 -d ./my_awesome_report |
| 102 | + |
| 103 | +## Examples |
| 104 | + |
| 105 | +All our reports that you can run from Connect platform are available to you, if you want to take a look at them and it's code visit our github repository available [here](https://github.com/cloudblue/connect-reports) |
| 106 | + |
| 107 | +Please take a look to our oficial [documentation site](https://connect.cloudblue.com) for more information on how to work with reports |
0 commit comments