org.cdk8s.Cron Maven / Gradle / Ivy
Show all versions of cdk8s Show documentation
package org.cdk8s;
/**
* Represents a cron schedule.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.106.0 (build e852934)", date = "2024-12-18T12:15:47.120Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = org.cdk8s.$Module.class, fqn = "cdk8s.Cron")
public class Cron extends software.amazon.jsii.JsiiObject {
protected Cron(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Cron(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param cronOptions
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Cron(final @org.jetbrains.annotations.Nullable org.cdk8s.CronOptions cronOptions) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { cronOptions });
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Cron() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* Create a cron schedule which runs first day of January every year.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.Cron annually() {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.Cron.class, "annually", software.amazon.jsii.NativeType.forClass(org.cdk8s.Cron.class));
}
/**
* Create a cron schedule which runs every day at midnight.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.Cron daily() {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.Cron.class, "daily", software.amazon.jsii.NativeType.forClass(org.cdk8s.Cron.class));
}
/**
* Create a cron schedule which runs every minute.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.Cron everyMinute() {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.Cron.class, "everyMinute", software.amazon.jsii.NativeType.forClass(org.cdk8s.Cron.class));
}
/**
* Create a cron schedule which runs every hour.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.Cron hourly() {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.Cron.class, "hourly", software.amazon.jsii.NativeType.forClass(org.cdk8s.Cron.class));
}
/**
* Create a cron schedule which runs first day of every month.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.Cron monthly() {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.Cron.class, "monthly", software.amazon.jsii.NativeType.forClass(org.cdk8s.Cron.class));
}
/**
* Create a custom cron schedule from a set of cron fields.
*
* @param options This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.Cron schedule(final @org.jetbrains.annotations.NotNull org.cdk8s.CronOptions options) {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.Cron.class, "schedule", software.amazon.jsii.NativeType.forClass(org.cdk8s.Cron.class), new Object[] { java.util.Objects.requireNonNull(options, "options is required") });
}
/**
* Create a cron schedule which runs every week on Sunday.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static @org.jetbrains.annotations.NotNull org.cdk8s.Cron weekly() {
return software.amazon.jsii.JsiiObject.jsiiStaticCall(org.cdk8s.Cron.class, "weekly", software.amazon.jsii.NativeType.forClass(org.cdk8s.Cron.class));
}
/**
* Retrieve the expression for this schedule.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getExpressionString() {
return software.amazon.jsii.Kernel.get(this, "expressionString", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* A fluent builder for {@link org.cdk8s.Cron}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create() {
return new Builder();
}
private org.cdk8s.CronOptions.Builder cronOptions;
private Builder() {
}
/**
* The day of the month to run this rule at.
*
* Default: - Every day of the month
*
* @return {@code this}
* @param day The day of the month to run this rule at. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder day(final java.lang.String day) {
this.cronOptions().day(day);
return this;
}
/**
* The hour to run this rule at.
*
* Default: - Every hour
*
* @return {@code this}
* @param hour The hour to run this rule at. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder hour(final java.lang.String hour) {
this.cronOptions().hour(hour);
return this;
}
/**
* The minute to run this rule at.
*
* Default: - Every minute
*
* @return {@code this}
* @param minute The minute to run this rule at. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder minute(final java.lang.String minute) {
this.cronOptions().minute(minute);
return this;
}
/**
* The month to run this rule at.
*
* Default: - Every month
*
* @return {@code this}
* @param month The month to run this rule at. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder month(final java.lang.String month) {
this.cronOptions().month(month);
return this;
}
/**
* The day of the week to run this rule at.
*
* Default: - Any day of the week
*
* @return {@code this}
* @param weekDay The day of the week to run this rule at. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder weekDay(final java.lang.String weekDay) {
this.cronOptions().weekDay(weekDay);
return this;
}
/**
* @return a newly built instance of {@link org.cdk8s.Cron}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public org.cdk8s.Cron build() {
return new org.cdk8s.Cron(
this.cronOptions != null ? this.cronOptions.build() : null
);
}
private org.cdk8s.CronOptions.Builder cronOptions() {
if (this.cronOptions == null) {
this.cronOptions = new org.cdk8s.CronOptions.Builder();
}
return this.cronOptions;
}
}
}