software.amazon.awssdk.services.eventbridge.model.DescribeEventSourceResponse 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.time.Instant;
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 DescribeEventSourceResponse extends EventBridgeResponse implements
ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn")
.getter(getter(DescribeEventSourceResponse::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build();
private static final SdkField CREATED_BY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreatedBy").getter(getter(DescribeEventSourceResponse::createdBy)).setter(setter(Builder::createdBy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedBy").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(DescribeEventSourceResponse::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField EXPIRATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("ExpirationTime").getter(getter(DescribeEventSourceResponse::expirationTime))
.setter(setter(Builder::expirationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpirationTime").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(DescribeEventSourceResponse::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(DescribeEventSourceResponse::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, CREATED_BY_FIELD,
CREATION_TIME_FIELD, EXPIRATION_TIME_FIELD, NAME_FIELD, STATE_FIELD));
private final String arn;
private final String createdBy;
private final Instant creationTime;
private final Instant expirationTime;
private final String name;
private final String state;
private DescribeEventSourceResponse(BuilderImpl builder) {
super(builder);
this.arn = builder.arn;
this.createdBy = builder.createdBy;
this.creationTime = builder.creationTime;
this.expirationTime = builder.expirationTime;
this.name = builder.name;
this.state = builder.state;
}
/**
*
* The ARN of the partner event source.
*
*
* @return The ARN of the partner event source.
*/
public final String arn() {
return arn;
}
/**
*
* The name of the SaaS partner that created the event source.
*
*
* @return The name of the SaaS partner that created the event source.
*/
public final String createdBy() {
return createdBy;
}
/**
*
* The date and time that the event source was created.
*
*
* @return The date and time that the event source was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The date and time that the event source will expire if you do not create a matching event bus.
*
*
* @return The date and time that the event source will expire if you do not create a matching event bus.
*/
public final Instant expirationTime() {
return expirationTime;
}
/**
*
* The name of the partner event source.
*
*
* @return The name of the partner event source.
*/
public final String name() {
return name;
}
/**
*
* The state of the event source. If it is ACTIVE, you have already created a matching event bus for this event
* source, and that event bus is active. If it is PENDING, either you haven't yet created a matching event bus, or
* that event bus is deactivated. If it is DELETED, you have created a matching event bus, but the event source has
* since been deleted.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link EventSourceState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the event source. If it is ACTIVE, you have already created a matching event bus for this
* event source, and that event bus is active. If it is PENDING, either you haven't yet created a matching
* event bus, or that event bus is deactivated. If it is DELETED, you have created a matching event bus, but
* the event source has since been deleted.
* @see EventSourceState
*/
public final EventSourceState state() {
return EventSourceState.fromValue(state);
}
/**
*
* The state of the event source. If it is ACTIVE, you have already created a matching event bus for this event
* source, and that event bus is active. If it is PENDING, either you haven't yet created a matching event bus, or
* that event bus is deactivated. If it is DELETED, you have created a matching event bus, but the event source has
* since been deleted.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link EventSourceState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state of the event source. If it is ACTIVE, you have already created a matching event bus for this
* event source, and that event bus is active. If it is PENDING, either you haven't yet created a matching
* event bus, or that event bus is deactivated. If it is DELETED, you have created a matching event bus, but
* the event source has since been deleted.
* @see EventSourceState
*/
public final String stateAsString() {
return state;
}
@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(arn());
hashCode = 31 * hashCode + Objects.hashCode(createdBy());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(expirationTime());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
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 DescribeEventSourceResponse)) {
return false;
}
DescribeEventSourceResponse other = (DescribeEventSourceResponse) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(createdBy(), other.createdBy())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(expirationTime(), other.expirationTime()) && Objects.equals(name(), other.name())
&& Objects.equals(stateAsString(), other.stateAsString());
}
/**
* 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("DescribeEventSourceResponse").add("Arn", arn()).add("CreatedBy", createdBy())
.add("CreationTime", creationTime()).add("ExpirationTime", expirationTime()).add("Name", name())
.add("State", stateAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Arn":
return Optional.ofNullable(clazz.cast(arn()));
case "CreatedBy":
return Optional.ofNullable(clazz.cast(createdBy()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "ExpirationTime":
return Optional.ofNullable(clazz.cast(expirationTime()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function