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

software.amazon.awssdk.services.migrationhubrefactorspaces.model.UriPathRouteInput Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Migration Hub Refactor Spaces module holds the client classes that are used for communicating with Migration Hub Refactor Spaces.

There is a newer version: 2.29.15
Show 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.migrationhubrefactorspaces.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The configuration for the URI path route type. *

*/ @Generated("software.amazon.awssdk:codegen") public final class UriPathRouteInput implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACTIVATION_STATE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ActivationState").getter(getter(UriPathRouteInput::activationStateAsString)) .setter(setter(Builder::activationState)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActivationState").build()).build(); private static final SdkField APPEND_SOURCE_PATH_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("AppendSourcePath").getter(getter(UriPathRouteInput::appendSourcePath)) .setter(setter(Builder::appendSourcePath)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AppendSourcePath").build()).build(); private static final SdkField INCLUDE_CHILD_PATHS_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("IncludeChildPaths").getter(getter(UriPathRouteInput::includeChildPaths)) .setter(setter(Builder::includeChildPaths)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IncludeChildPaths").build()).build(); private static final SdkField> METHODS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Methods") .getter(getter(UriPathRouteInput::methodsAsStrings)) .setter(setter(Builder::methodsWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Methods").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField SOURCE_PATH_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("SourcePath").getter(getter(UriPathRouteInput::sourcePath)).setter(setter(Builder::sourcePath)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourcePath").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTIVATION_STATE_FIELD, APPEND_SOURCE_PATH_FIELD, INCLUDE_CHILD_PATHS_FIELD, METHODS_FIELD, SOURCE_PATH_FIELD)); private static final Map> SDK_NAME_TO_FIELD = Collections .unmodifiableMap(new HashMap>() { { put("ActivationState", ACTIVATION_STATE_FIELD); put("AppendSourcePath", APPEND_SOURCE_PATH_FIELD); put("IncludeChildPaths", INCLUDE_CHILD_PATHS_FIELD); put("Methods", METHODS_FIELD); put("SourcePath", SOURCE_PATH_FIELD); } }); private static final long serialVersionUID = 1L; private final String activationState; private final Boolean appendSourcePath; private final Boolean includeChildPaths; private final List methods; private final String sourcePath; private UriPathRouteInput(BuilderImpl builder) { this.activationState = builder.activationState; this.appendSourcePath = builder.appendSourcePath; this.includeChildPaths = builder.includeChildPaths; this.methods = builder.methods; this.sourcePath = builder.sourcePath; } /** *

* If set to ACTIVE, traffic is forwarded to this route’s service after the route is created. *

*

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

* * @return If set to ACTIVE, traffic is forwarded to this route’s service after the route is created. * @see RouteActivationState */ public final RouteActivationState activationState() { return RouteActivationState.fromValue(activationState); } /** *

* If set to ACTIVE, traffic is forwarded to this route’s service after the route is created. *

*

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

* * @return If set to ACTIVE, traffic is forwarded to this route’s service after the route is created. * @see RouteActivationState */ public final String activationStateAsString() { return activationState; } /** *

* If set to true, this option appends the source path to the service URL endpoint. *

* * @return If set to true, this option appends the source path to the service URL endpoint. */ public final Boolean appendSourcePath() { return appendSourcePath; } /** *

* Indicates whether to match all subpaths of the given source path. If this value is false, requests * must match the source path exactly before they are forwarded to this route's service. *

* * @return Indicates whether to match all subpaths of the given source path. If this value is false, * requests must match the source path exactly before they are forwarded to this route's service. */ public final Boolean includeChildPaths() { return includeChildPaths; } /** *

* A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP requests * using that method are forwarded to this route’s service. *

*

* 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 #hasMethods} method. *

* * @return A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP * requests using that method are forwarded to this route’s service. */ public final List methods() { return HttpMethodsCopier.copyStringToEnum(methods); } /** * For responses, this returns true if the service returned a value for the Methods 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 hasMethods() { return methods != null && !(methods instanceof SdkAutoConstructList); } /** *

* A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP requests * using that method are forwarded to this route’s service. *

*

* 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 #hasMethods} method. *

* * @return A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP * requests using that method are forwarded to this route’s service. */ public final List methodsAsStrings() { return methods; } /** *

* This is the path that Refactor Spaces uses to match traffic. Paths must start with / and are * relative to the base of the application. To use path parameters in the source path, add a variable in curly * braces. For example, the resource path {user} represents a path parameter called 'user'. *

* * @return This is the path that Refactor Spaces uses to match traffic. Paths must start with / and are * relative to the base of the application. To use path parameters in the source path, add a variable in * curly braces. For example, the resource path {user} represents a path parameter called 'user'. */ public final String sourcePath() { return sourcePath; } @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(activationStateAsString()); hashCode = 31 * hashCode + Objects.hashCode(appendSourcePath()); hashCode = 31 * hashCode + Objects.hashCode(includeChildPaths()); hashCode = 31 * hashCode + Objects.hashCode(hasMethods() ? methodsAsStrings() : null); hashCode = 31 * hashCode + Objects.hashCode(sourcePath()); 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 UriPathRouteInput)) { return false; } UriPathRouteInput other = (UriPathRouteInput) obj; return Objects.equals(activationStateAsString(), other.activationStateAsString()) && Objects.equals(appendSourcePath(), other.appendSourcePath()) && Objects.equals(includeChildPaths(), other.includeChildPaths()) && hasMethods() == other.hasMethods() && Objects.equals(methodsAsStrings(), other.methodsAsStrings()) && Objects.equals(sourcePath(), other.sourcePath()); } /** * 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("UriPathRouteInput").add("ActivationState", activationStateAsString()) .add("AppendSourcePath", appendSourcePath()).add("IncludeChildPaths", includeChildPaths()) .add("Methods", hasMethods() ? methodsAsStrings() : null).add("SourcePath", sourcePath()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ActivationState": return Optional.ofNullable(clazz.cast(activationStateAsString())); case "AppendSourcePath": return Optional.ofNullable(clazz.cast(appendSourcePath())); case "IncludeChildPaths": return Optional.ofNullable(clazz.cast(includeChildPaths())); case "Methods": return Optional.ofNullable(clazz.cast(methodsAsStrings())); case "SourcePath": return Optional.ofNullable(clazz.cast(sourcePath())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Function getter(Function g) { return obj -> g.apply((UriPathRouteInput) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* If set to ACTIVE, traffic is forwarded to this route’s service after the route is created. *

* * @param activationState * If set to ACTIVE, traffic is forwarded to this route’s service after the route is * created. * @see RouteActivationState * @return Returns a reference to this object so that method calls can be chained together. * @see RouteActivationState */ Builder activationState(String activationState); /** *

* If set to ACTIVE, traffic is forwarded to this route’s service after the route is created. *

* * @param activationState * If set to ACTIVE, traffic is forwarded to this route’s service after the route is * created. * @see RouteActivationState * @return Returns a reference to this object so that method calls can be chained together. * @see RouteActivationState */ Builder activationState(RouteActivationState activationState); /** *

* If set to true, this option appends the source path to the service URL endpoint. *

* * @param appendSourcePath * If set to true, this option appends the source path to the service URL endpoint. * @return Returns a reference to this object so that method calls can be chained together. */ Builder appendSourcePath(Boolean appendSourcePath); /** *

* Indicates whether to match all subpaths of the given source path. If this value is false, * requests must match the source path exactly before they are forwarded to this route's service. *

* * @param includeChildPaths * Indicates whether to match all subpaths of the given source path. If this value is false, * requests must match the source path exactly before they are forwarded to this route's service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder includeChildPaths(Boolean includeChildPaths); /** *

* A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP requests * using that method are forwarded to this route’s service. *

* * @param methods * A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP * requests using that method are forwarded to this route’s service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder methodsWithStrings(Collection methods); /** *

* A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP requests * using that method are forwarded to this route’s service. *

* * @param methods * A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP * requests using that method are forwarded to this route’s service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder methodsWithStrings(String... methods); /** *

* A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP requests * using that method are forwarded to this route’s service. *

* * @param methods * A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP * requests using that method are forwarded to this route’s service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder methods(Collection methods); /** *

* A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP requests * using that method are forwarded to this route’s service. *

* * @param methods * A list of HTTP methods to match. An empty list matches all values. If a method is present, only HTTP * requests using that method are forwarded to this route’s service. * @return Returns a reference to this object so that method calls can be chained together. */ Builder methods(HttpMethod... methods); /** *

* This is the path that Refactor Spaces uses to match traffic. Paths must start with / and are * relative to the base of the application. To use path parameters in the source path, add a variable in curly * braces. For example, the resource path {user} represents a path parameter called 'user'. *

* * @param sourcePath * This is the path that Refactor Spaces uses to match traffic. Paths must start with / and * are relative to the base of the application. To use path parameters in the source path, add a variable * in curly braces. For example, the resource path {user} represents a path parameter called 'user'. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourcePath(String sourcePath); } static final class BuilderImpl implements Builder { private String activationState; private Boolean appendSourcePath; private Boolean includeChildPaths; private List methods = DefaultSdkAutoConstructList.getInstance(); private String sourcePath; private BuilderImpl() { } private BuilderImpl(UriPathRouteInput model) { activationState(model.activationState); appendSourcePath(model.appendSourcePath); includeChildPaths(model.includeChildPaths); methodsWithStrings(model.methods); sourcePath(model.sourcePath); } public final String getActivationState() { return activationState; } public final void setActivationState(String activationState) { this.activationState = activationState; } @Override public final Builder activationState(String activationState) { this.activationState = activationState; return this; } @Override public final Builder activationState(RouteActivationState activationState) { this.activationState(activationState == null ? null : activationState.toString()); return this; } public final Boolean getAppendSourcePath() { return appendSourcePath; } public final void setAppendSourcePath(Boolean appendSourcePath) { this.appendSourcePath = appendSourcePath; } @Override public final Builder appendSourcePath(Boolean appendSourcePath) { this.appendSourcePath = appendSourcePath; return this; } public final Boolean getIncludeChildPaths() { return includeChildPaths; } public final void setIncludeChildPaths(Boolean includeChildPaths) { this.includeChildPaths = includeChildPaths; } @Override public final Builder includeChildPaths(Boolean includeChildPaths) { this.includeChildPaths = includeChildPaths; return this; } public final Collection getMethods() { if (methods instanceof SdkAutoConstructList) { return null; } return methods; } public final void setMethods(Collection methods) { this.methods = HttpMethodsCopier.copy(methods); } @Override public final Builder methodsWithStrings(Collection methods) { this.methods = HttpMethodsCopier.copy(methods); return this; } @Override @SafeVarargs public final Builder methodsWithStrings(String... methods) { methodsWithStrings(Arrays.asList(methods)); return this; } @Override public final Builder methods(Collection methods) { this.methods = HttpMethodsCopier.copyEnumToString(methods); return this; } @Override @SafeVarargs public final Builder methods(HttpMethod... methods) { methods(Arrays.asList(methods)); return this; } public final String getSourcePath() { return sourcePath; } public final void setSourcePath(String sourcePath) { this.sourcePath = sourcePath; } @Override public final Builder sourcePath(String sourcePath) { this.sourcePath = sourcePath; return this; } @Override public UriPathRouteInput build() { return new UriPathRouteInput(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy