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

software.amazon.awssdk.services.servicediscovery.model.ServiceChange Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Route 53 Auto Naming module holds the client classes that are used for communicating with Amazon Route 53 Auto Naming Service

The newest version!
/*
 * 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.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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.Consumer;
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;

/**
 * 

* A complex type that contains changes to an existing service. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ServiceChange implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Description").getter(getter(ServiceChange::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build(); private static final SdkField DNS_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("DnsConfig").getter(getter(ServiceChange::dnsConfig)) .setter(setter(Builder::dnsConfig)).constructor(DnsConfigChange::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DnsConfig").build()).build(); private static final SdkField HEALTH_CHECK_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("HealthCheckConfig") .getter(getter(ServiceChange::healthCheckConfig)).setter(setter(Builder::healthCheckConfig)) .constructor(HealthCheckConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HealthCheckConfig").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DESCRIPTION_FIELD, DNS_CONFIG_FIELD, HEALTH_CHECK_CONFIG_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String description; private final DnsConfigChange dnsConfig; private final HealthCheckConfig healthCheckConfig; private ServiceChange(BuilderImpl builder) { this.description = builder.description; this.dnsConfig = builder.dnsConfig; this.healthCheckConfig = builder.healthCheckConfig; } /** *

* A description for the service. *

* * @return A description for the service. */ public final String description() { return description; } /** *

* Information about the Route 53 DNS records that you want Cloud Map to create when you register an instance. *

* * @return Information about the Route 53 DNS records that you want Cloud Map to create when you register an * instance. */ public final DnsConfigChange dnsConfig() { return dnsConfig; } /** *

* Public DNS and HTTP namespaces only. Settings for an optional health check. If you specify settings for a * health check, Cloud Map associates the health check with the records that you specify in DnsConfig. *

* * @return Public DNS and HTTP namespaces only. Settings for an optional health check. If you specify * settings for a health check, Cloud Map associates the health check with the records that you specify in * DnsConfig. */ public final HealthCheckConfig healthCheckConfig() { return healthCheckConfig; } @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(description()); hashCode = 31 * hashCode + Objects.hashCode(dnsConfig()); hashCode = 31 * hashCode + Objects.hashCode(healthCheckConfig()); 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 ServiceChange)) { return false; } ServiceChange other = (ServiceChange) obj; return Objects.equals(description(), other.description()) && Objects.equals(dnsConfig(), other.dnsConfig()) && Objects.equals(healthCheckConfig(), other.healthCheckConfig()); } /** * 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("ServiceChange").add("Description", description()).add("DnsConfig", dnsConfig()) .add("HealthCheckConfig", healthCheckConfig()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Description": return Optional.ofNullable(clazz.cast(description())); case "DnsConfig": return Optional.ofNullable(clazz.cast(dnsConfig())); case "HealthCheckConfig": return Optional.ofNullable(clazz.cast(healthCheckConfig())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("Description", DESCRIPTION_FIELD); map.put("DnsConfig", DNS_CONFIG_FIELD); map.put("HealthCheckConfig", HEALTH_CHECK_CONFIG_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((ServiceChange) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* A description for the service. *

* * @param description * A description for the service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* Information about the Route 53 DNS records that you want Cloud Map to create when you register an instance. *

* * @param dnsConfig * Information about the Route 53 DNS records that you want Cloud Map to create when you register an * instance. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dnsConfig(DnsConfigChange dnsConfig); /** *

* Information about the Route 53 DNS records that you want Cloud Map to create when you register an instance. *

* This is a convenience method that creates an instance of the {@link DnsConfigChange.Builder} avoiding the * need to create one manually via {@link DnsConfigChange#builder()}. * *

* When the {@link Consumer} completes, {@link DnsConfigChange.Builder#build()} is called immediately and its * result is passed to {@link #dnsConfig(DnsConfigChange)}. * * @param dnsConfig * a consumer that will call methods on {@link DnsConfigChange.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #dnsConfig(DnsConfigChange) */ default Builder dnsConfig(Consumer dnsConfig) { return dnsConfig(DnsConfigChange.builder().applyMutation(dnsConfig).build()); } /** *

* Public DNS and HTTP namespaces only. Settings for an optional health check. If you specify settings * for a health check, Cloud Map associates the health check with the records that you specify in * DnsConfig. *

* * @param healthCheckConfig * Public DNS and HTTP namespaces only. Settings for an optional health check. If you specify * settings for a health check, Cloud Map associates the health check with the records that you specify * in DnsConfig. * @return Returns a reference to this object so that method calls can be chained together. */ Builder healthCheckConfig(HealthCheckConfig healthCheckConfig); /** *

* Public DNS and HTTP namespaces only. Settings for an optional health check. If you specify settings * for a health check, Cloud Map associates the health check with the records that you specify in * DnsConfig. *

* This is a convenience method that creates an instance of the {@link HealthCheckConfig.Builder} avoiding the * need to create one manually via {@link HealthCheckConfig#builder()}. * *

* When the {@link Consumer} completes, {@link HealthCheckConfig.Builder#build()} is called immediately and its * result is passed to {@link #healthCheckConfig(HealthCheckConfig)}. * * @param healthCheckConfig * a consumer that will call methods on {@link HealthCheckConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #healthCheckConfig(HealthCheckConfig) */ default Builder healthCheckConfig(Consumer healthCheckConfig) { return healthCheckConfig(HealthCheckConfig.builder().applyMutation(healthCheckConfig).build()); } } static final class BuilderImpl implements Builder { private String description; private DnsConfigChange dnsConfig; private HealthCheckConfig healthCheckConfig; private BuilderImpl() { } private BuilderImpl(ServiceChange model) { description(model.description); dnsConfig(model.dnsConfig); healthCheckConfig(model.healthCheckConfig); } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final DnsConfigChange.Builder getDnsConfig() { return dnsConfig != null ? dnsConfig.toBuilder() : null; } public final void setDnsConfig(DnsConfigChange.BuilderImpl dnsConfig) { this.dnsConfig = dnsConfig != null ? dnsConfig.build() : null; } @Override public final Builder dnsConfig(DnsConfigChange dnsConfig) { this.dnsConfig = dnsConfig; return this; } public final HealthCheckConfig.Builder getHealthCheckConfig() { return healthCheckConfig != null ? healthCheckConfig.toBuilder() : null; } public final void setHealthCheckConfig(HealthCheckConfig.BuilderImpl healthCheckConfig) { this.healthCheckConfig = healthCheckConfig != null ? healthCheckConfig.build() : null; } @Override public final Builder healthCheckConfig(HealthCheckConfig healthCheckConfig) { this.healthCheckConfig = healthCheckConfig; return this; } @Override public ServiceChange build() { return new ServiceChange(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy