software.amazon.awssdk.services.apigateway.model.ApiStage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-gateway Show documentation
Show all versions of api-gateway 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 2013-2018 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.util.Objects;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.apigateway.transform.ApiStageMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* API stage name of the associated API stage in a usage plan.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class ApiStage implements StructuredPojo, ToCopyableBuilder {
private final String apiId;
private final String stage;
private ApiStage(BuilderImpl builder) {
this.apiId = builder.apiId;
this.stage = builder.stage;
}
/**
*
* API Id of the associated API stage in a usage plan.
*
*
* @return API Id of the associated API stage in a usage plan.
*/
public String apiId() {
return apiId;
}
/**
*
* API stage name of the associated API stage in a usage plan.
*
*
* @return API stage name of the associated API stage in a usage plan.
*/
public String stage() {
return stage;
}
@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(apiId());
hashCode = 31 * hashCode + Objects.hashCode(stage());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ApiStage)) {
return false;
}
ApiStage other = (ApiStage) obj;
return Objects.equals(apiId(), other.apiId()) && Objects.equals(stage(), other.stage());
}
@Override
public String toString() {
return ToString.builder("ApiStage").add("ApiId", apiId()).add("Stage", stage()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "apiId":
return Optional.of(clazz.cast(apiId()));
case "stage":
return Optional.of(clazz.cast(stage()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
ApiStageMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* API Id of the associated API stage in a usage plan.
*
*
* @param apiId
* API Id of the associated API stage in a usage plan.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder apiId(String apiId);
/**
*
* API stage name of the associated API stage in a usage plan.
*
*
* @param stage
* API stage name of the associated API stage in a usage plan.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stage(String stage);
}
static final class BuilderImpl implements Builder {
private String apiId;
private String stage;
private BuilderImpl() {
}
private BuilderImpl(ApiStage model) {
apiId(model.apiId);
stage(model.stage);
}
public final String getApiId() {
return apiId;
}
@Override
public final Builder apiId(String apiId) {
this.apiId = apiId;
return this;
}
public final void setApiId(String apiId) {
this.apiId = apiId;
}
public final String getStage() {
return stage;
}
@Override
public final Builder stage(String stage) {
this.stage = stage;
return this;
}
public final void setStage(String stage) {
this.stage = stage;
}
@Override
public ApiStage build() {
return new ApiStage(this);
}
}
}