
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@qrvey/scheduler
Advanced tools
This is a library to use AWS Eventbridge, k8s scheduler or K8s jobs.
npm install @qrvey/scheduler
AWS_ACCOUNT_ID; //AWS AccountId to send EventBridge service
AWS_DEFAULT_REGION; //AWS Region for EventBridge service
PLATFORM_TYPE; //Platform type (possible value CONTAINER)
CRONJOB_NAMESPACE //This env variable is required for k8s scheduler
const { SchedulerService } = require("@qrvey/scheduler");
(async () => {
const scheduleParams = {
cronJobName: "multicloud-testcron",
scheduleExpression: "cron(*/1 * * * * *)",
description:
'{"userEmail":"email@useremail.com","datasetName":"DBName","appName":"AppName","readableCronExpr":"Every hour","owner":"ownerId","datasetId":"datasetId","userId":"userId","appId":"appId"}',
targetParams: {
Name: "demo_drScheduler_CJ_mra43sr0U",
Input: {
detail: {
appId: "appId",
userId: "userId",
owner: "owner",
datasetId: "datasetId",
cronSyncFrequency: "0 0/1 * * ? *",
version: 2.1,
},
source: "aws.events",
},
},
tags: [
{
Key: "version",
Value: "2.1",
},
{
Key: "datasetId",
Value: "datasetId",
},
{
Key: "appId",
Value: "appId",
},
{
Key: "userId",
Value: "userId",
},
{
Key: "state",
Value: "ENABLED",
},
{
Key: "owner",
Value: "userId",
},
],
targetResource: "arn:aws:lambda:{region}:{accountId}:function:{functionName}", //For ks8 scheduler the targetRosource will be the entire container url
state: "DISABLED",
};
const schedulerClient = new schedulerService();
const res = await schedulerClient.create(scheduleParams);
})();
const { TaskService } = require('@qrvey/scheduler');
const main = async () => {
try {
const namespace = 'service-app';
const jobManifest = {
taskName: 'task-name',
containerName: 'container-name',
description: 'this is to run a task',
image: `image_service_registry_container/image_name:latest`, // image to pull from registry container service
imagePullSecret: 'image-secret', // secret access to pull the image
environmentVariables: [ // env variables to pass for the job container
{ name: 'SERVER', value: 'some_prefix' },
{ name: 'NUMBER_OF_TYPES', value: 5 },
{ name: 'PLATFORM', value: 'AZURE' },
],
arguments: [ // arguments that you can get in the container
{ name: '--operation', value: 'getNames' },
{ name: '--id', value: 'mdK23ds' },
{ name: '--version', value: 'published' },
],
command: ['node', 'index.js'], // command to run
};
const newJob = new TaskService();
return await newJob.create(namespace, jobManifest);
/*
{
'annotations'?: {
[key: string]: string;
};
'creationTimestamp'?: Date;
'deletionGracePeriodSeconds'?: number;
'deletionTimestamp'?: Date;
'finalizers'?: Array<string>;
'generateName'?: string;
'generation'?: number;
'labels'?: {
[key: string]: string;
};
'managedFields'?: Array<V1ManagedFieldsEntry>;
'name'?: string;
'namespace'?: string;
'ownerReferences'?: Array<V1OwnerReference>;
'resourceVersion'?: string;
'selfLink'?: string;
'uid'?: string;
}
*/
} catch (error) {
console.error(error);
}
}
main();
const { TaskService } = require('@qrvey/scheduler');
const main = async () => {
try {
const namespace = 'namespace';
const jobName = 'remove-something';
const getJob = new TaskService();
return await getJob.get(namespace, jobName);
/*
{
statusCode: 200,
metadata: {
'annotations'?: {
[key: string]: string;
};
'creationTimestamp'?: Date;
'deletionGracePeriodSeconds'?: number;
'deletionTimestamp'?: Date;
'finalizers'?: Array<string>;
'generateName'?: string;
'generation'?: number;
'labels'?: {
[key: string]: string;
};
'managedFields'?: Array<V1ManagedFieldsEntry>;
'name'?: string;
'namespace'?: string;
'ownerReferences'?: Array<V1OwnerReference>;
'resourceVersion'?: string;
'selfLink'?: string;
'uid'?: string;
},
status: {
'active'?: number;
'completedIndexes'?: string;
'completionTime'?: Date;
'conditions'?: Array<V1JobCondition>;
'failed'?: number;
'failedIndexes'?: string;
'ready'?: number;
'startTime'?: Date;
'succeeded'?: number;
'terminating'?: number;
'uncountedTerminatedPods'?: V1UncountedTerminatedPods;
},
}
*/
} catch (error) {
console.error(error);
}
}
main();
const { TaskService } = require('@qrvey/scheduler');
const main = async () => {
try {
const namespace = 'namespace';
const listJobs = new TaskService();
return await listJobs.list(namespace);
/*
[
"remove-orphan-data",
"migrate-database-data",
"api-data",
]
*/
} catch (error) {
console.error(error);
}
}
main();
const { TaskService } = require('@qrvey/scheduler');
const main = async () => {
try {
const namespace = 'namespace';
const jobName = 'remove-something';
const deleteJob = new TaskService();
return await deleteJob.delete(namespace, jobName);
/*
{
'apiVersion'?: string;
'code'?: number;
'details'?: V1StatusDetails;
'kind'?: string;
'message'?: string;
'metadata'?: V1ListMeta;
'reason'?: string;
'status'?: string;
}
*/
} catch (error) {
console.error(error);
}
}
main();
FAQs
Library to schedule the datasync cronjobs
We found that @qrvey/scheduler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 14 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.