/* * Copyright 2018-2023 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 com.amazonaws.services.glue.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *
 * The Database object represents a logical grouping of tables that might reside in a Hive metastore or an
 * RDBMS.
 * 
* The name of the database. For Hive compatibility, this is folded to lowercase when it is stored. *
*/ private String name; /** ** A description of the database. *
*/ private String description; /** ** The location of the database (for example, an HDFS path). *
*/ private String locationUri; /** ** These key-value pairs define parameters and properties of the database. *
*/ private java.util.Map* The time at which the metadata database was created in the catalog. *
*/ private java.util.Date createTime; /** ** Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the normal * course of Glue operations. *
*/ private java.util.List
     * A DatabaseIdentifier structure that describes a target database for resource linking.
     * 
* The ID of the Data Catalog in which the database resides. *
*/ private String catalogId; /** *
     * A FederatedDatabase structure that references an entity outside the Glue Data Catalog.
     * 
* The name of the database. For Hive compatibility, this is folded to lowercase when it is stored. *
* * @param name * The name of the database. For Hive compatibility, this is folded to lowercase when it is stored. */ public void setName(String name) { this.name = name; } /** ** The name of the database. For Hive compatibility, this is folded to lowercase when it is stored. *
* * @return The name of the database. For Hive compatibility, this is folded to lowercase when it is stored. */ public String getName() { return this.name; } /** ** The name of the database. For Hive compatibility, this is folded to lowercase when it is stored. *
* * @param name * The name of the database. For Hive compatibility, this is folded to lowercase when it is stored. * @return Returns a reference to this object so that method calls can be chained together. */ public Database withName(String name) { setName(name); return this; } /** ** A description of the database. *
* * @param description * A description of the database. */ public void setDescription(String description) { this.description = description; } /** ** A description of the database. *
* * @return A description of the database. */ public String getDescription() { return this.description; } /** ** A description of the database. *
* * @param description * A description of the database. * @return Returns a reference to this object so that method calls can be chained together. */ public Database withDescription(String description) { setDescription(description); return this; } /** ** The location of the database (for example, an HDFS path). *
* * @param locationUri * The location of the database (for example, an HDFS path). */ public void setLocationUri(String locationUri) { this.locationUri = locationUri; } /** ** The location of the database (for example, an HDFS path). *
* * @return The location of the database (for example, an HDFS path). */ public String getLocationUri() { return this.locationUri; } /** ** The location of the database (for example, an HDFS path). *
* * @param locationUri * The location of the database (for example, an HDFS path). * @return Returns a reference to this object so that method calls can be chained together. */ public Database withLocationUri(String locationUri) { setLocationUri(locationUri); return this; } /** ** These key-value pairs define parameters and properties of the database. *
* * @return These key-value pairs define parameters and properties of the database. */ public java.util.Map* These key-value pairs define parameters and properties of the database. *
* * @param parameters * These key-value pairs define parameters and properties of the database. */ public void setParameters(java.util.Map* These key-value pairs define parameters and properties of the database. *
* * @param parameters * These key-value pairs define parameters and properties of the database. * @return Returns a reference to this object so that method calls can be chained together. */ public Database withParameters(java.util.Map* The time at which the metadata database was created in the catalog. *
* * @param createTime * The time at which the metadata database was created in the catalog. */ public void setCreateTime(java.util.Date createTime) { this.createTime = createTime; } /** ** The time at which the metadata database was created in the catalog. *
* * @return The time at which the metadata database was created in the catalog. */ public java.util.Date getCreateTime() { return this.createTime; } /** ** The time at which the metadata database was created in the catalog. *
* * @param createTime * The time at which the metadata database was created in the catalog. * @return Returns a reference to this object so that method calls can be chained together. */ public Database withCreateTime(java.util.Date createTime) { setCreateTime(createTime); return this; } /** ** Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the normal * course of Glue operations. *
* * @return Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the * normal course of Glue operations. */ public java.util.List* Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the normal * course of Glue operations. *
* * @param createTableDefaultPermissions * Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the * normal course of Glue operations. */ public void setCreateTableDefaultPermissions(java.util.Collection* Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the normal * course of Glue operations. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setCreateTableDefaultPermissions(java.util.Collection)} or * {@link #withCreateTableDefaultPermissions(java.util.Collection)} if you want to override the existing values. *
* * @param createTableDefaultPermissions * Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the * normal course of Glue operations. * @return Returns a reference to this object so that method calls can be chained together. */ public Database withCreateTableDefaultPermissions(PrincipalPermissions... createTableDefaultPermissions) { if (this.createTableDefaultPermissions == null) { setCreateTableDefaultPermissions(new java.util.ArrayList* Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the normal * course of Glue operations. *
* * @param createTableDefaultPermissions * Creates a set of default permissions on the table for principals. Used by Lake Formation. Not used in the * normal course of Glue operations. * @return Returns a reference to this object so that method calls can be chained together. */ public Database withCreateTableDefaultPermissions(java.util.Collection
     * A DatabaseIdentifier structure that describes a target database for resource linking.
     * 
DatabaseIdentifier structure that describes a target database for resource linking.
     */
    public void setTargetDatabase(DatabaseIdentifier targetDatabase) {
        this.targetDatabase = targetDatabase;
    }
    /**
     * 
     * A DatabaseIdentifier structure that describes a target database for resource linking.
     * 
DatabaseIdentifier structure that describes a target database for resource linking.
     */
    public DatabaseIdentifier getTargetDatabase() {
        return this.targetDatabase;
    }
    /**
     * 
     * A DatabaseIdentifier structure that describes a target database for resource linking.
     * 
DatabaseIdentifier structure that describes a target database for resource linking.
     * @return Returns a reference to this object so that method calls can be chained together.
     */
    public Database withTargetDatabase(DatabaseIdentifier targetDatabase) {
        setTargetDatabase(targetDatabase);
        return this;
    }
    /**
     * * The ID of the Data Catalog in which the database resides. *
* * @param catalogId * The ID of the Data Catalog in which the database resides. */ public void setCatalogId(String catalogId) { this.catalogId = catalogId; } /** ** The ID of the Data Catalog in which the database resides. *
* * @return The ID of the Data Catalog in which the database resides. */ public String getCatalogId() { return this.catalogId; } /** ** The ID of the Data Catalog in which the database resides. *
* * @param catalogId * The ID of the Data Catalog in which the database resides. * @return Returns a reference to this object so that method calls can be chained together. */ public Database withCatalogId(String catalogId) { setCatalogId(catalogId); return this; } /** *
     * A FederatedDatabase structure that references an entity outside the Glue Data Catalog.
     * 
FederatedDatabase structure that references an entity outside the Glue Data Catalog.
     */
    public void setFederatedDatabase(FederatedDatabase federatedDatabase) {
        this.federatedDatabase = federatedDatabase;
    }
    /**
     * 
     * A FederatedDatabase structure that references an entity outside the Glue Data Catalog.
     * 
FederatedDatabase structure that references an entity outside the Glue Data Catalog.
     */
    public FederatedDatabase getFederatedDatabase() {
        return this.federatedDatabase;
    }
    /**
     * 
     * A FederatedDatabase structure that references an entity outside the Glue Data Catalog.
     * 
FederatedDatabase structure that references an entity outside the Glue Data Catalog.
     * @return Returns a reference to this object so that method calls can be chained together.
     */
    public Database withFederatedDatabase(FederatedDatabase federatedDatabase) {
        setFederatedDatabase(federatedDatabase);
        return this;
    }
    /**
     * 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.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getName() != null)
            sb.append("Name: ").append(getName()).append(",");
        if (getDescription() != null)
            sb.append("Description: ").append(getDescription()).append(",");
        if (getLocationUri() != null)
            sb.append("LocationUri: ").append(getLocationUri()).append(",");
        if (getParameters() != null)
            sb.append("Parameters: ").append(getParameters()).append(",");
        if (getCreateTime() != null)
            sb.append("CreateTime: ").append(getCreateTime()).append(",");
        if (getCreateTableDefaultPermissions() != null)
            sb.append("CreateTableDefaultPermissions: ").append(getCreateTableDefaultPermissions()).append(",");
        if (getTargetDatabase() != null)
            sb.append("TargetDatabase: ").append(getTargetDatabase()).append(",");
        if (getCatalogId() != null)
            sb.append("CatalogId: ").append(getCatalogId()).append(",");
        if (getFederatedDatabase() != null)
            sb.append("FederatedDatabase: ").append(getFederatedDatabase());
        sb.append("}");
        return sb.toString();
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (obj instanceof Database == false)
            return false;
        Database other = (Database) obj;
        if (other.getName() == null ^ this.getName() == null)
            return false;
        if (other.getName() != null && other.getName().equals(this.getName()) == false)
            return false;
        if (other.getDescription() == null ^ this.getDescription() == null)
            return false;
        if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false)
            return false;
        if (other.getLocationUri() == null ^ this.getLocationUri() == null)
            return false;
        if (other.getLocationUri() != null && other.getLocationUri().equals(this.getLocationUri()) == false)
            return false;
        if (other.getParameters() == null ^ this.getParameters() == null)
            return false;
        if (other.getParameters() != null && other.getParameters().equals(this.getParameters()) == false)
            return false;
        if (other.getCreateTime() == null ^ this.getCreateTime() == null)
            return false;
        if (other.getCreateTime() != null && other.getCreateTime().equals(this.getCreateTime()) == false)
            return false;
        if (other.getCreateTableDefaultPermissions() == null ^ this.getCreateTableDefaultPermissions() == null)
            return false;
        if (other.getCreateTableDefaultPermissions() != null
                && other.getCreateTableDefaultPermissions().equals(this.getCreateTableDefaultPermissions()) == false)
            return false;
        if (other.getTargetDatabase() == null ^ this.getTargetDatabase() == null)
            return false;
        if (other.getTargetDatabase() != null && other.getTargetDatabase().equals(this.getTargetDatabase()) == false)
            return false;
        if (other.getCatalogId() == null ^ this.getCatalogId() == null)
            return false;
        if (other.getCatalogId() != null && other.getCatalogId().equals(this.getCatalogId()) == false)
            return false;
        if (other.getFederatedDatabase() == null ^ this.getFederatedDatabase() == null)
            return false;
        if (other.getFederatedDatabase() != null && other.getFederatedDatabase().equals(this.getFederatedDatabase()) == false)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;
        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
        hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode());
        hashCode = prime * hashCode + ((getLocationUri() == null) ? 0 : getLocationUri().hashCode());
        hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode());
        hashCode = prime * hashCode + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        hashCode = prime * hashCode + ((getCreateTableDefaultPermissions() == null) ? 0 : getCreateTableDefaultPermissions().hashCode());
        hashCode = prime * hashCode + ((getTargetDatabase() == null) ? 0 : getTargetDatabase().hashCode());
        hashCode = prime * hashCode + ((getCatalogId() == null) ? 0 : getCatalogId().hashCode());
        hashCode = prime * hashCode + ((getFederatedDatabase() == null) ? 0 : getFederatedDatabase().hashCode());
        return hashCode;
    }
    @Override
    public Database clone() {
        try {
            return (Database) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }
    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.glue.model.transform.DatabaseMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}