
software.amazon.awssdk.services.iotanalytics.model.UpdateDatasetRequest 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.iotanalytics.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 UpdateDatasetRequest extends IoTAnalyticsRequest implements
ToCopyableBuilder {
private static final SdkField DATASET_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("datasetName").getter(getter(UpdateDatasetRequest::datasetName)).setter(setter(Builder::datasetName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("datasetName").build()).build();
private static final SdkField> ACTIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("actions")
.getter(getter(UpdateDatasetRequest::actions))
.setter(setter(Builder::actions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DatasetAction::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> TRIGGERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("triggers")
.getter(getter(UpdateDatasetRequest::triggers))
.setter(setter(Builder::triggers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("triggers").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DatasetTrigger::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> CONTENT_DELIVERY_RULES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("contentDeliveryRules")
.getter(getter(UpdateDatasetRequest::contentDeliveryRules))
.setter(setter(Builder::contentDeliveryRules))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("contentDeliveryRules").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(DatasetContentDeliveryRule::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField RETENTION_PERIOD_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("retentionPeriod")
.getter(getter(UpdateDatasetRequest::retentionPeriod)).setter(setter(Builder::retentionPeriod))
.constructor(RetentionPeriod::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("retentionPeriod").build()).build();
private static final SdkField VERSIONING_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("versioningConfiguration")
.getter(getter(UpdateDatasetRequest::versioningConfiguration)).setter(setter(Builder::versioningConfiguration))
.constructor(VersioningConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("versioningConfiguration").build())
.build();
private static final SdkField> LATE_DATA_RULES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("lateDataRules")
.getter(getter(UpdateDatasetRequest::lateDataRules))
.setter(setter(Builder::lateDataRules))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lateDataRules").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(LateDataRule::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DATASET_NAME_FIELD,
ACTIONS_FIELD, TRIGGERS_FIELD, CONTENT_DELIVERY_RULES_FIELD, RETENTION_PERIOD_FIELD, VERSIONING_CONFIGURATION_FIELD,
LATE_DATA_RULES_FIELD));
private final String datasetName;
private final List actions;
private final List triggers;
private final List contentDeliveryRules;
private final RetentionPeriod retentionPeriod;
private final VersioningConfiguration versioningConfiguration;
private final List lateDataRules;
private UpdateDatasetRequest(BuilderImpl builder) {
super(builder);
this.datasetName = builder.datasetName;
this.actions = builder.actions;
this.triggers = builder.triggers;
this.contentDeliveryRules = builder.contentDeliveryRules;
this.retentionPeriod = builder.retentionPeriod;
this.versioningConfiguration = builder.versioningConfiguration;
this.lateDataRules = builder.lateDataRules;
}
/**
*
* The name of the dataset to update.
*
*
* @return The name of the dataset to update.
*/
public final String datasetName() {
return datasetName;
}
/**
* For responses, this returns true if the service returned a value for the Actions 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 hasActions() {
return actions != null && !(actions instanceof SdkAutoConstructList);
}
/**
*
* A list of DatasetAction
objects.
*
*
* 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 #hasActions} method.
*
*
* @return A list of DatasetAction
objects.
*/
public final List actions() {
return actions;
}
/**
* For responses, this returns true if the service returned a value for the Triggers 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 hasTriggers() {
return triggers != null && !(triggers instanceof SdkAutoConstructList);
}
/**
*
* A list of DatasetTrigger
objects. The list can be empty or can contain up to five
* DatasetTrigger
objects.
*
*
* 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 #hasTriggers} method.
*
*
* @return A list of DatasetTrigger
objects. The list can be empty or can contain up to five
* DatasetTrigger
objects.
*/
public final List triggers() {
return triggers;
}
/**
* For responses, this returns true if the service returned a value for the ContentDeliveryRules 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 hasContentDeliveryRules() {
return contentDeliveryRules != null && !(contentDeliveryRules instanceof SdkAutoConstructList);
}
/**
*
* When dataset contents are created, they are delivered to destinations specified here.
*
*
* 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 #hasContentDeliveryRules} method.
*
*
* @return When dataset contents are created, they are delivered to destinations specified here.
*/
public final List contentDeliveryRules() {
return contentDeliveryRules;
}
/**
*
* How long, in days, dataset contents are kept for the dataset.
*
*
* @return How long, in days, dataset contents are kept for the dataset.
*/
public final RetentionPeriod retentionPeriod() {
return retentionPeriod;
}
/**
*
* Optional. How many versions of dataset contents are kept. If not specified or set to null, only the latest
* version plus the latest succeeded version (if they are different) are kept for the time period specified by the
* retentionPeriod
parameter. For more information, see Keeping Multiple Versions of IoT Analytics datasets in the IoT Analytics User Guide.
*
*
* @return Optional. How many versions of dataset contents are kept. If not specified or set to null, only the
* latest version plus the latest succeeded version (if they are different) are kept for the time period
* specified by the retentionPeriod
parameter. For more information, see Keeping Multiple Versions of IoT Analytics datasets in the IoT Analytics User Guide.
*/
public final VersioningConfiguration versioningConfiguration() {
return versioningConfiguration;
}
/**
* For responses, this returns true if the service returned a value for the LateDataRules 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 hasLateDataRules() {
return lateDataRules != null && !(lateDataRules instanceof SdkAutoConstructList);
}
/**
*
* A list of data rules that send notifications to CloudWatch, when data arrives late. To specify
* lateDataRules
, the dataset must use a DeltaTimer filter.
*
*
* 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 #hasLateDataRules} method.
*
*
* @return A list of data rules that send notifications to CloudWatch, when data arrives late. To specify
* lateDataRules
, the dataset must use a DeltaTimer
* filter.
*/
public final List lateDataRules() {
return lateDataRules;
}
@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(datasetName());
hashCode = 31 * hashCode + Objects.hashCode(hasActions() ? actions() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasTriggers() ? triggers() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasContentDeliveryRules() ? contentDeliveryRules() : null);
hashCode = 31 * hashCode + Objects.hashCode(retentionPeriod());
hashCode = 31 * hashCode + Objects.hashCode(versioningConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(hasLateDataRules() ? lateDataRules() : 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 UpdateDatasetRequest)) {
return false;
}
UpdateDatasetRequest other = (UpdateDatasetRequest) obj;
return Objects.equals(datasetName(), other.datasetName()) && hasActions() == other.hasActions()
&& Objects.equals(actions(), other.actions()) && hasTriggers() == other.hasTriggers()
&& Objects.equals(triggers(), other.triggers()) && hasContentDeliveryRules() == other.hasContentDeliveryRules()
&& Objects.equals(contentDeliveryRules(), other.contentDeliveryRules())
&& Objects.equals(retentionPeriod(), other.retentionPeriod())
&& Objects.equals(versioningConfiguration(), other.versioningConfiguration())
&& hasLateDataRules() == other.hasLateDataRules() && Objects.equals(lateDataRules(), other.lateDataRules());
}
/**
* 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("UpdateDatasetRequest").add("DatasetName", datasetName())
.add("Actions", hasActions() ? actions() : null).add("Triggers", hasTriggers() ? triggers() : null)
.add("ContentDeliveryRules", hasContentDeliveryRules() ? contentDeliveryRules() : null)
.add("RetentionPeriod", retentionPeriod()).add("VersioningConfiguration", versioningConfiguration())
.add("LateDataRules", hasLateDataRules() ? lateDataRules() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "datasetName":
return Optional.ofNullable(clazz.cast(datasetName()));
case "actions":
return Optional.ofNullable(clazz.cast(actions()));
case "triggers":
return Optional.ofNullable(clazz.cast(triggers()));
case "contentDeliveryRules":
return Optional.ofNullable(clazz.cast(contentDeliveryRules()));
case "retentionPeriod":
return Optional.ofNullable(clazz.cast(retentionPeriod()));
case "versioningConfiguration":
return Optional.ofNullable(clazz.cast(versioningConfiguration()));
case "lateDataRules":
return Optional.ofNullable(clazz.cast(lateDataRules()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function