
software.amazon.awssdk.services.codestarnotifications.model.TargetSummary Maven / Gradle / Ivy
/*
* 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.codestarnotifications.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;
/**
*
* Information about the targets specified for a notification rule.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TargetSummary implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField TARGET_ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetAddress").getter(getter(TargetSummary::targetAddress)).setter(setter(Builder::targetAddress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetAddress").build()).build();
private static final SdkField TARGET_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetType").getter(getter(TargetSummary::targetType)).setter(setter(Builder::targetType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetType").build()).build();
private static final SdkField TARGET_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TargetStatus").getter(getter(TargetSummary::targetStatusAsString)).setter(setter(Builder::targetStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetStatus").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TARGET_ADDRESS_FIELD,
TARGET_TYPE_FIELD, TARGET_STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final String targetAddress;
private final String targetType;
private final String targetStatus;
private TargetSummary(BuilderImpl builder) {
this.targetAddress = builder.targetAddress;
this.targetType = builder.targetType;
this.targetStatus = builder.targetStatus;
}
/**
*
* The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
*
*
* @return The Amazon Resource Name (ARN) of the Chatbot topic or Chatbot client.
*/
public final String targetAddress() {
return targetAddress;
}
/**
*
* The type of the target (for example, SNS
).
*
*
* -
*
* Chatbot topics are specified as SNS
.
*
*
* -
*
* Chatbot clients are specified as AWSChatbotSlack
.
*
*
*
*
* @return The type of the target (for example, SNS
).
*
* -
*
* Chatbot topics are specified as SNS
.
*
*
* -
*
* Chatbot clients are specified as AWSChatbotSlack
.
*
*
*/
public final String targetType() {
return targetType;
}
/**
*
* The status of the target.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #targetStatus} will
* return {@link TargetStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #targetStatusAsString}.
*
*
* @return The status of the target.
* @see TargetStatus
*/
public final TargetStatus targetStatus() {
return TargetStatus.fromValue(targetStatus);
}
/**
*
* The status of the target.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #targetStatus} will
* return {@link TargetStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #targetStatusAsString}.
*
*
* @return The status of the target.
* @see TargetStatus
*/
public final String targetStatusAsString() {
return targetStatus;
}
@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(targetAddress());
hashCode = 31 * hashCode + Objects.hashCode(targetType());
hashCode = 31 * hashCode + Objects.hashCode(targetStatusAsString());
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 TargetSummary)) {
return false;
}
TargetSummary other = (TargetSummary) obj;
return Objects.equals(targetAddress(), other.targetAddress()) && Objects.equals(targetType(), other.targetType())
&& Objects.equals(targetStatusAsString(), other.targetStatusAsString());
}
/**
* 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("TargetSummary")
.add("TargetAddress", targetAddress() == null ? null : "*** Sensitive Data Redacted ***")
.add("TargetType", targetType()).add("TargetStatus", targetStatusAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TargetAddress":
return Optional.ofNullable(clazz.cast(targetAddress()));
case "TargetType":
return Optional.ofNullable(clazz.cast(targetType()));
case "TargetStatus":
return Optional.ofNullable(clazz.cast(targetStatusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function