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

software.amazon.awssdk.services.servicediscovery.model.InstanceSummary 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.servicediscovery.model;

import java.beans.Transient;
import java.io.Serializable;
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.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* A complex type that contains information about the instances that you registered by using a specified service. *

*/ @Generated("software.amazon.awssdk:codegen") public final class InstanceSummary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id") .getter(getter(InstanceSummary::id)).setter(setter(Builder::id)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build(); private static final SdkField> ATTRIBUTES_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("Attributes") .getter(getter(InstanceSummary::attributes)) .setter(setter(Builder::attributes)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Attributes").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(ID_FIELD, ATTRIBUTES_FIELD)); private static final long serialVersionUID = 1L; private final String id; private final Map attributes; private InstanceSummary(BuilderImpl builder) { this.id = builder.id; this.attributes = builder.attributes; } /** *

* The ID for an instance that you created by using a specified service. *

* * @return The ID for an instance that you created by using a specified service. */ public final String id() { return id; } /** * For responses, this returns true if the service returned a value for the Attributes property. This DOES NOT check * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is * useful because the SDK will never return a null collection or map, but you may need to differentiate between the * service returning nothing (or null) and the service returning an empty collection or map. For requests, this * returns true if a value for the property was specified in the request builder, and false if a value was not * specified. */ public final boolean hasAttributes() { return attributes != null && !(attributes instanceof SdkAutoConstructMap); } /** *

* A string map that contains the following information: *

*
    *
  • *

    * The attributes that are associated with the instance. *

    *
  • *
  • *

    * For each attribute, the applicable value. *

    *
  • *
*

* Supported attribute keys include the following: *

*
*
AWS_ALIAS_DNS_NAME
*
*

* For an alias record that routes traffic to an Elastic Load Balancing load balancer, the DNS name that's * associated with the load balancer. *

*
*
AWS_EC2_INSTANCE_ID (HTTP namespaces only)
*
*

* The Amazon EC2 instance ID for the instance. When the AWS_EC2_INSTANCE_ID attribute is specified, * then the AWS_INSTANCE_IPV4 attribute contains the primary private IPv4 address. *

*
*
AWS_INIT_HEALTH_STATUS
*
*

* If the service configuration includes HealthCheckCustomConfig, you can optionally use * AWS_INIT_HEALTH_STATUS to specify the initial status of the custom health check, * HEALTHY or UNHEALTHY. If you don't specify a value for * AWS_INIT_HEALTH_STATUS, the initial status is HEALTHY. *

*
*
AWS_INSTANCE_CNAME
*
*

* For a CNAME record, the domain name that Route 53 returns in response to DNS queries (for example, * example.com). *

*
*
AWS_INSTANCE_IPV4
*
*

* For an A record, the IPv4 address that Route 53 returns in response to DNS queries (for example, * 192.0.2.44). *

*
*
AWS_INSTANCE_IPV6
*
*

* For an AAAA record, the IPv6 address that Route 53 returns in response to DNS queries (for example, * 2001:0db8:85a3:0000:0000:abcd:0001:2345). *

*
*
AWS_INSTANCE_PORT
*
*

* For an SRV record, the value that Route 53 returns for the port. In addition, if the service * includes HealthCheckConfig, the port on the endpoint that Route 53 sends requests to. *

*
*
*

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

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasAttributes} method. *

* * @return A string map that contains the following information:

*
    *
  • *

    * The attributes that are associated with the instance. *

    *
  • *
  • *

    * For each attribute, the applicable value. *

    *
  • *
*

* Supported attribute keys include the following: *

*
*
AWS_ALIAS_DNS_NAME
*
*

* For an alias record that routes traffic to an Elastic Load Balancing load balancer, the DNS name that's * associated with the load balancer. *

*
*
AWS_EC2_INSTANCE_ID (HTTP namespaces only)
*
*

* The Amazon EC2 instance ID for the instance. When the AWS_EC2_INSTANCE_ID attribute is * specified, then the AWS_INSTANCE_IPV4 attribute contains the primary private IPv4 address. *

*
*
AWS_INIT_HEALTH_STATUS
*
*

* If the service configuration includes HealthCheckCustomConfig, you can optionally use * AWS_INIT_HEALTH_STATUS to specify the initial status of the custom health check, * HEALTHY or UNHEALTHY. If you don't specify a value for * AWS_INIT_HEALTH_STATUS, the initial status is HEALTHY. *

*
*
AWS_INSTANCE_CNAME
*
*

* For a CNAME record, the domain name that Route 53 returns in response to DNS queries (for * example, example.com). *

*
*
AWS_INSTANCE_IPV4
*
*

* For an A record, the IPv4 address that Route 53 returns in response to DNS queries (for * example, 192.0.2.44). *

*
*
AWS_INSTANCE_IPV6
*
*

* For an AAAA record, the IPv6 address that Route 53 returns in response to DNS queries (for * example, 2001:0db8:85a3:0000:0000:abcd:0001:2345). *

*
*
AWS_INSTANCE_PORT
*
*

* For an SRV record, the value that Route 53 returns for the port. In addition, if the service * includes HealthCheckConfig, the port on the endpoint that Route 53 sends requests to. *

*
*/ public final Map attributes() { return attributes; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(id()); hashCode = 31 * hashCode + Objects.hashCode(hasAttributes() ? attributes() : null); 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 InstanceSummary)) { return false; } InstanceSummary other = (InstanceSummary) obj; return Objects.equals(id(), other.id()) && hasAttributes() == other.hasAttributes() && Objects.equals(attributes(), other.attributes()); } /** * 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("InstanceSummary").add("Id", id()).add("Attributes", hasAttributes() ? attributes() : null) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Id": return Optional.ofNullable(clazz.cast(id())); case "Attributes": return Optional.ofNullable(clazz.cast(attributes())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((InstanceSummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID for an instance that you created by using a specified service. *

* * @param id * The ID for an instance that you created by using a specified service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String id); /** *

* A string map that contains the following information: *

*
    *
  • *

    * The attributes that are associated with the instance. *

    *
  • *
  • *

    * For each attribute, the applicable value. *

    *
  • *
*

* Supported attribute keys include the following: *

*
*
AWS_ALIAS_DNS_NAME
*
*

* For an alias record that routes traffic to an Elastic Load Balancing load balancer, the DNS name that's * associated with the load balancer. *

*
*
AWS_EC2_INSTANCE_ID (HTTP namespaces only)
*
*

* The Amazon EC2 instance ID for the instance. When the AWS_EC2_INSTANCE_ID attribute is * specified, then the AWS_INSTANCE_IPV4 attribute contains the primary private IPv4 address. *

*
*
AWS_INIT_HEALTH_STATUS
*
*

* If the service configuration includes HealthCheckCustomConfig, you can optionally use * AWS_INIT_HEALTH_STATUS to specify the initial status of the custom health check, * HEALTHY or UNHEALTHY. If you don't specify a value for * AWS_INIT_HEALTH_STATUS, the initial status is HEALTHY. *

*
*
AWS_INSTANCE_CNAME
*
*

* For a CNAME record, the domain name that Route 53 returns in response to DNS queries (for * example, example.com). *

*
*
AWS_INSTANCE_IPV4
*
*

* For an A record, the IPv4 address that Route 53 returns in response to DNS queries (for example, * 192.0.2.44). *

*
*
AWS_INSTANCE_IPV6
*
*

* For an AAAA record, the IPv6 address that Route 53 returns in response to DNS queries (for * example, 2001:0db8:85a3:0000:0000:abcd:0001:2345). *

*
*
AWS_INSTANCE_PORT
*
*

* For an SRV record, the value that Route 53 returns for the port. In addition, if the service * includes HealthCheckConfig, the port on the endpoint that Route 53 sends requests to. *

*
*
* * @param attributes * A string map that contains the following information:

*
    *
  • *

    * The attributes that are associated with the instance. *

    *
  • *
  • *

    * For each attribute, the applicable value. *

    *
  • *
*

* Supported attribute keys include the following: *

*
*
AWS_ALIAS_DNS_NAME
*
*

* For an alias record that routes traffic to an Elastic Load Balancing load balancer, the DNS name * that's associated with the load balancer. *

*
*
AWS_EC2_INSTANCE_ID (HTTP namespaces only)
*
*

* The Amazon EC2 instance ID for the instance. When the AWS_EC2_INSTANCE_ID attribute is * specified, then the AWS_INSTANCE_IPV4 attribute contains the primary private IPv4 * address. *

*
*
AWS_INIT_HEALTH_STATUS
*
*

* If the service configuration includes HealthCheckCustomConfig, you can optionally use * AWS_INIT_HEALTH_STATUS to specify the initial status of the custom health check, * HEALTHY or UNHEALTHY. If you don't specify a value for * AWS_INIT_HEALTH_STATUS, the initial status is HEALTHY. *

*
*
AWS_INSTANCE_CNAME
*
*

* For a CNAME record, the domain name that Route 53 returns in response to DNS queries (for * example, example.com). *

*
*
AWS_INSTANCE_IPV4
*
*

* For an A record, the IPv4 address that Route 53 returns in response to DNS queries (for * example, 192.0.2.44). *

*
*
AWS_INSTANCE_IPV6
*
*

* For an AAAA record, the IPv6 address that Route 53 returns in response to DNS queries * (for example, 2001:0db8:85a3:0000:0000:abcd:0001:2345). *

*
*
AWS_INSTANCE_PORT
*
*

* For an SRV record, the value that Route 53 returns for the port. In addition, if the * service includes HealthCheckConfig, the port on the endpoint that Route 53 sends requests * to. *

*
* @return Returns a reference to this object so that method calls can be chained together. */ Builder attributes(Map attributes); } static final class BuilderImpl implements Builder { private String id; private Map attributes = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(InstanceSummary model) { id(model.id); attributes(model.attributes); } public final String getId() { return id; } public final void setId(String id) { this.id = id; } @Override @Transient public final Builder id(String id) { this.id = id; return this; } public final Map getAttributes() { if (attributes instanceof SdkAutoConstructMap) { return null; } return attributes; } public final void setAttributes(Map attributes) { this.attributes = AttributesCopier.copy(attributes); } @Override @Transient public final Builder attributes(Map attributes) { this.attributes = AttributesCopier.copy(attributes); return this; } @Override public InstanceSummary build() { return new InstanceSummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy