software.amazon.awssdk.services.eventbridge.model.DescribeRuleResponse Maven / Gradle / Ivy
Show all versions of eventbridge Show documentation
/*
* Copyright 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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeRuleResponse extends EventBridgeResponse implements
ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(DescribeRuleResponse::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).memberName("Arn")
.getter(getter(DescribeRuleResponse::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)
.memberName("EventPattern").getter(getter(DescribeRuleResponse::eventPattern)).setter(setter(Builder::eventPattern))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventPattern").build()).build();
private static final SdkField SCHEDULE_EXPRESSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ScheduleExpression").getter(getter(DescribeRuleResponse::scheduleExpression))
.setter(setter(Builder::scheduleExpression))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduleExpression").build())
.build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(DescribeRuleResponse::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)
.memberName("Description").getter(getter(DescribeRuleResponse::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RoleArn").getter(getter(DescribeRuleResponse::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)
.memberName("ManagedBy").getter(getter(DescribeRuleResponse::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)
.memberName("EventBusName").getter(getter(DescribeRuleResponse::eventBusName)).setter(setter(Builder::eventBusName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventBusName").build()).build();
private static final SdkField CREATED_BY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreatedBy").getter(getter(DescribeRuleResponse::createdBy)).setter(setter(Builder::createdBy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedBy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, ARN_FIELD,
EVENT_PATTERN_FIELD, SCHEDULE_EXPRESSION_FIELD, STATE_FIELD, DESCRIPTION_FIELD, ROLE_ARN_FIELD, MANAGED_BY_FIELD,
EVENT_BUS_NAME_FIELD, CREATED_BY_FIELD));
private final String name;
private final String arn;
private final String eventPattern;
private final String scheduleExpression;
private final String state;
private final String description;
private final String roleArn;
private final String managedBy;
private final String eventBusName;
private final String createdBy;
private DescribeRuleResponse(BuilderImpl builder) {
super(builder);
this.name = builder.name;
this.arn = builder.arn;
this.eventPattern = builder.eventPattern;
this.scheduleExpression = builder.scheduleExpression;
this.state = builder.state;
this.description = builder.description;
this.roleArn = builder.roleArn;
this.managedBy = builder.managedBy;
this.eventBusName = builder.eventBusName;
this.createdBy = builder.createdBy;
}
/**
*
* The name of the rule.
*
*
* @return The name of the rule.
*/
public final String name() {
return name;
}
/**
*
* The Amazon Resource Name (ARN) of the rule.
*
*
* @return The Amazon Resource Name (ARN) of the rule.
*/
public final String arn() {
return arn;
}
/**
*
* The event pattern. For more information, see Events and
* Event Patterns in the Amazon EventBridge User Guide.
*
*
* @return The event pattern. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide.
*/
public final String eventPattern() {
return eventPattern;
}
/**
*
* The scheduling expression. For example, "cron(0 20 * * ? *)", "rate(5 minutes)".
*
*
* @return The scheduling expression. For example, "cron(0 20 * * ? *)", "rate(5 minutes)".
*/
public final String scheduleExpression() {
return scheduleExpression;
}
/**
*
* Specifies whether the rule is enabled or disabled.
*
*
* 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 Specifies whether the rule is enabled or disabled.
* @see RuleState
*/
public final RuleState state() {
return RuleState.fromValue(state);
}
/**
*
* Specifies whether the rule is enabled or disabled.
*
*
* 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 Specifies whether the rule is enabled or disabled.
* @see RuleState
*/
public final String stateAsString() {
return state;
}
/**
*
* The description of the rule.
*
*
* @return The description of the rule.
*/
public final String description() {
return description;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role associated with the rule.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role associated with the rule.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* If this is a managed rule, created by an Amazon Web Services service on your behalf, this field displays the
* principal name of the Amazon Web Services service that created the rule.
*
*
* @return If this is a managed rule, created by an Amazon Web Services service on your behalf, this field displays
* the principal name of the Amazon Web Services service that created the rule.
*/
public final String managedBy() {
return managedBy;
}
/**
*
* The name of the event bus associated with the rule.
*
*
* @return The name of the event bus associated with the rule.
*/
public final String eventBusName() {
return eventBusName;
}
/**
*
* The account ID of the user that created the rule. If you use PutRule
to put a rule on an event bus
* in another account, the other account is the owner of the rule, and the rule ARN includes the account ID for that
* account. However, the value for CreatedBy
is the account ID as the account that created the rule in
* the other account.
*
*
* @return The account ID of the user that created the rule. If you use PutRule
to put a rule on an
* event bus in another account, the other account is the owner of the rule, and the rule ARN includes the
* account ID for that account. However, the value for CreatedBy
is the account ID as the
* account that created the rule in the other account.
*/
public final String createdBy() {
return createdBy;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(eventPattern());
hashCode = 31 * hashCode + Objects.hashCode(scheduleExpression());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(managedBy());
hashCode = 31 * hashCode + Objects.hashCode(eventBusName());
hashCode = 31 * hashCode + Objects.hashCode(createdBy());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeRuleResponse)) {
return false;
}
DescribeRuleResponse other = (DescribeRuleResponse) obj;
return Objects.equals(name(), other.name()) && Objects.equals(arn(), other.arn())
&& Objects.equals(eventPattern(), other.eventPattern())
&& Objects.equals(scheduleExpression(), other.scheduleExpression())
&& Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(description(), other.description())
&& Objects.equals(roleArn(), other.roleArn()) && Objects.equals(managedBy(), other.managedBy())
&& Objects.equals(eventBusName(), other.eventBusName()) && Objects.equals(createdBy(), other.createdBy());
}
/**
* 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 final String toString() {
return ToString.builder("DescribeRuleResponse").add("Name", name()).add("Arn", arn()).add("EventPattern", eventPattern())
.add("ScheduleExpression", scheduleExpression()).add("State", stateAsString()).add("Description", description())
.add("RoleArn", roleArn()).add("ManagedBy", managedBy()).add("EventBusName", eventBusName())
.add("CreatedBy", createdBy()).build();
}
public final 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 "ScheduleExpression":
return Optional.ofNullable(clazz.cast(scheduleExpression()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "RoleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "ManagedBy":
return Optional.ofNullable(clazz.cast(managedBy()));
case "EventBusName":
return Optional.ofNullable(clazz.cast(eventBusName()));
case "CreatedBy":
return Optional.ofNullable(clazz.cast(createdBy()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function