All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.glue.model.ViewValidation Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Glue module holds the client classes that are used for communicating with AWS Glue Service

There is a newer version: 2.29.39
Show newest version
/*
 * 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.glue.model;

import java.io.Serializable;
import java.time.Instant;
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.Consumer;
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;

/**
 * 

* A structure that contains information for an analytical engine to validate a view, prior to persisting the view * metadata. Used in the case of direct UpdateTable or CreateTable API calls. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ViewValidation implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DIALECT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Dialect") .getter(getter(ViewValidation::dialectAsString)).setter(setter(Builder::dialect)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Dialect").build()).build(); private static final SdkField DIALECT_VERSION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DialectVersion").getter(getter(ViewValidation::dialectVersion)).setter(setter(Builder::dialectVersion)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DialectVersion").build()).build(); private static final SdkField VIEW_VALIDATION_TEXT_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ViewValidationText").getter(getter(ViewValidation::viewValidationText)) .setter(setter(Builder::viewValidationText)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ViewValidationText").build()) .build(); private static final SdkField UPDATE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("UpdateTime").getter(getter(ViewValidation::updateTime)).setter(setter(Builder::updateTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdateTime").build()).build(); private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State") .getter(getter(ViewValidation::stateAsString)).setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build(); private static final SdkField ERROR_FIELD = SdkField. builder(MarshallingType.SDK_POJO) .memberName("Error").getter(getter(ViewValidation::error)).setter(setter(Builder::error)) .constructor(ErrorDetail::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Error").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DIALECT_FIELD, DIALECT_VERSION_FIELD, VIEW_VALIDATION_TEXT_FIELD, UPDATE_TIME_FIELD, STATE_FIELD, ERROR_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String dialect; private final String dialectVersion; private final String viewValidationText; private final Instant updateTime; private final String state; private final ErrorDetail error; private ViewValidation(BuilderImpl builder) { this.dialect = builder.dialect; this.dialectVersion = builder.dialectVersion; this.viewValidationText = builder.viewValidationText; this.updateTime = builder.updateTime; this.state = builder.state; this.error = builder.error; } /** *

* The dialect of the query engine. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #dialect} will * return {@link ViewDialect#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #dialectAsString}. *

* * @return The dialect of the query engine. * @see ViewDialect */ public final ViewDialect dialect() { return ViewDialect.fromValue(dialect); } /** *

* The dialect of the query engine. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #dialect} will * return {@link ViewDialect#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #dialectAsString}. *

* * @return The dialect of the query engine. * @see ViewDialect */ public final String dialectAsString() { return dialect; } /** *

* The version of the dialect of the query engine. For example, 3.0.0. *

* * @return The version of the dialect of the query engine. For example, 3.0.0. */ public final String dialectVersion() { return dialectVersion; } /** *

* The SELECT query that defines the view, as provided by the customer. *

* * @return The SELECT query that defines the view, as provided by the customer. */ public final String viewValidationText() { return viewValidationText; } /** *

* The time of the last update. *

* * @return The time of the last update. */ public final Instant updateTime() { return updateTime; } /** *

* The state of the validation. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link ResourceState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The state of the validation. * @see ResourceState */ public final ResourceState state() { return ResourceState.fromValue(state); } /** *

* The state of the validation. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link ResourceState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The state of the validation. * @see ResourceState */ public final String stateAsString() { return state; } /** *

* An error associated with the validation. *

* * @return An error associated with the validation. */ public final ErrorDetail error() { return error; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(dialectAsString()); hashCode = 31 * hashCode + Objects.hashCode(dialectVersion()); hashCode = 31 * hashCode + Objects.hashCode(viewValidationText()); hashCode = 31 * hashCode + Objects.hashCode(updateTime()); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(error()); 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 ViewValidation)) { return false; } ViewValidation other = (ViewValidation) obj; return Objects.equals(dialectAsString(), other.dialectAsString()) && Objects.equals(dialectVersion(), other.dialectVersion()) && Objects.equals(viewValidationText(), other.viewValidationText()) && Objects.equals(updateTime(), other.updateTime()) && Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(error(), other.error()); } /** * 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("ViewValidation").add("Dialect", dialectAsString()).add("DialectVersion", dialectVersion()) .add("ViewValidationText", viewValidationText()).add("UpdateTime", updateTime()).add("State", stateAsString()) .add("Error", error()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Dialect": return Optional.ofNullable(clazz.cast(dialectAsString())); case "DialectVersion": return Optional.ofNullable(clazz.cast(dialectVersion())); case "ViewValidationText": return Optional.ofNullable(clazz.cast(viewValidationText())); case "UpdateTime": return Optional.ofNullable(clazz.cast(updateTime())); case "State": return Optional.ofNullable(clazz.cast(stateAsString())); case "Error": return Optional.ofNullable(clazz.cast(error())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("Dialect", DIALECT_FIELD); map.put("DialectVersion", DIALECT_VERSION_FIELD); map.put("ViewValidationText", VIEW_VALIDATION_TEXT_FIELD); map.put("UpdateTime", UPDATE_TIME_FIELD); map.put("State", STATE_FIELD); map.put("Error", ERROR_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((ViewValidation) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The dialect of the query engine. *

* * @param dialect * The dialect of the query engine. * @see ViewDialect * @return Returns a reference to this object so that method calls can be chained together. * @see ViewDialect */ Builder dialect(String dialect); /** *

* The dialect of the query engine. *

* * @param dialect * The dialect of the query engine. * @see ViewDialect * @return Returns a reference to this object so that method calls can be chained together. * @see ViewDialect */ Builder dialect(ViewDialect dialect); /** *

* The version of the dialect of the query engine. For example, 3.0.0. *

* * @param dialectVersion * The version of the dialect of the query engine. For example, 3.0.0. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dialectVersion(String dialectVersion); /** *

* The SELECT query that defines the view, as provided by the customer. *

* * @param viewValidationText * The SELECT query that defines the view, as provided by the customer. * @return Returns a reference to this object so that method calls can be chained together. */ Builder viewValidationText(String viewValidationText); /** *

* The time of the last update. *

* * @param updateTime * The time of the last update. * @return Returns a reference to this object so that method calls can be chained together. */ Builder updateTime(Instant updateTime); /** *

* The state of the validation. *

* * @param state * The state of the validation. * @see ResourceState * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceState */ Builder state(String state); /** *

* The state of the validation. *

* * @param state * The state of the validation. * @see ResourceState * @return Returns a reference to this object so that method calls can be chained together. * @see ResourceState */ Builder state(ResourceState state); /** *

* An error associated with the validation. *

* * @param error * An error associated with the validation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder error(ErrorDetail error); /** *

* An error associated with the validation. *

* This is a convenience method that creates an instance of the {@link ErrorDetail.Builder} avoiding the need to * create one manually via {@link ErrorDetail#builder()}. * *

* When the {@link Consumer} completes, {@link ErrorDetail.Builder#build()} is called immediately and its result * is passed to {@link #error(ErrorDetail)}. * * @param error * a consumer that will call methods on {@link ErrorDetail.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #error(ErrorDetail) */ default Builder error(Consumer error) { return error(ErrorDetail.builder().applyMutation(error).build()); } } static final class BuilderImpl implements Builder { private String dialect; private String dialectVersion; private String viewValidationText; private Instant updateTime; private String state; private ErrorDetail error; private BuilderImpl() { } private BuilderImpl(ViewValidation model) { dialect(model.dialect); dialectVersion(model.dialectVersion); viewValidationText(model.viewValidationText); updateTime(model.updateTime); state(model.state); error(model.error); } public final String getDialect() { return dialect; } public final void setDialect(String dialect) { this.dialect = dialect; } @Override public final Builder dialect(String dialect) { this.dialect = dialect; return this; } @Override public final Builder dialect(ViewDialect dialect) { this.dialect(dialect == null ? null : dialect.toString()); return this; } public final String getDialectVersion() { return dialectVersion; } public final void setDialectVersion(String dialectVersion) { this.dialectVersion = dialectVersion; } @Override public final Builder dialectVersion(String dialectVersion) { this.dialectVersion = dialectVersion; return this; } public final String getViewValidationText() { return viewValidationText; } public final void setViewValidationText(String viewValidationText) { this.viewValidationText = viewValidationText; } @Override public final Builder viewValidationText(String viewValidationText) { this.viewValidationText = viewValidationText; return this; } public final Instant getUpdateTime() { return updateTime; } public final void setUpdateTime(Instant updateTime) { this.updateTime = updateTime; } @Override public final Builder updateTime(Instant updateTime) { this.updateTime = updateTime; return this; } public final String getState() { return state; } public final void setState(String state) { this.state = state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(ResourceState state) { this.state(state == null ? null : state.toString()); return this; } public final ErrorDetail.Builder getError() { return error != null ? error.toBuilder() : null; } public final void setError(ErrorDetail.BuilderImpl error) { this.error = error != null ? error.build() : null; } @Override public final Builder error(ErrorDetail error) { this.error = error; return this; } @Override public ViewValidation build() { return new ViewValidation(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy