All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.eventbridge.model.Rule Maven / Gradle / Ivy

Go to download

The AWS Java SDK for EventBridge module holds the client classes that are used for communicating with EventBridge.

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package software.amazon.awssdk.services.eventbridge.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Contains information about a rule in Amazon EventBridge. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Rule implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Rule::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).getter(getter(Rule::arn)) .setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build(); private static final SdkField EVENT_PATTERN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Rule::eventPattern)).setter(setter(Builder::eventPattern)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventPattern").build()).build(); private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Rule::stateAsString)).setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Rule::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build(); private static final SdkField SCHEDULE_EXPRESSION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Rule::scheduleExpression)).setter(setter(Builder::scheduleExpression)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleExpression").build()) .build(); private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Rule::roleArn)).setter(setter(Builder::roleArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RoleArn").build()).build(); private static final SdkField MANAGED_BY_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Rule::managedBy)).setter(setter(Builder::managedBy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ManagedBy").build()).build(); private static final SdkField EVENT_BUS_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Rule::eventBusName)).setter(setter(Builder::eventBusName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventBusName").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, ARN_FIELD, EVENT_PATTERN_FIELD, STATE_FIELD, DESCRIPTION_FIELD, SCHEDULE_EXPRESSION_FIELD, ROLE_ARN_FIELD, MANAGED_BY_FIELD, EVENT_BUS_NAME_FIELD)); private static final long serialVersionUID = 1L; private final String name; private final String arn; private final String eventPattern; private final String state; private final String description; private final String scheduleExpression; private final String roleArn; private final String managedBy; private final String eventBusName; private Rule(BuilderImpl builder) { this.name = builder.name; this.arn = builder.arn; this.eventPattern = builder.eventPattern; this.state = builder.state; this.description = builder.description; this.scheduleExpression = builder.scheduleExpression; this.roleArn = builder.roleArn; this.managedBy = builder.managedBy; this.eventBusName = builder.eventBusName; } /** *

* The name of the rule. *

* * @return The name of the rule. */ public String name() { return name; } /** *

* The Amazon Resource Name (ARN) of the rule. *

* * @return The Amazon Resource Name (ARN) of the rule. */ public String arn() { return arn; } /** *

* The event pattern of the rule. For more information, see Event * Patterns in the Amazon EventBridge User Guide. *

* * @return The event pattern of the rule. For more information, see Event * Patterns in the Amazon EventBridge User Guide. */ public String eventPattern() { return eventPattern; } /** *

* The state of the rule. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link RuleState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The state of the rule. * @see RuleState */ public RuleState state() { return RuleState.fromValue(state); } /** *

* The state of the rule. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link RuleState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The state of the rule. * @see RuleState */ public String stateAsString() { return state; } /** *

* The description of the rule. *

* * @return The description of the rule. */ public String description() { return description; } /** *

* The scheduling expression: for example, "cron(0 20 * * ? *)" or "rate(5 minutes)". *

* * @return The scheduling expression: for example, "cron(0 20 * * ? *)" or * "rate(5 minutes)". */ public String scheduleExpression() { return scheduleExpression; } /** *

* The Amazon Resource Name (ARN) of the role that is used for target invocation. *

* * @return The Amazon Resource Name (ARN) of the role that is used for target invocation. */ public String roleArn() { return roleArn; } /** *

* If an AWS service created the rule on behalf of your account, this field displays the principal name of the * service that created the rule. *

* * @return If an AWS service created the rule on behalf of your account, this field displays the principal name of * the service that created the rule. */ public String managedBy() { return managedBy; } /** *

* The event bus associated with the rule. *

* * @return The event bus associated with the rule. */ public String eventBusName() { return eventBusName; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(arn()); hashCode = 31 * hashCode + Objects.hashCode(eventPattern()); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(scheduleExpression()); hashCode = 31 * hashCode + Objects.hashCode(roleArn()); hashCode = 31 * hashCode + Objects.hashCode(managedBy()); hashCode = 31 * hashCode + Objects.hashCode(eventBusName()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Rule)) { return false; } Rule other = (Rule) obj; return Objects.equals(name(), other.name()) && Objects.equals(arn(), other.arn()) && Objects.equals(eventPattern(), other.eventPattern()) && Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(description(), other.description()) && Objects.equals(scheduleExpression(), other.scheduleExpression()) && Objects.equals(roleArn(), other.roleArn()) && Objects.equals(managedBy(), other.managedBy()) && Objects.equals(eventBusName(), other.eventBusName()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public String toString() { return ToString.builder("Rule").add("Name", name()).add("Arn", arn()).add("EventPattern", eventPattern()) .add("State", stateAsString()).add("Description", description()).add("ScheduleExpression", scheduleExpression()) .add("RoleArn", roleArn()).add("ManagedBy", managedBy()).add("EventBusName", eventBusName()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "Arn": return Optional.ofNullable(clazz.cast(arn())); case "EventPattern": return Optional.ofNullable(clazz.cast(eventPattern())); case "State": return Optional.ofNullable(clazz.cast(stateAsString())); case "Description": return Optional.ofNullable(clazz.cast(description())); case "ScheduleExpression": return Optional.ofNullable(clazz.cast(scheduleExpression())); case "RoleArn": return Optional.ofNullable(clazz.cast(roleArn())); case "ManagedBy": return Optional.ofNullable(clazz.cast(managedBy())); case "EventBusName": return Optional.ofNullable(clazz.cast(eventBusName())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Rule) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the rule. *

* * @param name * The name of the rule. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The Amazon Resource Name (ARN) of the rule. *

* * @param arn * The Amazon Resource Name (ARN) of the rule. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* The event pattern of the rule. For more information, see Event * Patterns in the Amazon EventBridge User Guide. *

* * @param eventPattern * The event pattern of the rule. For more information, see Event Patterns in the Amazon EventBridge User Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder eventPattern(String eventPattern); /** *

* The state of the rule. *

* * @param state * The state of the rule. * @see RuleState * @return Returns a reference to this object so that method calls can be chained together. * @see RuleState */ Builder state(String state); /** *

* The state of the rule. *

* * @param state * The state of the rule. * @see RuleState * @return Returns a reference to this object so that method calls can be chained together. * @see RuleState */ Builder state(RuleState state); /** *

* The description of the rule. *

* * @param description * The description of the rule. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The scheduling expression: for example, "cron(0 20 * * ? *)" or "rate(5 minutes)". *

* * @param scheduleExpression * The scheduling expression: for example, "cron(0 20 * * ? *)" or * "rate(5 minutes)". * @return Returns a reference to this object so that method calls can be chained together. */ Builder scheduleExpression(String scheduleExpression); /** *

* The Amazon Resource Name (ARN) of the role that is used for target invocation. *

* * @param roleArn * The Amazon Resource Name (ARN) of the role that is used for target invocation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder roleArn(String roleArn); /** *

* If an AWS service created the rule on behalf of your account, this field displays the principal name of the * service that created the rule. *

* * @param managedBy * If an AWS service created the rule on behalf of your account, this field displays the principal name * of the service that created the rule. * @return Returns a reference to this object so that method calls can be chained together. */ Builder managedBy(String managedBy); /** *

* The event bus associated with the rule. *

* * @param eventBusName * The event bus associated with the rule. * @return Returns a reference to this object so that method calls can be chained together. */ Builder eventBusName(String eventBusName); } static final class BuilderImpl implements Builder { private String name; private String arn; private String eventPattern; private String state; private String description; private String scheduleExpression; private String roleArn; private String managedBy; private String eventBusName; private BuilderImpl() { } private BuilderImpl(Rule model) { name(model.name); arn(model.arn); eventPattern(model.eventPattern); state(model.state); description(model.description); scheduleExpression(model.scheduleExpression); roleArn(model.roleArn); managedBy(model.managedBy); eventBusName(model.eventBusName); } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final String getArn() { return arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final void setArn(String arn) { this.arn = arn; } public final String getEventPattern() { return eventPattern; } @Override public final Builder eventPattern(String eventPattern) { this.eventPattern = eventPattern; return this; } public final void setEventPattern(String eventPattern) { this.eventPattern = eventPattern; } public final String getStateAsString() { return state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(RuleState state) { this.state(state == null ? null : state.toString()); return this; } public final void setState(String state) { this.state = state; } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final String getScheduleExpression() { return scheduleExpression; } @Override public final Builder scheduleExpression(String scheduleExpression) { this.scheduleExpression = scheduleExpression; return this; } public final void setScheduleExpression(String scheduleExpression) { this.scheduleExpression = scheduleExpression; } public final String getRoleArn() { return roleArn; } @Override public final Builder roleArn(String roleArn) { this.roleArn = roleArn; return this; } public final void setRoleArn(String roleArn) { this.roleArn = roleArn; } public final String getManagedBy() { return managedBy; } @Override public final Builder managedBy(String managedBy) { this.managedBy = managedBy; return this; } public final void setManagedBy(String managedBy) { this.managedBy = managedBy; } public final String getEventBusName() { return eventBusName; } @Override public final Builder eventBusName(String eventBusName) { this.eventBusName = eventBusName; return this; } public final void setEventBusName(String eventBusName) { this.eventBusName = eventBusName; } @Override public Rule build() { return new Rule(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy