software.amazon.awssdk.services.apigateway.model.CreateUsagePlanKeyResponse 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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents a usage plan key to identify a plan customer.
*
*
*
* To associate an API stage with a selected API key in a usage plan, you must create a UsagePlanKey resource to
* represent the selected ApiKey.
*
* "
*/
@Generated("software.amazon.awssdk:codegen")
public class CreateUsagePlanKeyResponse extends APIGatewayResponse implements
ToCopyableBuilder {
private final String id;
private final String type;
private final String value;
private final String name;
private CreateUsagePlanKeyResponse(BuilderImpl builder) {
super(builder);
this.id = builder.id;
this.type = builder.type;
this.value = builder.value;
this.name = builder.name;
}
/**
*
* The Id of a usage plan key.
*
*
* @return The Id of a usage plan key.
*/
public String id() {
return id;
}
/**
*
* The type of a usage plan key. Currently, the valid key type is API_KEY
.
*
*
* @return The type of a usage plan key. Currently, the valid key type is API_KEY
.
*/
public String type() {
return type;
}
/**
*
* The value of a usage plan key.
*
*
* @return The value of a usage plan key.
*/
public String value() {
return value;
}
/**
*
* The name of a usage plan key.
*
*
* @return The name of a usage plan key.
*/
public String name() {
return name;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(type());
hashCode = 31 * hashCode + Objects.hashCode(value());
hashCode = 31 * hashCode + Objects.hashCode(name());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateUsagePlanKeyResponse)) {
return false;
}
CreateUsagePlanKeyResponse other = (CreateUsagePlanKeyResponse) obj;
return Objects.equals(id(), other.id()) && Objects.equals(type(), other.type()) && Objects.equals(value(), other.value())
&& Objects.equals(name(), other.name());
}
@Override
public String toString() {
return ToString.builder("CreateUsagePlanKeyResponse").add("Id", id()).add("Type", type()).add("Value", value())
.add("Name", name()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.of(clazz.cast(id()));
case "type":
return Optional.of(clazz.cast(type()));
case "value":
return Optional.of(clazz.cast(value()));
case "name":
return Optional.of(clazz.cast(name()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayResponse.Builder, CopyableBuilder {
/**
*
* The Id of a usage plan key.
*
*
* @param id
* The Id of a usage plan key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* The type of a usage plan key. Currently, the valid key type is API_KEY
.
*
*
* @param type
* The type of a usage plan key. Currently, the valid key type is API_KEY
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder type(String type);
/**
*
* The value of a usage plan key.
*
*
* @param value
* The value of a usage plan key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder value(String value);
/**
*
* The name of a usage plan key.
*
*
* @param name
* The name of a usage plan key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder name(String name);
}
static final class BuilderImpl extends APIGatewayResponse.BuilderImpl implements Builder {
private String id;
private String type;
private String value;
private String name;
private BuilderImpl() {
}
private BuilderImpl(CreateUsagePlanKeyResponse model) {
id(model.id);
type(model.type);
value(model.value);
name(model.name);
}
public final String getId() {
return id;
}
@Override
public final Builder id(String id) {
this.id = id;
return this;
}
public final void setId(String id) {
this.id = id;
}
public final String getType() {
return type;
}
@Override
public final Builder type(String type) {
this.type = type;
return this;
}
public final void setType(String type) {
this.type = type;
}
public final String getValue() {
return value;
}
@Override
public final Builder value(String value) {
this.value = value;
return this;
}
public final void setValue(String value) {
this.value = value;
}
public final String getName() {
return name;
}
@Override
public final Builder name(String name) {
this.name = name;
return this;
}
public final void setName(String name) {
this.name = name;
}
@Override
public CreateUsagePlanKeyResponse build() {
return new CreateUsagePlanKeyResponse(this);
}
}
}