All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.health.model.AffectedEntity Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Health APIs and Notifications module holds the client classes that are used for communicating with AWS Health APIs and Notifications service.

There is a newer version: 2.28.3
Show newest version
/*
 * Copyright 2014-2019 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.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Information about an entity that is affected by a Health event. *

*/ @Generated("software.amazon.awssdk:codegen") public final class AffectedEntity implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ENTITY_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AffectedEntity::entityArn)).setter(setter(Builder::entityArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("entityArn").build()).build(); private static final SdkField EVENT_ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AffectedEntity::eventArn)).setter(setter(Builder::eventArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("eventArn").build()).build(); private static final SdkField ENTITY_VALUE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AffectedEntity::entityValue)).setter(setter(Builder::entityValue)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("entityValue").build()).build(); private static final SdkField ENTITY_URL_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AffectedEntity::entityUrl)).setter(setter(Builder::entityUrl)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("entityUrl").build()).build(); private static final SdkField AWS_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AffectedEntity::awsAccountId)).setter(setter(Builder::awsAccountId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("awsAccountId").build()).build(); private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .getter(getter(AffectedEntity::lastUpdatedTime)).setter(setter(Builder::lastUpdatedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedTime").build()).build(); private static final SdkField STATUS_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(AffectedEntity::statusCodeAsString)).setter(setter(Builder::statusCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("statusCode").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.MAP) .getter(getter(AffectedEntity::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENTITY_ARN_FIELD, EVENT_ARN_FIELD, ENTITY_VALUE_FIELD, ENTITY_URL_FIELD, AWS_ACCOUNT_ID_FIELD, LAST_UPDATED_TIME_FIELD, STATUS_CODE_FIELD, TAGS_FIELD)); private static final long serialVersionUID = 1L; private final String entityArn; private final String eventArn; private final String entityValue; private final String entityUrl; private final String awsAccountId; private final Instant lastUpdatedTime; private final String statusCodeValue; private final Map tags; private AffectedEntity(BuilderImpl builder) { this.entityArn = builder.entityArn; this.eventArn = builder.eventArn; this.entityValue = builder.entityValue; this.entityUrl = builder.entityUrl; this.awsAccountId = builder.awsAccountId; this.lastUpdatedTime = builder.lastUpdatedTime; this.statusCodeValue = builder.statusCodeValue; this.tags = builder.tags; } /** *

* The unique identifier for the entity. Format: * arn:aws:health:entity-region:aws-account:entity/entity-id . Example: * arn:aws:health:us-east-1:111222333444:entity/AVh5GGT7ul1arKr1sE1K *

* * @return The unique identifier for the entity. Format: * arn:aws:health:entity-region:aws-account:entity/entity-id . Example: * arn:aws:health:us-east-1:111222333444:entity/AVh5GGT7ul1arKr1sE1K */ public String entityArn() { return entityArn; } /** *

* The unique identifier for the event. Format: * arn:aws:health:event-region::event/SERVICE/EVENT_TYPE_CODE/EVENT_TYPE_PLUS_ID * . Example: * Example: 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. Format: * arn:aws:health:event-region::event/SERVICE/EVENT_TYPE_CODE/EVENT_TYPE_PLUS_ID * . Example: * Example: arn:aws:health:us-east-1::event/EC2/EC2_INSTANCE_RETIREMENT_SCHEDULED/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456 */ public String eventArn() { return eventArn; } /** *

* The ID of the affected entity. *

* * @return The ID of the affected entity. */ public String entityValue() { return entityValue; } /** * Returns the value of the EntityUrl property for this object. * * @return The value of the EntityUrl property for this object. */ public String entityUrl() { return entityUrl; } /** *

* The 12-digit AWS account number that contains the affected entity. *

* * @return The 12-digit AWS account number that contains the affected entity. */ public String awsAccountId() { return awsAccountId; } /** *

* The most recent time that the entity was updated. *

* * @return The most recent time that the entity was updated. */ public Instant lastUpdatedTime() { return lastUpdatedTime; } /** *

* The most recent status of the entity affected by the event. The possible values are IMPAIRED, * UNIMPAIRED, and UNKNOWN. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #statusCode} will * return {@link EntityStatusCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusCodeAsString}. *

* * @return The most recent status of the entity affected by the event. The possible values are IMPAIRED * , UNIMPAIRED, and UNKNOWN. * @see EntityStatusCode */ public EntityStatusCode statusCode() { return EntityStatusCode.fromValue(statusCodeValue); } /** *

* The most recent status of the entity affected by the event. The possible values are IMPAIRED, * UNIMPAIRED, and UNKNOWN. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #statusCode} will * return {@link EntityStatusCode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusCodeAsString}. *

* * @return The most recent status of the entity affected by the event. The possible values are IMPAIRED * , UNIMPAIRED, and UNKNOWN. * @see EntityStatusCode */ public String statusCodeAsString() { return statusCodeValue; } /** *

* A map of entity tags attached to the affected entity. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

* * @return A map of entity tags attached to the affected entity. */ public Map tags() { return tags; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(entityArn()); hashCode = 31 * hashCode + Objects.hashCode(eventArn()); hashCode = 31 * hashCode + Objects.hashCode(entityValue()); hashCode = 31 * hashCode + Objects.hashCode(entityUrl()); hashCode = 31 * hashCode + Objects.hashCode(awsAccountId()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime()); hashCode = 31 * hashCode + Objects.hashCode(statusCodeAsString()); hashCode = 31 * hashCode + Objects.hashCode(tags()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof AffectedEntity)) { return false; } AffectedEntity other = (AffectedEntity) obj; return Objects.equals(entityArn(), other.entityArn()) && Objects.equals(eventArn(), other.eventArn()) && Objects.equals(entityValue(), other.entityValue()) && Objects.equals(entityUrl(), other.entityUrl()) && Objects.equals(awsAccountId(), other.awsAccountId()) && Objects.equals(lastUpdatedTime(), other.lastUpdatedTime()) && Objects.equals(statusCodeAsString(), other.statusCodeAsString()) && Objects.equals(tags(), other.tags()); } /** * 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 String toString() { return ToString.builder("AffectedEntity").add("EntityArn", entityArn()).add("EventArn", eventArn()) .add("EntityValue", entityValue()).add("EntityUrl", entityUrl()).add("AwsAccountId", awsAccountId()) .add("LastUpdatedTime", lastUpdatedTime()).add("StatusCode", statusCodeAsString()).add("Tags", tags()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "entityArn": return Optional.ofNullable(clazz.cast(entityArn())); case "eventArn": return Optional.ofNullable(clazz.cast(eventArn())); case "entityValue": return Optional.ofNullable(clazz.cast(entityValue())); case "entityUrl": return Optional.ofNullable(clazz.cast(entityUrl())); case "awsAccountId": return Optional.ofNullable(clazz.cast(awsAccountId())); case "lastUpdatedTime": return Optional.ofNullable(clazz.cast(lastUpdatedTime())); case "statusCode": return Optional.ofNullable(clazz.cast(statusCodeAsString())); case "tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((AffectedEntity) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The unique identifier for the entity. Format: * arn:aws:health:entity-region:aws-account:entity/entity-id . Example: * arn:aws:health:us-east-1:111222333444:entity/AVh5GGT7ul1arKr1sE1K *

* * @param entityArn * The unique identifier for the entity. Format: * arn:aws:health:entity-region:aws-account:entity/entity-id . Example: * arn:aws:health:us-east-1:111222333444:entity/AVh5GGT7ul1arKr1sE1K * @return Returns a reference to this object so that method calls can be chained together. */ Builder entityArn(String entityArn); /** *

* The unique identifier for the event. Format: * arn:aws:health:event-region::event/SERVICE/EVENT_TYPE_CODE/EVENT_TYPE_PLUS_ID * . Example: * Example: arn:aws:health:us-east-1::event/EC2/EC2_INSTANCE_RETIREMENT_SCHEDULED/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456 *

* * @param eventArn * The unique identifier for the event. Format: * arn:aws:health:event-region::event/SERVICE/EVENT_TYPE_CODE/EVENT_TYPE_PLUS_ID * . Example: * Example: arn:aws:health:us-east-1::event/EC2/EC2_INSTANCE_RETIREMENT_SCHEDULED/EC2_INSTANCE_RETIREMENT_SCHEDULED_ABC123-DEF456 * @return Returns a reference to this object so that method calls can be chained together. */ Builder eventArn(String eventArn); /** *

* The ID of the affected entity. *

* * @param entityValue * The ID of the affected entity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder entityValue(String entityValue); /** * Sets the value of the EntityUrl property for this object. * * @param entityUrl * The new value for the EntityUrl property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder entityUrl(String entityUrl); /** *

* The 12-digit AWS account number that contains the affected entity. *

* * @param awsAccountId * The 12-digit AWS account number that contains the affected entity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder awsAccountId(String awsAccountId); /** *

* The most recent time that the entity was updated. *

* * @param lastUpdatedTime * The most recent time that the entity was updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedTime(Instant lastUpdatedTime); /** *

* The most recent status of the entity affected by the event. The possible values are IMPAIRED, * UNIMPAIRED, and UNKNOWN. *

* * @param statusCodeValue * The most recent status of the entity affected by the event. The possible values are * IMPAIRED, UNIMPAIRED, and UNKNOWN. * @see EntityStatusCode * @return Returns a reference to this object so that method calls can be chained together. * @see EntityStatusCode */ Builder statusCode(String statusCodeValue); /** *

* The most recent status of the entity affected by the event. The possible values are IMPAIRED, * UNIMPAIRED, and UNKNOWN. *

* * @param statusCodeValue * The most recent status of the entity affected by the event. The possible values are * IMPAIRED, UNIMPAIRED, and UNKNOWN. * @see EntityStatusCode * @return Returns a reference to this object so that method calls can be chained together. * @see EntityStatusCode */ Builder statusCode(EntityStatusCode statusCodeValue); /** *

* A map of entity tags attached to the affected entity. *

* * @param tags * A map of entity tags attached to the affected entity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); } static final class BuilderImpl implements Builder { private String entityArn; private String eventArn; private String entityValue; private String entityUrl; private String awsAccountId; private Instant lastUpdatedTime; private String statusCodeValue; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(AffectedEntity model) { entityArn(model.entityArn); eventArn(model.eventArn); entityValue(model.entityValue); entityUrl(model.entityUrl); awsAccountId(model.awsAccountId); lastUpdatedTime(model.lastUpdatedTime); statusCode(model.statusCodeValue); tags(model.tags); } public final String getEntityArn() { return entityArn; } @Override public final Builder entityArn(String entityArn) { this.entityArn = entityArn; return this; } public final void setEntityArn(String entityArn) { this.entityArn = entityArn; } public final String getEventArn() { return eventArn; } @Override public final Builder eventArn(String eventArn) { this.eventArn = eventArn; return this; } public final void setEventArn(String eventArn) { this.eventArn = eventArn; } public final String getEntityValue() { return entityValue; } @Override public final Builder entityValue(String entityValue) { this.entityValue = entityValue; return this; } public final void setEntityValue(String entityValue) { this.entityValue = entityValue; } public final String getEntityUrl() { return entityUrl; } @Override public final Builder entityUrl(String entityUrl) { this.entityUrl = entityUrl; return this; } public final void setEntityUrl(String entityUrl) { this.entityUrl = entityUrl; } public final String getAwsAccountId() { return awsAccountId; } @Override public final Builder awsAccountId(String awsAccountId) { this.awsAccountId = awsAccountId; return this; } public final void setAwsAccountId(String awsAccountId) { this.awsAccountId = awsAccountId; } public final Instant getLastUpdatedTime() { return lastUpdatedTime; } @Override public final Builder lastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; return this; } public final void setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } public final String getStatusCodeAsString() { return statusCodeValue; } @Override public final Builder statusCode(String statusCodeValue) { this.statusCodeValue = statusCodeValue; return this; } @Override public final Builder statusCode(EntityStatusCode statusCodeValue) { this.statusCode(statusCodeValue.toString()); return this; } public final void setStatusCode(String statusCodeValue) { this.statusCodeValue = statusCodeValue; } public final Map getTags() { return tags; } @Override public final Builder tags(Map tags) { this.tags = _tagSetCopier.copy(tags); return this; } public final void setTags(Map tags) { this.tags = _tagSetCopier.copy(tags); } @Override public AffectedEntity build() { return new AffectedEntity(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy