Skip to content

Instantly share code, notes, and snippets.

View dilunika's full-sized avatar

Kasun Dilunika dilunika

View GitHub Profile
private createPipelineRole(sharedAccountPrincipal: AccountPrincipal) {
const pipelineRole = new iam.Role(this, 'DHApiCodepipelineRole', {
roleName: `DHApiCodepipelineRole`,
assumedBy: new iam.CompositePrincipal(
new iam.ServicePrincipal('codepipeline.amazonaws.com'),
new iam.ServicePrincipal('codebuild.amazonaws.com'),
sharedAccountPrincipal
)
});
pipelineRole.attachInlinePolicy(new iam.Policy(this, 'SharedAccountAssumeRolePolicy', {
@dilunika
dilunika / Jenkinsfile
Last active August 7, 2018 11:20
Jenkins stage issue
def sourceCodeBranch = params["SOURCE_BRANCH"]
def stage = params["DEPLOY_STAGE"]
def region = 'ap-southeast-2'
node {
stage('Checkout'){
git credentialsId: 'Github-xx',
branch: sourceCodeBranch
url: 'https://github.com/projectx/repox.git'
const update = require('immutability-helper');
const items = [
{key: 'IT-1', title: 'Dummy Item 1'},
{key: 'IT-2', title: 'Dummy Item 2'},
{key: 'IT-3', title: 'Dummy Item 3'},
{key: 'IT-4', title: 'Dummy Item 4'},
{key: 'IT-5', title: 'Dummy Item 5'},
{key: 'IT-6', title: 'Dummy Item 6'}
];
const {List} = require('immutable');
const items = [
{key: 'IT-1', title: 'Dummy Item 1'},
{key: 'IT-2', title: 'Dummy Item 2'},
{key: 'IT-3', title: 'Dummy Item 3'},
{key: 'IT-4', title: 'Dummy Item 4'},
{key: 'IT-5', title: 'Dummy Item 5'},
{key: 'IT-6', title: 'Dummy Item 6'}
];
CREATE TABLE admintools.vehicle_owners (
id int4 NOT NULL DEFAULT nextval('admintools.vehicle_owners_id_seq'::regclass),
first_name varchar(40) NOT NULL,
last_name varchar(40) NOT NULL,
nic varchar(20) NOT NULL,
email varchar(100) NULL,
address jsonb NULL,
contact_numbers jsonb NOT NULL,
CONSTRAINT vehicle_owners_first_name_check CHECK((first_name)::text <> ''::text),
CONSTRAINT vehicle_owners_last_name_check CHECK((last_name)::text <> ''::text),
public class VehicleOwnerService {
public static Observable<Integer> insert(VehicleOwner vehicleOwner) {
InsertStatement insert = new InsertStatement(vehicleOwner);
return databaseClient()
.getConnectionObservable()
public class JdbcUtil {
private static JDBCClient jdbcClient;
public static void initialize(Vertx vertx) {
JsonObject config = vertx.getOrCreateContext().config();
if(jdbcClient == null) {
final JsonObject jdbcConfig = new JsonObject()
mainClassName = 'io.vertx.core.Launcher'
shadowJar {
classifier = 'fat'
manifest {
attributes(
'Main-Verticle': 'com.majan.admintools.api.AdminToolsVerticle'
)
}
mergeServiceFiles {
public class VehicleOwnerRoute {
public static void initialize(Router router) {
router.route("/api/vehicleowners*").handler(BodyHandler.create());
router.post("/api/vehicleowners").handler(VehicleOwnerRoute::create);
}
public static void create(RoutingContext routingContext) {
public class AdminToolsVerticle extends AbstractVerticle {
@Override
public void start(Future<Void> fut) throws Exception {
Router router = Router.router(vertx);
JdbcUtil.initialize(vertx);
VehicleOwnerRoute.initialize(router);