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

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

/*
 * 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.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 GetMappingRequest extends GlueRequest implements
        ToCopyableBuilder {
    private static final SdkField SOURCE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .getter(getter(GetMappingRequest::source)).setter(setter(Builder::source)).constructor(CatalogEntry::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Source").build()).build();

    private static final SdkField> SINKS_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .getter(getter(GetMappingRequest::sinks))
            .setter(setter(Builder::sinks))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Sinks").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(CatalogEntry::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField LOCATION_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
            .getter(getter(GetMappingRequest::location)).setter(setter(Builder::location)).constructor(Location::builder)
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Location").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SOURCE_FIELD, SINKS_FIELD,
            LOCATION_FIELD));

    private final CatalogEntry source;

    private final List sinks;

    private final Location location;

    private GetMappingRequest(BuilderImpl builder) {
        super(builder);
        this.source = builder.source;
        this.sinks = builder.sinks;
        this.location = builder.location;
    }

    /**
     * 

* Specifies the source table. *

* * @return Specifies the source table. */ public CatalogEntry source() { return source; } /** * Returns true if the Sinks 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 hasSinks() { return sinks != null && !(sinks instanceof SdkAutoConstructList); } /** *

* A list of target tables. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasSinks()} to see if a value was sent in this field. *

* * @return A list of target tables. */ public List sinks() { return sinks; } /** *

* Parameters for the mapping. *

* * @return Parameters for the mapping. */ public Location location() { return location; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(source()); hashCode = 31 * hashCode + Objects.hashCode(sinks()); hashCode = 31 * hashCode + Objects.hashCode(location()); 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 GetMappingRequest)) { return false; } GetMappingRequest other = (GetMappingRequest) obj; return Objects.equals(source(), other.source()) && Objects.equals(sinks(), other.sinks()) && Objects.equals(location(), other.location()); } /** * 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("GetMappingRequest").add("Source", source()).add("Sinks", sinks()).add("Location", location()) .build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Source": return Optional.ofNullable(clazz.cast(source())); case "Sinks": return Optional.ofNullable(clazz.cast(sinks())); case "Location": return Optional.ofNullable(clazz.cast(location())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((GetMappingRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends GlueRequest.Builder, SdkPojo, CopyableBuilder { /** *

* Specifies the source table. *

* * @param source * Specifies the source table. * @return Returns a reference to this object so that method calls can be chained together. */ Builder source(CatalogEntry source); /** *

* Specifies the source table. *

* This is a convenience that creates an instance of the {@link CatalogEntry.Builder} avoiding the need to * create one manually via {@link CatalogEntry#builder()}. * * When the {@link Consumer} completes, {@link CatalogEntry.Builder#build()} is called immediately and its * result is passed to {@link #source(CatalogEntry)}. * * @param source * a consumer that will call methods on {@link CatalogEntry.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #source(CatalogEntry) */ default Builder source(Consumer source) { return source(CatalogEntry.builder().applyMutation(source).build()); } /** *

* A list of target tables. *

* * @param sinks * A list of target tables. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sinks(Collection sinks); /** *

* A list of target tables. *

* * @param sinks * A list of target tables. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sinks(CatalogEntry... sinks); /** *

* A list of target tables. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its * result is passed to {@link #sinks(List)}. * * @param sinks * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #sinks(List) */ Builder sinks(Consumer... sinks); /** *

* Parameters for the mapping. *

* * @param location * Parameters for the mapping. * @return Returns a reference to this object so that method calls can be chained together. */ Builder location(Location location); /** *

* Parameters for the mapping. *

* This is a convenience that creates an instance of the {@link Location.Builder} avoiding the need to create * one manually via {@link Location#builder()}. * * When the {@link Consumer} completes, {@link Location.Builder#build()} is called immediately and its result is * passed to {@link #location(Location)}. * * @param location * a consumer that will call methods on {@link Location.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #location(Location) */ default Builder location(Consumer location) { return location(Location.builder().applyMutation(location).build()); } @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends GlueRequest.BuilderImpl implements Builder { private CatalogEntry source; private List sinks = DefaultSdkAutoConstructList.getInstance(); private Location location; private BuilderImpl() { } private BuilderImpl(GetMappingRequest model) { super(model); source(model.source); sinks(model.sinks); location(model.location); } public final CatalogEntry.Builder getSource() { return source != null ? source.toBuilder() : null; } @Override public final Builder source(CatalogEntry source) { this.source = source; return this; } public final void setSource(CatalogEntry.BuilderImpl source) { this.source = source != null ? source.build() : null; } public final Collection getSinks() { return sinks != null ? sinks.stream().map(CatalogEntry::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder sinks(Collection sinks) { this.sinks = CatalogEntriesCopier.copy(sinks); return this; } @Override @SafeVarargs public final Builder sinks(CatalogEntry... sinks) { sinks(Arrays.asList(sinks)); return this; } @Override @SafeVarargs public final Builder sinks(Consumer... sinks) { sinks(Stream.of(sinks).map(c -> CatalogEntry.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setSinks(Collection sinks) { this.sinks = CatalogEntriesCopier.copyFromBuilder(sinks); } public final Location.Builder getLocation() { return location != null ? location.toBuilder() : null; } @Override public final Builder location(Location location) { this.location = location; return this; } public final void setLocation(Location.BuilderImpl location) { this.location = location != null ? location.build() : null; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public GetMappingRequest build() { return new GetMappingRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy