All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.apigateway.model.CreateApiKeyResponse Maven / Gradle / Ivy
Go to download
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.time.Instant;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A resource that can be distributed to callers for executing Method resources that require an API key. API keys
* can be mapped to any Stage on any RestApi , which indicates that the callers with the API key can make
* requests to that stage.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateApiKeyResponse extends ApiGatewayResponse implements
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateApiKeyResponse::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("id").build()).build();
private static final SdkField VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateApiKeyResponse::value)).setter(setter(Builder::value))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("value").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateApiKeyResponse::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField CUSTOMER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateApiKeyResponse::customerId)).setter(setter(Builder::customerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("customerId").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(CreateApiKeyResponse::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.getter(getter(CreateApiKeyResponse::enabled)).setter(setter(Builder::enabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("enabled").build()).build();
private static final SdkField CREATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(CreateApiKeyResponse::createdDate)).setter(setter(Builder::createdDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdDate").build()).build();
private static final SdkField LAST_UPDATED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(CreateApiKeyResponse::lastUpdatedDate)).setter(setter(Builder::lastUpdatedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedDate").build()).build();
private static final SdkField> STAGE_KEYS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(CreateApiKeyResponse::stageKeys))
.setter(setter(Builder::stageKeys))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stageKeys").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> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(CreateApiKeyResponse::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, VALUE_FIELD,
NAME_FIELD, CUSTOMER_ID_FIELD, DESCRIPTION_FIELD, ENABLED_FIELD, CREATED_DATE_FIELD, LAST_UPDATED_DATE_FIELD,
STAGE_KEYS_FIELD, TAGS_FIELD));
private final String id;
private final String value;
private final String name;
private final String customerId;
private final String description;
private final Boolean enabled;
private final Instant createdDate;
private final Instant lastUpdatedDate;
private final List stageKeys;
private final Map tags;
private CreateApiKeyResponse(BuilderImpl builder) {
super(builder);
this.id = builder.id;
this.value = builder.value;
this.name = builder.name;
this.customerId = builder.customerId;
this.description = builder.description;
this.enabled = builder.enabled;
this.createdDate = builder.createdDate;
this.lastUpdatedDate = builder.lastUpdatedDate;
this.stageKeys = builder.stageKeys;
this.tags = builder.tags;
}
/**
*
* The identifier of the API Key.
*
*
* @return The identifier of the API Key.
*/
public String id() {
return id;
}
/**
*
* The value of the API Key.
*
*
* @return The value of the API Key.
*/
public String value() {
return value;
}
/**
*
* The name of the API Key.
*
*
* @return The name of the API Key.
*/
public String name() {
return name;
}
/**
*
* An AWS Marketplace customer identifier , when integrating with the AWS SaaS Marketplace.
*
*
* @return An AWS Marketplace customer identifier , when integrating with the AWS SaaS Marketplace.
*/
public String customerId() {
return customerId;
}
/**
*
* The description of the API Key.
*
*
* @return The description of the API Key.
*/
public String description() {
return description;
}
/**
*
* Specifies whether the API Key can be used by callers.
*
*
* @return Specifies whether the API Key can be used by callers.
*/
public Boolean enabled() {
return enabled;
}
/**
*
* The timestamp when the API Key was created.
*
*
* @return The timestamp when the API Key was created.
*/
public Instant createdDate() {
return createdDate;
}
/**
*
* The timestamp when the API Key was last updated.
*
*
* @return The timestamp when the API Key was last updated.
*/
public Instant lastUpdatedDate() {
return lastUpdatedDate;
}
/**
* Returns true if the StageKeys property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasStageKeys() {
return stageKeys != null && !(stageKeys instanceof SdkAutoConstructList);
}
/**
*
* A list of Stage resources that are associated with the ApiKey resource.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasStageKeys()} to see if a value was sent in this field.
*
*
* @return A list of Stage resources that are associated with the ApiKey resource.
*/
public List stageKeys() {
return stageKeys;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* The collection of tags. Each tag element is associated with a given resource.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return The collection of tags. Each tag element is associated with a given resource.
*/
public Map tags() {
return tags;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(value());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(customerId());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(enabled());
hashCode = 31 * hashCode + Objects.hashCode(createdDate());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedDate());
hashCode = 31 * hashCode + Objects.hashCode(stageKeys());
hashCode = 31 * hashCode + Objects.hashCode(tags());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateApiKeyResponse)) {
return false;
}
CreateApiKeyResponse other = (CreateApiKeyResponse) obj;
return Objects.equals(id(), other.id()) && Objects.equals(value(), other.value()) && Objects.equals(name(), other.name())
&& Objects.equals(customerId(), other.customerId()) && Objects.equals(description(), other.description())
&& Objects.equals(enabled(), other.enabled()) && Objects.equals(createdDate(), other.createdDate())
&& Objects.equals(lastUpdatedDate(), other.lastUpdatedDate()) && Objects.equals(stageKeys(), other.stageKeys())
&& Objects.equals(tags(), other.tags());
}
/**
* 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 String toString() {
return ToString.builder("CreateApiKeyResponse").add("Id", id()).add("Value", value()).add("Name", name())
.add("CustomerId", customerId()).add("Description", description()).add("Enabled", enabled())
.add("CreatedDate", createdDate()).add("LastUpdatedDate", lastUpdatedDate()).add("StageKeys", stageKeys())
.add("Tags", tags()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "value":
return Optional.ofNullable(clazz.cast(value()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "customerId":
return Optional.ofNullable(clazz.cast(customerId()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "enabled":
return Optional.ofNullable(clazz.cast(enabled()));
case "createdDate":
return Optional.ofNullable(clazz.cast(createdDate()));
case "lastUpdatedDate":
return Optional.ofNullable(clazz.cast(lastUpdatedDate()));
case "stageKeys":
return Optional.ofNullable(clazz.cast(stageKeys()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((CreateApiKeyResponse) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends ApiGatewayResponse.Builder, SdkPojo, CopyableBuilder {
/**
*
* The identifier of the API Key.
*
*
* @param id
* The identifier of the API Key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* The value of the API Key.
*
*
* @param value
* The value of the API Key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder value(String value);
/**
*
* The name of the API Key.
*
*
* @param name
* The name of the API Key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder name(String name);
/**
*
* An AWS Marketplace customer identifier , when integrating with the AWS SaaS Marketplace.
*
*
* @param customerId
* An AWS Marketplace customer identifier , when integrating with the AWS SaaS Marketplace.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder customerId(String customerId);
/**
*
* The description of the API Key.
*
*
* @param description
* The description of the API Key.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* Specifies whether the API Key can be used by callers.
*
*
* @param enabled
* Specifies whether the API Key can be used by callers.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder enabled(Boolean enabled);
/**
*
* The timestamp when the API Key was created.
*
*
* @param createdDate
* The timestamp when the API Key was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder createdDate(Instant createdDate);
/**
*
* The timestamp when the API Key was last updated.
*
*
* @param lastUpdatedDate
* The timestamp when the API Key was last updated.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastUpdatedDate(Instant lastUpdatedDate);
/**
*
* A list of Stage resources that are associated with the ApiKey resource.
*
*
* @param stageKeys
* A list of Stage resources that are associated with the ApiKey resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stageKeys(Collection stageKeys);
/**
*
* A list of Stage resources that are associated with the ApiKey resource.
*
*
* @param stageKeys
* A list of Stage resources that are associated with the ApiKey resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stageKeys(String... stageKeys);
/**
*
* The collection of tags. Each tag element is associated with a given resource.
*
*
* @param tags
* The collection of tags. Each tag element is associated with a given resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
}
static final class BuilderImpl extends ApiGatewayResponse.BuilderImpl implements Builder {
private String id;
private String value;
private String name;
private String customerId;
private String description;
private Boolean enabled;
private Instant createdDate;
private Instant lastUpdatedDate;
private List stageKeys = DefaultSdkAutoConstructList.getInstance();
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreateApiKeyResponse model) {
super(model);
id(model.id);
value(model.value);
name(model.name);
customerId(model.customerId);
description(model.description);
enabled(model.enabled);
createdDate(model.createdDate);
lastUpdatedDate(model.lastUpdatedDate);
stageKeys(model.stageKeys);
tags(model.tags);
}
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 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;
}
public final String getCustomerId() {
return customerId;
}
@Override
public final Builder customerId(String customerId) {
this.customerId = customerId;
return this;
}
public final void setCustomerId(String customerId) {
this.customerId = customerId;
}
public final String getDescription() {
return description;
}
@Override
public final Builder description(String description) {
this.description = description;
return this;
}
public final void setDescription(String description) {
this.description = description;
}
public final Boolean getEnabled() {
return enabled;
}
@Override
public final Builder enabled(Boolean enabled) {
this.enabled = enabled;
return this;
}
public final void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public final Instant getCreatedDate() {
return createdDate;
}
@Override
public final Builder createdDate(Instant createdDate) {
this.createdDate = createdDate;
return this;
}
public final void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public final Instant getLastUpdatedDate() {
return lastUpdatedDate;
}
@Override
public final Builder lastUpdatedDate(Instant lastUpdatedDate) {
this.lastUpdatedDate = lastUpdatedDate;
return this;
}
public final void setLastUpdatedDate(Instant lastUpdatedDate) {
this.lastUpdatedDate = lastUpdatedDate;
}
public final Collection getStageKeys() {
return stageKeys;
}
@Override
public final Builder stageKeys(Collection stageKeys) {
this.stageKeys = ListOfStringCopier.copy(stageKeys);
return this;
}
@Override
@SafeVarargs
public final Builder stageKeys(String... stageKeys) {
stageKeys(Arrays.asList(stageKeys));
return this;
}
public final void setStageKeys(Collection stageKeys) {
this.stageKeys = ListOfStringCopier.copy(stageKeys);
}
public final Map getTags() {
return tags;
}
@Override
public final Builder tags(Map tags) {
this.tags = MapOfStringToStringCopier.copy(tags);
return this;
}
public final void setTags(Map tags) {
this.tags = MapOfStringToStringCopier.copy(tags);
}
@Override
public CreateApiKeyResponse build() {
return new CreateApiKeyResponse(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}