software.amazon.awssdk.services.apigateway.model.BasePathMapping Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apigateway Show documentation
Show all versions of apigateway Show documentation
The AWS Java SDK for Amazon API Gateway module holds the client classes that are used for communicating
with Amazon API
Gateway
/*
* 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.apigateway.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;
/**
*
* Represents the base path that callers of the API must provide as part of the URL after the domain name.
*
* A custom domain name plus a BasePathMapping
specification identifies a deployed
* RestApi in a given stage of the owner Account.
*/
@Generated("software.amazon.awssdk:codegen")
public final class BasePathMapping implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BASE_PATH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("basePath").getter(getter(BasePathMapping::basePath)).setter(setter(Builder::basePath))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("basePath").build()).build();
private static final SdkField REST_API_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("restApiId").getter(getter(BasePathMapping::restApiId)).setter(setter(Builder::restApiId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("restApiId").build()).build();
private static final SdkField STAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("stage")
.getter(getter(BasePathMapping::stage)).setter(setter(Builder::stage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stage").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BASE_PATH_FIELD,
REST_API_ID_FIELD, STAGE_FIELD));
private static final long serialVersionUID = 1L;
private final String basePath;
private final String restApiId;
private final String stage;
private BasePathMapping(BuilderImpl builder) {
this.basePath = builder.basePath;
this.restApiId = builder.restApiId;
this.stage = builder.stage;
}
/**
*
* The base path name that callers of the API must provide as part of the URL after the domain name.
*
*
* @return The base path name that callers of the API must provide as part of the URL after the domain name.
*/
public final String basePath() {
return basePath;
}
/**
*
* The string identifier of the associated RestApi.
*
*
* @return The string identifier of the associated RestApi.
*/
public final String restApiId() {
return restApiId;
}
/**
*
* The name of the associated stage.
*
*
* @return The name of the associated stage.
*/
public final String stage() {
return stage;
}
@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(basePath());
hashCode = 31 * hashCode + Objects.hashCode(restApiId());
hashCode = 31 * hashCode + Objects.hashCode(stage());
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 BasePathMapping)) {
return false;
}
BasePathMapping other = (BasePathMapping) obj;
return Objects.equals(basePath(), other.basePath()) && Objects.equals(restApiId(), other.restApiId())
&& Objects.equals(stage(), other.stage());
}
/**
* 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("BasePathMapping").add("BasePath", basePath()).add("RestApiId", restApiId())
.add("Stage", stage()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "basePath":
return Optional.ofNullable(clazz.cast(basePath()));
case "restApiId":
return Optional.ofNullable(clazz.cast(restApiId()));
case "stage":
return Optional.ofNullable(clazz.cast(stage()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function