What are other CDK templates besides sample-app? - aws-cdk

As I am learning the AWS CDK I have invoked 'cdk init' to create a new project with the default sample-app template. What are other templates and/or where are they located?
$ cdk init --help
cdk init [TEMPLATE]
Create a new, empty CDK project from a template. Invoked without TEMPLATE, the app template will be used.

cdk init --list can be used to view a list of the available templates

You can find the other templates on CDK GitHub source code.
Usage:
cdk init --language LANGUAGE [TEMPLATE]
Where:
LANGUAGE:
is one of the supported programming languages: csharp (C#),
java (Java), javascript (JavaScript), python (Python), or typescript
(TypeScript)
TEMPLATE: is an optional template. If the desired template is app, the
default, you may omit it.
Available templates: app \ lib \ sample-app

As of now there are only 3 templates available
Available templates:
app: Template for a CDK Application
└─ cdk init app --language=[csharp|fsharp|go|java|javascript|python|typescript]
lib: Template for a CDK Construct Library
└─ cdk init lib --language=typescript
sample-app: Example CDK Application with some constructs
└─ cdk init sample-app --language=[csharp|fsharp|go|java|javascript|python|typescript]

Related

How to generate self-contained specification of openAPI

Intellij's SwaggerHub Smartbear plugin has functionality 'Export self-contained specification(YAML)' which will resolve all the remote $ref(s) and generate local
definitions of domain models in the generated output document.
Is there a way to do it programmatically for making it as part of build pipeline? Any java program or scripts can we write for the same?

How to create different stages or environments in single serverless.yml file using serverless framework?

I am new to using serverless framework ,I wanted to create three different environments dev,Qa,prod. How do i create in single serverless.yml file ? The provider is AWS.
You can pass a stage CLI option that can be interpolated wherever needed in your serverless.yml file. For example, take the following CLI command:
serverless --stage dev deploy
This can be accessed in serverless.yml with ${opt:stage}. I usually include this under provider:
provider:
stage: ${opt:stage}
Then you can get the value of the stage option anywhere in serverless.yml using ${self:provider.stage}.
When lambdas are deployed, their ARNs are automatically constructed with prefixes of the service name (as defined by the service key in serverless.yml), the stage, and the lambda name, like the following:
arn:aws:lambda:us-east-1:010101010101:function:myservice-dev-mylambdaname
So you can simply run the deploy CLI command for the other two stages/environments you want, and you'll have a set of separate resources for each environment.

Grails Multi-Project: Running a Plugin's custom script

Followed the tutorial on multi-projects
Everything mostly works. Plugin controllers & domain classes load properly in the application. However, a problem occurs when trying to run a Plugin's custom script from the application's grails CLI.
For example:
If you set up the multi-project directory structure like this:
Project Root
Application Directory
Plugin Directory
settings.gradle
And ran this command from the Plugin Directory
grails create-script hello
You'd be able to access the script when running grails from the Plugin Directory, but not the Application's Directory.
Is there a way to get this to work properly? Do I need to use an alternative set up?
Also see Creating a Custom Script in Grails
A conventional grails 3 plugin is different than a plugin within a multi-project. It doesn't seem to be designed to compile a plugin such as grails scaffolding with custom commands.
For this reason, you should package the plugin manually using:
grails package-plugin
grails install
Now in the build.gradle, add this line to dependencies:
compile "<plugin-group>:<plugin-name>:<plugin-version>
Subsituting the appropriate information within the brackets <>.
You can find the plugin-group in the plugin's build.gradle
group "org.grails.plugins"
plugin-name you specified in the grails create-plugin command
grails create-plugin plugin-name
plugin-version is also found in the plugin's build.gradle
version "0.1"

jenkins use shared library in non default location

Following
https://jenkins.io/blog/2017/02/15/declarative-notifications/
I use in my java project a shared library vars/sendNotification.groovy that is used in a jenkins pipeline in src/main/resources/pipeline.
I got this folder structure from
https://jenkins.io/doc/book/pipeline/shared-libraries/
Is it somehow possible to put the groovy script in src/main/resources/ as well? On jenkins -> configuration -> Global Pipeline Libraries it doesn't give me options to specify a path of the shared library (the groovy script)
Thanks!

How do I create a Grails skeleton project for plugin development?

I am working with a (sort of) framework built on top of Grails. This framework is a set of Grails plugins that add functionality to the Grails app (e.g. user authentication). This framework is a bit of a pain to setup, as it requires around 64 lines of site specific configuration in the apps's Config.groovy file.
I want to develop my addons to this app as plugins. That is, the Grails app would really just be a set of installed plugins and some configuration files.
I have created a local Maven style repository to hold all of my plugins. Thus, I can add plugin dependencies to the BuildConfig.groovy file and they will be installed automatically (side question: is it possible to specify the install order?).
So my question is, how do I create skeleton project for developing my plugins that would:
Include the base configuration for my application (the aforementioned 64 lines)
Allow me to do a grails package-plugin to package only the plugin's code
You can use the post-installation hooks mechanism: http://grails.org/doc/latest/guide/plugins.html#hookingIntoBuildEvents
Not really an ideal setup for me, but the following works:
Create the "base" application: cd ~/GrailsDev/ && grails create-app my-app
Configure my-app as desired/required
Create your dependent plugin: cd ~/GrailsDev/ && grails create-plugin my-app-plugin
Add the new plugin to the app by editing "~/GrailsDev/my-app/grails-app/conf/BuildConfig.groovy" and appending the line: grails.plugin.location.'my-app-plugin' = "../my-app-plugin"
You can now run the my-app Grails application and the plugin will be included. When your plugin is fully developed, you can do grails package-plugin from within the "~/GrailsDev/my-app-plugin" directory to package your plugin.
use gradle. you can specify the order and package your plugin alone.
e.g. include the required plugins as git modules (for easy versioning) and gradle modules (for building your plugin) in your plugin project.
this setup will serve your requirements well I suppose.
https://github.com/grails/grails-gradle-plugin
IntelliJ does have a template for gradle-backed grails applications and plugins.

Resources