software.amazon.awssdk.services.health.model.OrganizationEventDetailsErrorItem Maven / Gradle / Ivy
Show all versions of health 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.health.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;
/**
*
* Error information returned when a DescribeEventDetailsForOrganization operation can't find a specified event.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class OrganizationEventDetailsErrorItem implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField AWS_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("awsAccountId").getter(getter(OrganizationEventDetailsErrorItem::awsAccountId))
.setter(setter(Builder::awsAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("awsAccountId").build()).build();
private static final SdkField EVENT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("eventArn").getter(getter(OrganizationEventDetailsErrorItem::eventArn)).setter(setter(Builder::eventArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventArn").build()).build();
private static final SdkField ERROR_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("errorName").getter(getter(OrganizationEventDetailsErrorItem::errorName))
.setter(setter(Builder::errorName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("errorName").build()).build();
private static final SdkField ERROR_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("errorMessage").getter(getter(OrganizationEventDetailsErrorItem::errorMessage))
.setter(setter(Builder::errorMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("errorMessage").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AWS_ACCOUNT_ID_FIELD,
EVENT_ARN_FIELD, ERROR_NAME_FIELD, ERROR_MESSAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String awsAccountId;
private final String eventArn;
private final String errorName;
private final String errorMessage;
private OrganizationEventDetailsErrorItem(BuilderImpl builder) {
this.awsAccountId = builder.awsAccountId;
this.eventArn = builder.eventArn;
this.errorName = builder.errorName;
this.errorMessage = builder.errorMessage;
}
/**
*
* Error information returned when a DescribeEventDetailsForOrganization operation can't find a specified event.
*
*
* @return Error information returned when a DescribeEventDetailsForOrganization operation can't find a specified event.
*/
public final String awsAccountId() {
return awsAccountId;
}
/**
*
* The unique identifier for the event. The event ARN has the
* arn:aws:health:event-region::event/SERVICE/EVENT_TYPE_CODE/EVENT_TYPE_PLUS_ID
* format.
*
*
* For example, an event ARN might look like the following:
*
*
* arn:aws:health:us-east-1::event/EC2/EC2_INSTANCE_RETIREMENT_SCHEDULED/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456
*
*
* @return The unique identifier for the event. The event ARN has the
* arn:aws:health:event-region::event/SERVICE/EVENT_TYPE_CODE/EVENT_TYPE_PLUS_ID
* format.
*
* For example, an event ARN might look like the following:
*
*
* arn:aws:health:us-east-1::event/EC2/EC2_INSTANCE_RETIREMENT_SCHEDULED/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456
*/
public final String eventArn() {
return eventArn;
}
/**
*
* The name of the error.
*
*
* @return The name of the error.
*/
public final String errorName() {
return errorName;
}
/**
*
* A message that describes the error.
*
*
* If you call the DescribeEventDetailsForOrganization
operation and receive one of the following
* errors, follow the recommendations in the message:
*
*
* -
*
* We couldn't find a public event that matches your request. To find an event that is account specific, you must
* enter an Amazon Web Services account ID in the request.
*
*
* -
*
* We couldn't find an account specific event for the specified Amazon Web Services account. To find an event that
* is public, you must enter a null value for the Amazon Web Services account ID in the request.
*
*
* -
*
* Your Amazon Web Services account doesn't include the Amazon Web Services Support plan required to use the Health
* API. You must have either a Business, Enterprise On-Ramp, or Enterprise Support plan.
*
*
*
*
* @return A message that describes the error.
*
* If you call the DescribeEventDetailsForOrganization
operation and receive one of the
* following errors, follow the recommendations in the message:
*
*
* -
*
* We couldn't find a public event that matches your request. To find an event that is account specific, you
* must enter an Amazon Web Services account ID in the request.
*
*
* -
*
* We couldn't find an account specific event for the specified Amazon Web Services account. To find an
* event that is public, you must enter a null value for the Amazon Web Services account ID in the request.
*
*
* -
*
* Your Amazon Web Services account doesn't include the Amazon Web Services Support plan required to use the
* Health API. You must have either a Business, Enterprise On-Ramp, or Enterprise Support plan.
*
*
*/
public final String errorMessage() {
return errorMessage;
}
@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(awsAccountId());
hashCode = 31 * hashCode + Objects.hashCode(eventArn());
hashCode = 31 * hashCode + Objects.hashCode(errorName());
hashCode = 31 * hashCode + Objects.hashCode(errorMessage());
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 OrganizationEventDetailsErrorItem)) {
return false;
}
OrganizationEventDetailsErrorItem other = (OrganizationEventDetailsErrorItem) obj;
return Objects.equals(awsAccountId(), other.awsAccountId()) && Objects.equals(eventArn(), other.eventArn())
&& Objects.equals(errorName(), other.errorName()) && Objects.equals(errorMessage(), other.errorMessage());
}
/**
* 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("OrganizationEventDetailsErrorItem").add("AwsAccountId", awsAccountId())
.add("EventArn", eventArn()).add("ErrorName", errorName()).add("ErrorMessage", errorMessage()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "awsAccountId":
return Optional.ofNullable(clazz.cast(awsAccountId()));
case "eventArn":
return Optional.ofNullable(clazz.cast(eventArn()));
case "errorName":
return Optional.ofNullable(clazz.cast(errorName()));
case "errorMessage":
return Optional.ofNullable(clazz.cast(errorMessage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function