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

software.amazon.awssdk.services.databrew.model.DescribeRulesetResponse Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Data Brew module holds the client classes that are used for communicating with Data Brew.

There is a newer version: 2.29.15
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.databrew.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.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.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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class DescribeRulesetResponse extends DataBrewResponse implements
        ToCopyableBuilder {
    private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
            .getter(getter(DescribeRulesetResponse::name)).setter(setter(Builder::name))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();

    private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("Description").getter(getter(DescribeRulesetResponse::description)).setter(setter(Builder::description))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();

    private static final SdkField TARGET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("TargetArn").getter(getter(DescribeRulesetResponse::targetArn)).setter(setter(Builder::targetArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetArn").build()).build();

    private static final SdkField> RULES_FIELD = SdkField
            .> builder(MarshallingType.LIST)
            .memberName("Rules")
            .getter(getter(DescribeRulesetResponse::rules))
            .setter(setter(Builder::rules))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Rules").build(),
                    ListTrait
                            .builder()
                            .memberLocationName(null)
                            .memberFieldInfo(
                                    SdkField. builder(MarshallingType.SDK_POJO)
                                            .constructor(Rule::builder)
                                            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
                                                    .locationName("member").build()).build()).build()).build();

    private static final SdkField CREATE_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("CreateDate").getter(getter(DescribeRulesetResponse::createDate)).setter(setter(Builder::createDate))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreateDate").build()).build();

    private static final SdkField CREATED_BY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("CreatedBy").getter(getter(DescribeRulesetResponse::createdBy)).setter(setter(Builder::createdBy))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedBy").build()).build();

    private static final SdkField LAST_MODIFIED_BY_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("LastModifiedBy").getter(getter(DescribeRulesetResponse::lastModifiedBy))
            .setter(setter(Builder::lastModifiedBy))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedBy").build()).build();

    private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
            .memberName("LastModifiedDate").getter(getter(DescribeRulesetResponse::lastModifiedDate))
            .setter(setter(Builder::lastModifiedDate))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedDate").build()).build();

    private static final SdkField RESOURCE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
            .memberName("ResourceArn").getter(getter(DescribeRulesetResponse::resourceArn)).setter(setter(Builder::resourceArn))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceArn").build()).build();

    private static final SdkField> TAGS_FIELD = SdkField
            .> builder(MarshallingType.MAP)
            .memberName("Tags")
            .getter(getter(DescribeRulesetResponse::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(NAME_FIELD, DESCRIPTION_FIELD,
            TARGET_ARN_FIELD, RULES_FIELD, CREATE_DATE_FIELD, CREATED_BY_FIELD, LAST_MODIFIED_BY_FIELD, LAST_MODIFIED_DATE_FIELD,
            RESOURCE_ARN_FIELD, TAGS_FIELD));

    private final String name;

    private final String description;

    private final String targetArn;

    private final List rules;

    private final Instant createDate;

    private final String createdBy;

    private final String lastModifiedBy;

    private final Instant lastModifiedDate;

    private final String resourceArn;

    private final Map tags;

    private DescribeRulesetResponse(BuilderImpl builder) {
        super(builder);
        this.name = builder.name;
        this.description = builder.description;
        this.targetArn = builder.targetArn;
        this.rules = builder.rules;
        this.createDate = builder.createDate;
        this.createdBy = builder.createdBy;
        this.lastModifiedBy = builder.lastModifiedBy;
        this.lastModifiedDate = builder.lastModifiedDate;
        this.resourceArn = builder.resourceArn;
        this.tags = builder.tags;
    }

    /**
     * 

* The name of the ruleset. *

* * @return The name of the ruleset. */ public final String name() { return name; } /** *

* The description of the ruleset. *

* * @return The description of the ruleset. */ public final String description() { return description; } /** *

* The Amazon Resource Name (ARN) of a resource (dataset) that the ruleset is associated with. *

* * @return The Amazon Resource Name (ARN) of a resource (dataset) that the ruleset is associated with. */ public final String targetArn() { return targetArn; } /** * For responses, this returns true if the service returned a value for the Rules property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasRules() { return rules != null && !(rules instanceof SdkAutoConstructList); } /** *

* A list of rules that are defined with the ruleset. A rule includes one or more checks to be validated on a * DataBrew dataset. *

*

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

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasRules} method. *

* * @return A list of rules that are defined with the ruleset. A rule includes one or more checks to be validated on * a DataBrew dataset. */ public final List rules() { return rules; } /** *

* The date and time that the ruleset was created. *

* * @return The date and time that the ruleset was created. */ public final Instant createDate() { return createDate; } /** *

* The Amazon Resource Name (ARN) of the user who created the ruleset. *

* * @return The Amazon Resource Name (ARN) of the user who created the ruleset. */ public final String createdBy() { return createdBy; } /** *

* The Amazon Resource Name (ARN) of the user who last modified the ruleset. *

* * @return The Amazon Resource Name (ARN) of the user who last modified the ruleset. */ public final String lastModifiedBy() { return lastModifiedBy; } /** *

* The modification date and time of the ruleset. *

* * @return The modification date and time of the ruleset. */ public final Instant lastModifiedDate() { return lastModifiedDate; } /** *

* The Amazon Resource Name (ARN) for the ruleset. *

* * @return The Amazon Resource Name (ARN) for the ruleset. */ public final String resourceArn() { return resourceArn; } /** * For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructMap); } /** *

* Metadata tags that have been applied to the ruleset. *

*

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

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasTags} method. *

* * @return Metadata tags that have been applied to the ruleset. */ public final Map tags() { return tags; } @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 + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(targetArn()); hashCode = 31 * hashCode + Objects.hashCode(hasRules() ? rules() : null); hashCode = 31 * hashCode + Objects.hashCode(createDate()); hashCode = 31 * hashCode + Objects.hashCode(createdBy()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedBy()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate()); hashCode = 31 * hashCode + Objects.hashCode(resourceArn()); hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null); 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 DescribeRulesetResponse)) { return false; } DescribeRulesetResponse other = (DescribeRulesetResponse) obj; return Objects.equals(name(), other.name()) && Objects.equals(description(), other.description()) && Objects.equals(targetArn(), other.targetArn()) && hasRules() == other.hasRules() && Objects.equals(rules(), other.rules()) && Objects.equals(createDate(), other.createDate()) && Objects.equals(createdBy(), other.createdBy()) && Objects.equals(lastModifiedBy(), other.lastModifiedBy()) && Objects.equals(lastModifiedDate(), other.lastModifiedDate()) && Objects.equals(resourceArn(), other.resourceArn()) && hasTags() == other.hasTags() && 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 final String toString() { return ToString.builder("DescribeRulesetResponse").add("Name", name()).add("Description", description()) .add("TargetArn", targetArn()).add("Rules", hasRules() ? rules() : null).add("CreateDate", createDate()) .add("CreatedBy", createdBy()).add("LastModifiedBy", lastModifiedBy()) .add("LastModifiedDate", lastModifiedDate()).add("ResourceArn", resourceArn()) .add("Tags", hasTags() ? tags() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "Description": return Optional.ofNullable(clazz.cast(description())); case "TargetArn": return Optional.ofNullable(clazz.cast(targetArn())); case "Rules": return Optional.ofNullable(clazz.cast(rules())); case "CreateDate": return Optional.ofNullable(clazz.cast(createDate())); case "CreatedBy": return Optional.ofNullable(clazz.cast(createdBy())); case "LastModifiedBy": return Optional.ofNullable(clazz.cast(lastModifiedBy())); case "LastModifiedDate": return Optional.ofNullable(clazz.cast(lastModifiedDate())); case "ResourceArn": return Optional.ofNullable(clazz.cast(resourceArn())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DescribeRulesetResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends DataBrewResponse.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the ruleset. *

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

* The description of the ruleset. *

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

* The Amazon Resource Name (ARN) of a resource (dataset) that the ruleset is associated with. *

* * @param targetArn * The Amazon Resource Name (ARN) of a resource (dataset) that the ruleset is associated with. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetArn(String targetArn); /** *

* A list of rules that are defined with the ruleset. A rule includes one or more checks to be validated on a * DataBrew dataset. *

* * @param rules * A list of rules that are defined with the ruleset. A rule includes one or more checks to be validated * on a DataBrew dataset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rules(Collection rules); /** *

* A list of rules that are defined with the ruleset. A rule includes one or more checks to be validated on a * DataBrew dataset. *

* * @param rules * A list of rules that are defined with the ruleset. A rule includes one or more checks to be validated * on a DataBrew dataset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder rules(Rule... rules); /** *

* A list of rules that are defined with the ruleset. A rule includes one or more checks to be validated on a * DataBrew dataset. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.databrew.model.Rule.Builder} avoiding the need to create one manually * via {@link software.amazon.awssdk.services.databrew.model.Rule#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.databrew.model.Rule.Builder#build()} is called immediately and its * result is passed to {@link #rules(List)}. * * @param rules * a consumer that will call methods on * {@link software.amazon.awssdk.services.databrew.model.Rule.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #rules(java.util.Collection) */ Builder rules(Consumer... rules); /** *

* The date and time that the ruleset was created. *

* * @param createDate * The date and time that the ruleset was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createDate(Instant createDate); /** *

* The Amazon Resource Name (ARN) of the user who created the ruleset. *

* * @param createdBy * The Amazon Resource Name (ARN) of the user who created the ruleset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdBy(String createdBy); /** *

* The Amazon Resource Name (ARN) of the user who last modified the ruleset. *

* * @param lastModifiedBy * The Amazon Resource Name (ARN) of the user who last modified the ruleset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedBy(String lastModifiedBy); /** *

* The modification date and time of the ruleset. *

* * @param lastModifiedDate * The modification date and time of the ruleset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedDate(Instant lastModifiedDate); /** *

* The Amazon Resource Name (ARN) for the ruleset. *

* * @param resourceArn * The Amazon Resource Name (ARN) for the ruleset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceArn(String resourceArn); /** *

* Metadata tags that have been applied to the ruleset. *

* * @param tags * Metadata tags that have been applied to the ruleset. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); } static final class BuilderImpl extends DataBrewResponse.BuilderImpl implements Builder { private String name; private String description; private String targetArn; private List rules = DefaultSdkAutoConstructList.getInstance(); private Instant createDate; private String createdBy; private String lastModifiedBy; private Instant lastModifiedDate; private String resourceArn; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(DescribeRulesetResponse model) { super(model); name(model.name); description(model.description); targetArn(model.targetArn); rules(model.rules); createDate(model.createDate); createdBy(model.createdBy); lastModifiedBy(model.lastModifiedBy); lastModifiedDate(model.lastModifiedDate); resourceArn(model.resourceArn); tags(model.tags); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final String getTargetArn() { return targetArn; } public final void setTargetArn(String targetArn) { this.targetArn = targetArn; } @Override public final Builder targetArn(String targetArn) { this.targetArn = targetArn; return this; } public final List getRules() { List result = RuleListCopier.copyToBuilder(this.rules); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setRules(Collection rules) { this.rules = RuleListCopier.copyFromBuilder(rules); } @Override public final Builder rules(Collection rules) { this.rules = RuleListCopier.copy(rules); return this; } @Override @SafeVarargs public final Builder rules(Rule... rules) { rules(Arrays.asList(rules)); return this; } @Override @SafeVarargs public final Builder rules(Consumer... rules) { rules(Stream.of(rules).map(c -> Rule.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final Instant getCreateDate() { return createDate; } public final void setCreateDate(Instant createDate) { this.createDate = createDate; } @Override public final Builder createDate(Instant createDate) { this.createDate = createDate; return this; } public final String getCreatedBy() { return createdBy; } public final void setCreatedBy(String createdBy) { this.createdBy = createdBy; } @Override public final Builder createdBy(String createdBy) { this.createdBy = createdBy; return this; } public final String getLastModifiedBy() { return lastModifiedBy; } public final void setLastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } @Override public final Builder lastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; return this; } public final Instant getLastModifiedDate() { return lastModifiedDate; } public final void setLastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } @Override public final Builder lastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; return this; } public final String getResourceArn() { return resourceArn; } public final void setResourceArn(String resourceArn) { this.resourceArn = resourceArn; } @Override public final Builder resourceArn(String resourceArn) { this.resourceArn = resourceArn; return this; } public final Map getTags() { if (tags instanceof SdkAutoConstructMap) { return null; } return tags; } public final void setTags(Map tags) { this.tags = TagMapCopier.copy(tags); } @Override public final Builder tags(Map tags) { this.tags = TagMapCopier.copy(tags); return this; } @Override public DescribeRulesetResponse build() { return new DescribeRulesetResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy