software.amazon.awssdk.services.eventbridge.model.PartnerEventSourceAccount 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.io.Serializable;
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;
/**
*
* The Amazon Web Services account that a partner event source has been offered to.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PartnerEventSourceAccount implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ACCOUNT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Account")
.getter(getter(PartnerEventSourceAccount::account)).setter(setter(Builder::account))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Account").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(PartnerEventSourceAccount::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(PartnerEventSourceAccount::expirationTime))
.setter(setter(Builder::expirationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpirationTime").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(PartnerEventSourceAccount::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(ACCOUNT_FIELD,
CREATION_TIME_FIELD, EXPIRATION_TIME_FIELD, STATE_FIELD));
private static final long serialVersionUID = 1L;
private final String account;
private final Instant creationTime;
private final Instant expirationTime;
private final String state;
private PartnerEventSourceAccount(BuilderImpl builder) {
this.account = builder.account;
this.creationTime = builder.creationTime;
this.expirationTime = builder.expirationTime;
this.state = builder.state;
}
/**
*
* The Amazon Web Services account ID that the partner event source was offered to.
*
*
* @return The Amazon Web Services account ID that the partner event source was offered to.
*/
public final String account() {
return account;
}
/**
*
* The date and time the event source was created.
*
*
* @return The date and time the event source was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The date and time that the event source will expire, if the Amazon Web Services account doesn't create a matching
* event bus for it.
*
*
* @return The date and time that the event source will expire, if the Amazon Web Services account doesn't create a
* matching event bus for it.
*/
public final Instant expirationTime() {
return expirationTime;
}
/**
*
* 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 + Objects.hashCode(account());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(expirationTime());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PartnerEventSourceAccount)) {
return false;
}
PartnerEventSourceAccount other = (PartnerEventSourceAccount) obj;
return Objects.equals(account(), other.account()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(expirationTime(), other.expirationTime())
&& 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("PartnerEventSourceAccount").add("Account", account()).add("CreationTime", creationTime())
.add("ExpirationTime", expirationTime()).add("State", stateAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Account":
return Optional.ofNullable(clazz.cast(account()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "ExpirationTime":
return Optional.ofNullable(clazz.cast(expirationTime()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function