software.amazon.awssdk.services.amplifybackend.model.GetBackendApiModelsResponse Maven / Gradle / Ivy
Show all versions of amplifybackend Show documentation
/*
* 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.amplifybackend.model;
import java.util.Arrays;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetBackendApiModelsResponse extends AmplifyBackendResponse implements
ToCopyableBuilder {
private static final SdkField MODELS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Models")
.getter(getter(GetBackendApiModelsResponse::models)).setter(setter(Builder::models))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("models").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(GetBackendApiModelsResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField MODEL_INTROSPECTION_SCHEMA_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ModelIntrospectionSchema").getter(getter(GetBackendApiModelsResponse::modelIntrospectionSchema))
.setter(setter(Builder::modelIntrospectionSchema))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("modelIntrospectionSchema").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MODELS_FIELD, STATUS_FIELD,
MODEL_INTROSPECTION_SCHEMA_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("models", MODELS_FIELD);
put("status", STATUS_FIELD);
put("modelIntrospectionSchema", MODEL_INTROSPECTION_SCHEMA_FIELD);
}
});
private final String models;
private final String status;
private final String modelIntrospectionSchema;
private GetBackendApiModelsResponse(BuilderImpl builder) {
super(builder);
this.models = builder.models;
this.status = builder.status;
this.modelIntrospectionSchema = builder.modelIntrospectionSchema;
}
/**
*
* Stringified JSON of the datastore model.
*
*
* @return Stringified JSON of the datastore model.
*/
public final String models() {
return models;
}
/**
*
* The current status of the request.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link Status#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The current status of the request.
* @see Status
*/
public final Status status() {
return Status.fromValue(status);
}
/**
*
* The current status of the request.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link Status#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The current status of the request.
* @see Status
*/
public final String statusAsString() {
return status;
}
/**
*
* Stringified JSON of the model introspection schema for an existing backend API resource.
*
*
* @return Stringified JSON of the model introspection schema for an existing backend API resource.
*/
public final String modelIntrospectionSchema() {
return modelIntrospectionSchema;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(models());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(modelIntrospectionSchema());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetBackendApiModelsResponse)) {
return false;
}
GetBackendApiModelsResponse other = (GetBackendApiModelsResponse) obj;
return Objects.equals(models(), other.models()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(modelIntrospectionSchema(), other.modelIntrospectionSchema());
}
/**
* 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("GetBackendApiModelsResponse").add("Models", models()).add("Status", statusAsString())
.add("ModelIntrospectionSchema", modelIntrospectionSchema()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Models":
return Optional.ofNullable(clazz.cast(models()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "ModelIntrospectionSchema":
return Optional.ofNullable(clazz.cast(modelIntrospectionSchema()));
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