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

software.amazon.awssdk.services.timestreamwrite.model.Database Maven / Gradle / Ivy

Go to download

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

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.timestreamwrite.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
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.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 top-level container for a table. Databases and tables are the fundamental management concepts in Amazon Timestream. * All tables in a database are encrypted with the same KMS key. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Database implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Arn") .getter(getter(Database::arn)).setter(setter(Builder::arn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Arn").build()).build(); private static final SdkField DATABASE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DatabaseName").getter(getter(Database::databaseName)).setter(setter(Builder::databaseName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DatabaseName").build()).build(); private static final SdkField TABLE_COUNT_FIELD = SdkField. builder(MarshallingType.LONG) .memberName("TableCount").getter(getter(Database::tableCount)).setter(setter(Builder::tableCount)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TableCount").build()).build(); private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("KmsKeyId").getter(getter(Database::kmsKeyId)).setter(setter(Builder::kmsKeyId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyId").build()).build(); private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CreationTime").getter(getter(Database::creationTime)).setter(setter(Builder::creationTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build(); private static final SdkField LAST_UPDATED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastUpdatedTime").getter(getter(Database::lastUpdatedTime)).setter(setter(Builder::lastUpdatedTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedTime").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, DATABASE_NAME_FIELD, TABLE_COUNT_FIELD, KMS_KEY_ID_FIELD, CREATION_TIME_FIELD, LAST_UPDATED_TIME_FIELD)); private static final long serialVersionUID = 1L; private final String arn; private final String databaseName; private final Long tableCount; private final String kmsKeyId; private final Instant creationTime; private final Instant lastUpdatedTime; private Database(BuilderImpl builder) { this.arn = builder.arn; this.databaseName = builder.databaseName; this.tableCount = builder.tableCount; this.kmsKeyId = builder.kmsKeyId; this.creationTime = builder.creationTime; this.lastUpdatedTime = builder.lastUpdatedTime; } /** *

* The Amazon Resource Name that uniquely identifies this database. *

* * @return The Amazon Resource Name that uniquely identifies this database. */ public final String arn() { return arn; } /** *

* The name of the Timestream database. *

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

* The total number of tables found within a Timestream database. *

* * @return The total number of tables found within a Timestream database. */ public final Long tableCount() { return tableCount; } /** *

* The identifier of the KMS key used to encrypt the data stored in the database. *

* * @return The identifier of the KMS key used to encrypt the data stored in the database. */ public final String kmsKeyId() { return kmsKeyId; } /** *

* The time when the database was created, calculated from the Unix epoch time. *

* * @return The time when the database was created, calculated from the Unix epoch time. */ public final Instant creationTime() { return creationTime; } /** *

* The last time that this database was updated. *

* * @return The last time that this database was updated. */ public final Instant lastUpdatedTime() { return lastUpdatedTime; } @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(arn()); hashCode = 31 * hashCode + Objects.hashCode(databaseName()); hashCode = 31 * hashCode + Objects.hashCode(tableCount()); hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId()); hashCode = 31 * hashCode + Objects.hashCode(creationTime()); hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTime()); 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 Database)) { return false; } Database other = (Database) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(databaseName(), other.databaseName()) && Objects.equals(tableCount(), other.tableCount()) && Objects.equals(kmsKeyId(), other.kmsKeyId()) && Objects.equals(creationTime(), other.creationTime()) && Objects.equals(lastUpdatedTime(), other.lastUpdatedTime()); } /** * 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("Database").add("Arn", arn()).add("DatabaseName", databaseName()).add("TableCount", tableCount()) .add("KmsKeyId", kmsKeyId()).add("CreationTime", creationTime()).add("LastUpdatedTime", lastUpdatedTime()) .build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Arn": return Optional.ofNullable(clazz.cast(arn())); case "DatabaseName": return Optional.ofNullable(clazz.cast(databaseName())); case "TableCount": return Optional.ofNullable(clazz.cast(tableCount())); case "KmsKeyId": return Optional.ofNullable(clazz.cast(kmsKeyId())); case "CreationTime": return Optional.ofNullable(clazz.cast(creationTime())); case "LastUpdatedTime": return Optional.ofNullable(clazz.cast(lastUpdatedTime())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((Database) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name that uniquely identifies this database. *

* * @param arn * The Amazon Resource Name that uniquely identifies this database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder arn(String arn); /** *

* The name of the Timestream database. *

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

* The total number of tables found within a Timestream database. *

* * @param tableCount * The total number of tables found within a Timestream database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tableCount(Long tableCount); /** *

* The identifier of the KMS key used to encrypt the data stored in the database. *

* * @param kmsKeyId * The identifier of the KMS key used to encrypt the data stored in the database. * @return Returns a reference to this object so that method calls can be chained together. */ Builder kmsKeyId(String kmsKeyId); /** *

* The time when the database was created, calculated from the Unix epoch time. *

* * @param creationTime * The time when the database was created, calculated from the Unix epoch time. * @return Returns a reference to this object so that method calls can be chained together. */ Builder creationTime(Instant creationTime); /** *

* The last time that this database was updated. *

* * @param lastUpdatedTime * The last time that this database was updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastUpdatedTime(Instant lastUpdatedTime); } static final class BuilderImpl implements Builder { private String arn; private String databaseName; private Long tableCount; private String kmsKeyId; private Instant creationTime; private Instant lastUpdatedTime; private BuilderImpl() { } private BuilderImpl(Database model) { arn(model.arn); databaseName(model.databaseName); tableCount(model.tableCount); kmsKeyId(model.kmsKeyId); creationTime(model.creationTime); lastUpdatedTime(model.lastUpdatedTime); } public final String getArn() { return arn; } public final void setArn(String arn) { this.arn = arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final String getDatabaseName() { return databaseName; } public final void setDatabaseName(String databaseName) { this.databaseName = databaseName; } @Override public final Builder databaseName(String databaseName) { this.databaseName = databaseName; return this; } public final Long getTableCount() { return tableCount; } public final void setTableCount(Long tableCount) { this.tableCount = tableCount; } @Override public final Builder tableCount(Long tableCount) { this.tableCount = tableCount; return this; } public final String getKmsKeyId() { return kmsKeyId; } public final void setKmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; } @Override public final Builder kmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; return this; } public final Instant getCreationTime() { return creationTime; } public final void setCreationTime(Instant creationTime) { this.creationTime = creationTime; } @Override public final Builder creationTime(Instant creationTime) { this.creationTime = creationTime; return this; } public final Instant getLastUpdatedTime() { return lastUpdatedTime; } public final void setLastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; } @Override public final Builder lastUpdatedTime(Instant lastUpdatedTime) { this.lastUpdatedTime = lastUpdatedTime; return this; } @Override public Database build() { return new Database(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy