text:
package com.amazonaws.services.rds.model;

import java.io.Serializable;
import javax.annotation.Generated;

/**
 *

 * Contains the result of a successful invocation of the following actions:
 *

 *

 *

 *

 * CreateDBSnapshot
 *

 *

 *

 *

 * DeleteDBSnapshot
 *

 *

 *

 *

 * This data type is used as a response element in the DescribeDBSnapshots action.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DBSnapshot implements Serializable, Cloneable {

    /**
     *

     * Specifies the identifier for the DB snapshot.
     *

     */
    private String dBSnapshotIdentifier;
    /**
     *

     * Specifies the DB instance identifier of the DB instance this DB snapshot was created from.
     *

     */
    private String dBInstanceIdentifier;
    /**
     *

     * Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     *

     */
    private java.util.Date snapshotCreateTime;
    /**
     *

     * Specifies the name of the database engine.
     *

     */
    private String engine;
    /**
     *

     * Specifies the allocated storage size in gigabytes (GB).
     *

     */
    private Integer allocatedStorage;
    /**
     *

     * Specifies the status of this DB snapshot.
     *

     */
    private String status;
    /**
     *

     * Specifies the port that the database engine was listening on at the time of the snapshot.
     *

     */
    private Integer port;
    /**
     *

     * Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
     *

     */
    private String availabilityZone;
    /**
     *

     * Provides the VPC ID associated with the DB snapshot.
     *

     */
    private String vpcId;
    /**
     *

     * Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     *

     */
    private java.util.Date instanceCreateTime;
    /**
     *

     * Provides the master username for the DB snapshot.
     *

     */
    private String masterUsername;
    /**
     *

     * Specifies the version of the database engine.
     *

     */
    private String engineVersion;
    /**
     *

     * License model information for the restored DB instance.
     *

     */
    private String licenseModel;
    /**
     *

     * Provides the type of the DB snapshot.
     *

     */
    private String snapshotType;
    /**
     *

     * Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
     *

     */
    private Integer iops;
    /**
     *

     * Provides the option group name for the DB snapshot.
     *

     */
    private String optionGroupName;
    /**
     *

     * The percentage of the estimated data that has been transferred.
     *

     */
    private Integer percentProgress;
    /**
     *

     * The region that the DB snapshot was created in or copied from.
     *

     */
    private String sourceRegion;
    /**
     *

     * The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross
     * region copy.
     *

     */
    private String sourceDBSnapshotIdentifier;
    /**
     *

     * Specifies the storage type associated with DB snapshot.
     *

     */
    private String storageType;
    /**
     *

     * The ARN from the key store with which to associate the instance for TDE encryption.
     *

     */
    private String tdeCredentialArn;
    /**
     *

     * Specifies whether the DB snapshot is encrypted.
     *

     */
    private Boolean encrypted;
    /**
     *

     * If Encrypted is true, the KMS key identifier for the encrypted DB snapshot.
     *

     */
    private String kmsKeyId;
    /**
     *

     * The Amazon Resource Name (ARN) for the DB snapshot.
     *

     */
    private String dBSnapshotArn;
    /**
     *

     * The time zone of the DB snapshot. In most cases, the Timezone element is empty.
     * Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances that were
     * created with a time zone specified.
     *

     */
    private String timezone;
    /**
     *

     * True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled; otherwise
     * false.
     *

     */
    private Boolean iAMDatabaseAuthenticationEnabled;

    /**
     *

     * Specifies the identifier for the DB snapshot.
     *

     *
     * @param dBSnapshotIdentifier
     *        Specifies the identifier for the DB snapshot.
     */

    public void setDBSnapshotIdentifier(String dBSnapshotIdentifier) {
        this.dBSnapshotIdentifier = dBSnapshotIdentifier;
    }

    /**
     *

     * Specifies the identifier for the DB snapshot.
     *

     *
     * @return Specifies the identifier for the DB snapshot.
     */

    public String getDBSnapshotIdentifier() {
        return this.dBSnapshotIdentifier;
    }

    /**
     *

     * Specifies the identifier for the DB snapshot.
     *

     *
     * @param dBSnapshotIdentifier
     *        Specifies the identifier for the DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withDBSnapshotIdentifier(String dBSnapshotIdentifier) {
        setDBSnapshotIdentifier(dBSnapshotIdentifier);
        return this;
    }

    /**
     *

     * Specifies the DB instance identifier of the DB instance this DB snapshot was created from.
     *

     *
     * @param dBInstanceIdentifier
     *        Specifies the DB instance identifier of the DB instance this DB snapshot was created from.
     */

    public void setDBInstanceIdentifier(String dBInstanceIdentifier) {
        this.dBInstanceIdentifier = dBInstanceIdentifier;
    }

    /**
     *

     * Specifies the DB instance identifier of the DB instance this DB snapshot was created from.
     *

     *
     * @return Specifies the DB instance identifier of the DB instance this DB snapshot was created from.
     */

    public String getDBInstanceIdentifier() {
        return this.dBInstanceIdentifier;
    }

    /**
     *

     * Specifies the DB instance identifier of the DB instance this DB snapshot was created from.
     *

     *
     * @param dBInstanceIdentifier
     *        Specifies the DB instance identifier of the DB instance this DB snapshot was created from.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withDBInstanceIdentifier(String dBInstanceIdentifier) {
        setDBInstanceIdentifier(dBInstanceIdentifier);
        return this;
    }

    /**
     *

     * Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     *

     *
     * @param snapshotCreateTime
     *        Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     */

    public void setSnapshotCreateTime(java.util.Date snapshotCreateTime) {
        this.snapshotCreateTime = snapshotCreateTime;
    }

    /**
     *

     * Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     *

     *
     * @return Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     */

    public java.util.Date getSnapshotCreateTime() {
        return this.snapshotCreateTime;
    }

    /**
     *

     * Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     *

     *
     * @param snapshotCreateTime
     *        Provides the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withSnapshotCreateTime(java.util.Date snapshotCreateTime) {
        setSnapshotCreateTime(snapshotCreateTime);
        return this;
    }

    /**
     *

     * Specifies the name of the database engine.
     *

     *
     * @param engine
     *        Specifies the name of the database engine.
     */

    public void setEngine(String engine) {
        this.engine = engine;
    }

    /**
     *

     * Specifies the name of the database engine.
     *

     *
     * @return Specifies the name of the database engine.
     */

    public String getEngine() {
        return this.engine;
    }

    /**
     *

     * Specifies the name of the database engine.
     *

     *
     * @param engine
     *        Specifies the name of the database engine.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withEngine(String engine) {
        setEngine(engine);
        return this;
    }

    /**
     *

     * Specifies the allocated storage size in gigabytes (GB).
     *

     *
     * @param allocatedStorage
     *        Specifies the allocated storage size in gigabytes (GB).
     */

    public void setAllocatedStorage(Integer allocatedStorage) {
        this.allocatedStorage = allocatedStorage;
    }

    /**
     *

     * Specifies the allocated storage size in gigabytes (GB).
     *

     *
     * @return Specifies the allocated storage size in gigabytes (GB).
     */

    public Integer getAllocatedStorage() {
        return this.allocatedStorage;
    }

    /**
     *

     * Specifies the allocated storage size in gigabytes (GB).
     *

     *
     * @param allocatedStorage
     *        Specifies the allocated storage size in gigabytes (GB).
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withAllocatedStorage(Integer allocatedStorage) {
        setAllocatedStorage(allocatedStorage);
        return this;
    }

    /**
     *

     * Specifies the status of this DB snapshot.
     *

     *
     * @param status
     *        Specifies the status of this DB snapshot.
     */

    public void setStatus(String status) {
        this.status = status;
    }

    /**
     *

     * Specifies the status of this DB snapshot.
     *

     *
     * @return Specifies the status of this DB snapshot.
     */

    public String getStatus() {
        return this.status;
    }

    /**
     *

     * Specifies the status of this DB snapshot.
     *

     *
     * @param status
     *        Specifies the status of this DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withStatus(String status) {
        setStatus(status);
        return this;
    }

    /**
     *

     * Specifies the port that the database engine was listening on at the time of the snapshot.
     *

     *
     * @param port
     *        Specifies the port that the database engine was listening on at the time of the snapshot.
     */

    public void setPort(Integer port) {
        this.port = port;
    }

    /**
     *

     * Specifies the port that the database engine was listening on at the time of the snapshot.
     *

     *
     * @return Specifies the port that the database engine was listening on at the time of the snapshot.
     */

    public Integer getPort() {
        return this.port;
    }

    /**
     *

     * Specifies the port that the database engine was listening on at the time of the snapshot.
     *

     *
     * @param port
     *        Specifies the port that the database engine was listening on at the time of the snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withPort(Integer port) {
        setPort(port);
        return this;
    }

    /**
     *

     * Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
     *

     *
     * @param availabilityZone
     *        Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
     */

    public void setAvailabilityZone(String availabilityZone) {
        this.availabilityZone = availabilityZone;
    }

    /**
     *

     * Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
     *

     *
     * @return Specifies the name of the Availability Zone the DB instance was located in at the time of the DB
     *         snapshot.
     */

    public String getAvailabilityZone() {
        return this.availabilityZone;
    }

    /**
     *

     * Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
     *

     *
     * @param availabilityZone
     *        Specifies the name of the Availability Zone the DB instance was located in at the time of the DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withAvailabilityZone(String availabilityZone) {
        setAvailabilityZone(availabilityZone);
        return this;
    }

    /**
     *

     * Provides the VPC ID associated with the DB snapshot.
     *

     *
     * @param vpcId
     *        Provides the VPC ID associated with the DB snapshot.
     */

    public void setVpcId(String vpcId) {
        this.vpcId = vpcId;
    }

    /**
     *

     * Provides the VPC ID associated with the DB snapshot.
     *

     *
     * @return Provides the VPC ID associated with the DB snapshot.
     */

    public String getVpcId() {
        return this.vpcId;
    }

    /**
     *

     * Provides the VPC ID associated with the DB snapshot.
     *

     *
     * @param vpcId
     *        Provides the VPC ID associated with the DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withVpcId(String vpcId) {
        setVpcId(vpcId);
        return this;
    }

    /**
     *

     * Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     *

     *
     * @param instanceCreateTime
     *        Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     */

    public void setInstanceCreateTime(java.util.Date instanceCreateTime) {
        this.instanceCreateTime = instanceCreateTime;
    }

    /**
     *

     * Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     *

     *
     * @return Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     */

    public java.util.Date getInstanceCreateTime() {
        return this.instanceCreateTime;
    }

    /**
     *

     * Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     *

     *
     * @param instanceCreateTime
     *        Specifies the time when the snapshot was taken, in Universal Coordinated Time (UTC).
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withInstanceCreateTime(java.util.Date instanceCreateTime) {
        setInstanceCreateTime(instanceCreateTime);
        return this;
    }

    /**
     *

     * Provides the master username for the DB snapshot.
     *

     *
     * @param masterUsername
     *        Provides the master username for the DB snapshot.
     */

    public void setMasterUsername(String masterUsername) {
        this.masterUsername = masterUsername;
    }

    /**
     *

     * Provides the master username for the DB snapshot.
     *

     *
     * @return Provides the master username for the DB snapshot.
     */

    public String getMasterUsername() {
        return this.masterUsername;
    }

    /**
     *

     * Provides the master username for the DB snapshot.
     *

     *
     * @param masterUsername
     *        Provides the master username for the DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withMasterUsername(String masterUsername) {
        setMasterUsername(masterUsername);
        return this;
    }

    /**
     *

     * Specifies the version of the database engine.
     *

     *
     * @param engineVersion
     *        Specifies the version of the database engine.
     */

    public void setEngineVersion(String engineVersion) {
        this.engineVersion = engineVersion;
    }

    /**
     *

     * Specifies the version of the database engine.
     *

     *
     * @return Specifies the version of the database engine.
     */

    public String getEngineVersion() {
        return this.engineVersion;
    }

    /**
     *

     * Specifies the version of the database engine.
     *

     *
     * @param engineVersion
     *        Specifies the version of the database engine.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withEngineVersion(String engineVersion) {
        setEngineVersion(engineVersion);
        return this;
    }

    /**
     *

     * License model information for the restored DB instance.
     *

     *
     * @param licenseModel
     *        License model information for the restored DB instance.
     */

    public void setLicenseModel(String licenseModel) {
        this.licenseModel = licenseModel;
    }

    /**
     *

     * License model information for the restored DB instance.
     *

     *
     * @return License model information for the restored DB instance.
     */

    public String getLicenseModel() {
        return this.licenseModel;
    }

    /**
     *

     * License model information for the restored DB instance.
     *

     *
     * @param licenseModel
     *        License model information for the restored DB instance.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withLicenseModel(String licenseModel) {
        setLicenseModel(licenseModel);
        return this;
    }

    /**
     *

     * Provides the type of the DB snapshot.
     *

     *
     * @param snapshotType
     *        Provides the type of the DB snapshot.
     */

    public void setSnapshotType(String snapshotType) {
        this.snapshotType = snapshotType;
    }

    /**
     *

     * Provides the type of the DB snapshot.
     *

     *
     * @return Provides the type of the DB snapshot.
     */

    public String getSnapshotType() {
        return this.snapshotType;
    }

    /**
     *

     * Provides the type of the DB snapshot.
     *

     *
     * @param snapshotType
     *        Provides the type of the DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withSnapshotType(String snapshotType) {
        setSnapshotType(snapshotType);
        return this;
    }

    /**
     *

     * Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
     *

     *
     * @param iops
     *        Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the
     *        snapshot.
     */

    public void setIops(Integer iops) {
        this.iops = iops;
    }

    /**
     *

     * Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
     *

     *
     * @return Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the
     *         snapshot.
     */

    public Integer getIops() {
        return this.iops;
    }

    /**
     *

     * Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
     *

     *
     * @param iops
     *        Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the
     *        snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withIops(Integer iops) {
        setIops(iops);
        return this;
    }

    /**
     *

     * Provides the option group name for the DB snapshot.
     *

     *
     * @param optionGroupName
     *        Provides the option group name for the DB snapshot.
     */

    public void setOptionGroupName(String optionGroupName) {
        this.optionGroupName = optionGroupName;
    }

    /**
     *

     * Provides the option group name for the DB snapshot.
     *

     *
     * @return Provides the option group name for the DB snapshot.
     */

    public String getOptionGroupName() {
        return this.optionGroupName;
    }

    /**
     *

     * Provides the option group name for the DB snapshot.
     *

     *
     * @param optionGroupName
     *        Provides the option group name for the DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withOptionGroupName(String optionGroupName) {
        setOptionGroupName(optionGroupName);
        return this;
    }

    /**
     *

     * The percentage of the estimated data that has been transferred.
     *

     *
     * @param percentProgress
     *        The percentage of the estimated data that has been transferred.
     */

    public void setPercentProgress(Integer percentProgress) {
        this.percentProgress = percentProgress;
    }

    /**
     *

     * The percentage of the estimated data that has been transferred.
     *

     *
     * @return The percentage of the estimated data that has been transferred.
     */

    public Integer getPercentProgress() {
        return this.percentProgress;
    }

    /**
     *

     * The percentage of the estimated data that has been transferred.
     *

     *
     * @param percentProgress
     *        The percentage of the estimated data that has been transferred.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withPercentProgress(Integer percentProgress) {
        setPercentProgress(percentProgress);
        return this;
    }

    /**
     *

     * The region that the DB snapshot was created in or copied from.
     *

     *
     * @param sourceRegion
     *        The region that the DB snapshot was created in or copied from.
     */

    public void setSourceRegion(String sourceRegion) {
        this.sourceRegion = sourceRegion;
    }

    /**
     *

     * The region that the DB snapshot was created in or copied from.
     *

     *
     * @return The region that the DB snapshot was created in or copied from.
     */

    public String getSourceRegion() {
        return this.sourceRegion;
    }

    /**
     *

     * The region that the DB snapshot was created in or copied from.
     *

     *
     * @param sourceRegion
     *        The region that the DB snapshot was created in or copied from.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withSourceRegion(String sourceRegion) {
        setSourceRegion(sourceRegion);
        return this;
    }

    /**
     *

     * The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross
     * region copy.
     *

     *
     * @param sourceDBSnapshotIdentifier
     *        The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or
     *        cross region copy.
     */

    public void setSourceDBSnapshotIdentifier(String sourceDBSnapshotIdentifier) {
        this.sourceDBSnapshotIdentifier = sourceDBSnapshotIdentifier;
    }

    /**
     *

     * The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross
     * region copy.
     *

     *
     * @return The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or
     *         cross region copy.
     */

    public String getSourceDBSnapshotIdentifier() {
        return this.sourceDBSnapshotIdentifier;
    }

    /**
     *

     * The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or cross
     * region copy.
     *

     *
     * @param sourceDBSnapshotIdentifier
     *        The DB snapshot Arn that the DB snapshot was copied from. It only has value in case of cross customer or
     *        cross region copy.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withSourceDBSnapshotIdentifier(String sourceDBSnapshotIdentifier) {
        setSourceDBSnapshotIdentifier(sourceDBSnapshotIdentifier);
        return this;
    }

    /**
     *

     * Specifies the storage type associated with DB snapshot.
     *

     *
     * @param storageType
     *        Specifies the storage type associated with DB snapshot.
     */

    public void setStorageType(String storageType) {
        this.storageType = storageType;
    }

    /**
     *

     * Specifies the storage type associated with DB snapshot.
     *

     *
     * @return Specifies the storage type associated with DB snapshot.
     */

    public String getStorageType() {
        return this.storageType;
    }

    /**
     *

     * Specifies the storage type associated with DB snapshot.
     *

     *
     * @param storageType
     *        Specifies the storage type associated with DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withStorageType(String storageType) {
        setStorageType(storageType);
        return this;
    }

    /**
     *

     * The ARN from the key store with which to associate the instance for TDE encryption.
     *

     *
     * @param tdeCredentialArn
     *        The ARN from the key store with which to associate the instance for TDE encryption.
     */

    public void setTdeCredentialArn(String tdeCredentialArn) {
        this.tdeCredentialArn = tdeCredentialArn;
    }

    /**
     *

     * The ARN from the key store with which to associate the instance for TDE encryption.
     *

     *
     * @return The ARN from the key store with which to associate the instance for TDE encryption.
     */

    public String getTdeCredentialArn() {
        return this.tdeCredentialArn;
    }

    /**
     *

     * The ARN from the key store with which to associate the instance for TDE encryption.
     *

     *
     * @param tdeCredentialArn
     *        The ARN from the key store with which to associate the instance for TDE encryption.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withTdeCredentialArn(String tdeCredentialArn) {
        setTdeCredentialArn(tdeCredentialArn);
        return this;
    }

    /**
     *

     * Specifies whether the DB snapshot is encrypted.
     *

     *
     * @param encrypted
     *        Specifies whether the DB snapshot is encrypted.
     */

    public void setEncrypted(Boolean encrypted) {
        this.encrypted = encrypted;
    }

    /**
     *

     * Specifies whether the DB snapshot is encrypted.
     *

     *
     * @return Specifies whether the DB snapshot is encrypted.
     */

    public Boolean getEncrypted() {
        return this.encrypted;
    }

    /**
     *

     * Specifies whether the DB snapshot is encrypted.
     *

     *
     * @param encrypted
     *        Specifies whether the DB snapshot is encrypted.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withEncrypted(Boolean encrypted) {
        setEncrypted(encrypted);
        return this;
    }

    /**
     *

     * Specifies whether the DB snapshot is encrypted.
     *

     *
     * @return Specifies whether the DB snapshot is encrypted.
     */

    public Boolean isEncrypted() {
        return this.encrypted;
    }

    /**
     *

     * If Encrypted is true, the KMS key identifier for the encrypted DB snapshot.
     *

     *
     * @param kmsKeyId
     *        If Encrypted is true, the KMS key identifier for the encrypted DB snapshot.
     */

    public void setKmsKeyId(String kmsKeyId) {
        this.kmsKeyId = kmsKeyId;
    }

    /**
     *

     * If Encrypted is true, the KMS key identifier for the encrypted DB snapshot.
     *

     *
     * @return If Encrypted is true, the KMS key identifier for the encrypted DB snapshot.
     */

    public String getKmsKeyId() {
        return this.kmsKeyId;
    }

    /**
     *

     * If Encrypted is true, the KMS key identifier for the encrypted DB snapshot.
     *

     *
     * @param kmsKeyId
     *        If Encrypted is true, the KMS key identifier for the encrypted DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withKmsKeyId(String kmsKeyId) {
        setKmsKeyId(kmsKeyId);
        return this;
    }

    /**
     *

     * The Amazon Resource Name (ARN) for the DB snapshot.
     *

     *
     * @param dBSnapshotArn
     *        The Amazon Resource Name (ARN) for the DB snapshot.
     */

    public void setDBSnapshotArn(String dBSnapshotArn) {
        this.dBSnapshotArn = dBSnapshotArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) for the DB snapshot.
     *

     *
     * @return The Amazon Resource Name (ARN) for the DB snapshot.
     */

    public String getDBSnapshotArn() {
        return this.dBSnapshotArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) for the DB snapshot.
     *

     *
     * @param dBSnapshotArn
     *        The Amazon Resource Name (ARN) for the DB snapshot.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withDBSnapshotArn(String dBSnapshotArn) {
        setDBSnapshotArn(dBSnapshotArn);
        return this;
    }

    /**
     *

     * The time zone of the DB snapshot. In most cases, the Timezone element is empty.
     * Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances that were
     * created with a time zone specified.
     *

     *
     * @param timezone
     *        The time zone of the DB snapshot. In most cases, the Timezone element is empty.
     *        Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances that
     *        were created with a time zone specified.
     */

    public void setTimezone(String timezone) {
        this.timezone = timezone;
    }

    /**
     *

     * The time zone of the DB snapshot. In most cases, the Timezone element is empty.
     * Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances that were
     * created with a time zone specified.
     *

     *
     * @return The time zone of the DB snapshot. In most cases, the Timezone element is empty.
     *         Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances
     *         that were created with a time zone specified.
     */

    public String getTimezone() {
        return this.timezone;
    }

    /**
     *

     * The time zone of the DB snapshot. In most cases, the Timezone element is empty.
     * Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances that were
     * created with a time zone specified.
     *

     *
     * @param timezone
     *        The time zone of the DB snapshot. In most cases, the Timezone element is empty.
     *        Timezone content appears only for snapshots taken from Microsoft SQL Server DB instances that
     *        were created with a time zone specified.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withTimezone(String timezone) {
        setTimezone(timezone);
        return this;
    }

    /**
     *

     * True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled; otherwise
     * false.
     *

     *
     * @param iAMDatabaseAuthenticationEnabled
     *        True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled;
     *        otherwise false.
     */

    public void setIAMDatabaseAuthenticationEnabled(Boolean iAMDatabaseAuthenticationEnabled) {
        this.iAMDatabaseAuthenticationEnabled = iAMDatabaseAuthenticationEnabled;
    }

    /**
     *

     * True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled; otherwise
     * false.
     *

     *
     * @return True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled;
     *         otherwise false.
     */

    public Boolean getIAMDatabaseAuthenticationEnabled() {
        return this.iAMDatabaseAuthenticationEnabled;
    }

    /**
     *

     * True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled; otherwise
     * false.
     *

     *
     * @param iAMDatabaseAuthenticationEnabled
     *        True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled;
     *        otherwise false.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DBSnapshot withIAMDatabaseAuthenticationEnabled(Boolean iAMDatabaseAuthenticationEnabled) {
        setIAMDatabaseAuthenticationEnabled(iAMDatabaseAuthenticationEnabled);
        return this;
    }

    /**
     *

     * True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled; otherwise
     * false.
     *

     *
     * @return True if mapping of AWS Identity and Access Management (IAM) accounts to database accounts is enabled;
     *         otherwise false.
     */

    public Boolean isIAMDatabaseAuthenticationEnabled() {
        return this.iAMDatabaseAuthenticationEnabled;
    }

    /**
     * Returns a string representation of this object; useful for testing and debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getDBSnapshotIdentifier() != null)
            sb.append("DBSnapshotIdentifier: ").append(getDBSnapshotIdentifier()).append(",");
        if (getDBInstanceIdentifier() != null)
            sb.append("DBInstanceIdentifier: ").append(getDBInstanceIdentifier()).append(",");
        if (getSnapshotCreateTime() != null)
            sb.append("SnapshotCreateTime: ").append(getSnapshotCreateTime()).append(",");
        if (getEngine() != null)
            sb.append("Engine: ").append(getEngine()).append(",");
        if (getAllocatedStorage() != null)
            sb.append("AllocatedStorage: ").append(getAllocatedStorage()).append(",");
        if (getStatus() != null)
            sb.append("Status: ").append(getStatus()).append(",");
        if (getPort() != null)
            sb.append("Port: ").append(getPort()).append(",");
        if (getAvailabilityZone() != null)
            sb.append("AvailabilityZone: ").append(getAvailabilityZone()).append(",");
        if (getVpcId() != null)
            sb.append("VpcId: ").append(getVpcId()).append(",");
        if (getInstanceCreateTime() != null)
            sb.append("InstanceCreateTime: ").append(getInstanceCreateTime()).append(",");
        if (getMasterUsername() != null)
            sb.append("MasterUsername: ").append(getMasterUsername()).append(",");
        if (getEngineVersion() != null)
            sb.append("EngineVersion: ").append(getEngineVersion()).append(",");
        if (getLicenseModel() != null)
            sb.append("LicenseModel: ").append(getLicenseModel()).append(",");
        if (getSnapshotType() != null)
            sb.append("SnapshotType: ").append(getSnapshotType()).append(",");
        if (getIops() != null)
            sb.append("Iops: ").append(getIops()).append(",");
        if (getOptionGroupName() != null)
            sb.append("OptionGroupName: ").append(getOptionGroupName()).append(",");
        if (getPercentProgress() != null)
            sb.append("PercentProgress: ").append(getPercentProgress()).append(",");
        if (getSourceRegion() != null)
            sb.append("SourceRegion: ").append(getSourceRegion()).append(",");
        if (getSourceDBSnapshotIdentifier() != null)
            sb.append("SourceDBSnapshotIdentifier: ").append(getSourceDBSnapshotIdentifier()).append(",");
        if (getStorageType() != null)
            sb.append("StorageType: ").append(getStorageType()).append(",");
        if (getTdeCredentialArn() != null)
            sb.append("TdeCredentialArn: ").append(getTdeCredentialArn()).append(",");
        if (getEncrypted() != null)
            sb.append("Encrypted: ").append(getEncrypted()).append(",");
        if (getKmsKeyId() != null)
            sb.append("KmsKeyId: ").append(getKmsKeyId()).append(",");
        if (getDBSnapshotArn() != null)
            sb.append("DBSnapshotArn: ").append(getDBSnapshotArn()).append(",");
        if (getTimezone() != null)
            sb.append("Timezone: ").append(getTimezone()).append(",");
        if (getIAMDatabaseAuthenticationEnabled() != null)
            sb.append("IAMDatabaseAuthenticationEnabled: ").append(getIAMDatabaseAuthenticationEnabled());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof DBSnapshot == false)
            return false;
        DBSnapshot other = (DBSnapshot) obj;
        if (other.getDBSnapshotIdentifier() == null ^ this.getDBSnapshotIdentifier() == null)
            return false;
        if (other.getDBSnapshotIdentifier() != null && other.getDBSnapshotIdentifier().equals(this.getDBSnapshotIdentifier()) == false)
            return false;
        if (other.getDBInstanceIdentifier() == null ^ this.getDBInstanceIdentifier() == null)
            return false;
        if (other.getDBInstanceIdentifier() != null && other.getDBInstanceIdentifier().equals(this.getDBInstanceIdentifier()) == false)
            return false;
        if (other.getSnapshotCreateTime() == null ^ this.getSnapshotCreateTime() == null)
            return false;
        if (other.getSnapshotCreateTime() != null && other.getSnapshotCreateTime().equals(this.getSnapshotCreateTime()) == false)
            return false;
        if (other.getEngine() == null ^ this.getEngine() == null)
            return false;
        if (other.getEngine() != null && other.getEngine().equals(this.getEngine()) == false)
            return false;
        if (other.getAllocatedStorage() == null ^ this.getAllocatedStorage() == null)
            return false;
        if (other.getAllocatedStorage() != null && other.getAllocatedStorage().equals(this.getAllocatedStorage()) == false)
            return false;
        if (other.getStatus() == null ^ this.getStatus() == null)
            return false;
        if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false)
            return false;
        if (other.getPort() == null ^ this.getPort() == null)
            return false;
        if (other.getPort() != null && other.getPort().equals(this.getPort()) == false)
            return false;
        if (other.getAvailabilityZone() == null ^ this.getAvailabilityZone() == null)
            return false;
        if (other.getAvailabilityZone() != null && other.getAvailabilityZone().equals(this.getAvailabilityZone()) == false)
            return false;
        if (other.getVpcId() == null ^ this.getVpcId() == null)
            return false;
        if (other.getVpcId() != null && other.getVpcId().equals(this.getVpcId()) == false)
            return false;
        if (other.getInstanceCreateTime() == null ^ this.getInstanceCreateTime() == null)
            return false;
        if (other.getInstanceCreateTime() != null && other.getInstanceCreateTime().equals(this.getInstanceCreateTime()) == false)
            return false;
        if (other.getMasterUsername() == null ^ this.getMasterUsername() == null)
            return false;
        if (other.getMasterUsername() != null && other.getMasterUsername().equals(this.getMasterUsername()) == false)
            return false;
        if (other.getEngineVersion() == null ^ this.getEngineVersion() == null)
            return false;
        if (other.getEngineVersion() != null && other.getEngineVersion().equals(this.getEngineVersion()) == false)
            return false;
        if (other.getLicenseModel() == null ^ this.getLicenseModel() == null)
            return false;
        if (other.getLicenseModel() != null && other.getLicenseModel().equals(this.getLicenseModel()) == false)
            return false;
        if (other.getSnapshotType() == null ^ this.getSnapshotType() == null)
            return false;
        if (other.getSnapshotType() != null && other.getSnapshotType().equals(this.getSnapshotType()) == false)
            return false;
        if (other.getIops() == null ^ this.getIops() == null)
            return false;
        if (other.getIops() != null && other.getIops().equals(this.getIops()) == false)
            return false;
        if (other.getOptionGroupName() == null ^ this.getOptionGroupName() == null)
            return false;
        if (other.getOptionGroupName() != null && other.getOptionGroupName().equals(this.getOptionGroupName()) == false)
            return false;
        if (other.getPercentProgress() == null ^ this.getPercentProgress() == null)
            return false;
        if (other.getPercentProgress() != null && other.getPercentProgress().equals(this.getPercentProgress()) == false)
            return false;
        if (other.getSourceRegion() == null ^ this.getSourceRegion() == null)
            return false;
        if (other.getSourceRegion() != null && other.getSourceRegion().equals(this.getSourceRegion()) == false)
            return false;
        if (other.getSourceDBSnapshotIdentifier() == null ^ this.getSourceDBSnapshotIdentifier() == null)
            return false;
        if (other.getSourceDBSnapshotIdentifier() != null && other.getSourceDBSnapshotIdentifier().equals(this.getSourceDBSnapshotIdentifier()) == false)
            return false;
        if (other.getStorageType() == null ^ this.getStorageType() == null)
            return false;
        if (other.getStorageType() != null && other.getStorageType().equals(this.getStorageType()) == false)
            return false;
        if (other.getTdeCredentialArn() == null ^ this.getTdeCredentialArn() == null)
            return false;
        if (other.getTdeCredentialArn() != null && other.getTdeCredentialArn().equals(this.getTdeCredentialArn()) == false)
            return false;
        if (other.getEncrypted() == null ^ this.getEncrypted() == null)
            return false;
        if (other.getEncrypted() != null && other.getEncrypted().equals(this.getEncrypted()) == false)
            return false;
        if (other.getKmsKeyId() == null ^ this.getKmsKeyId() == null)
            return false;
        if (other.getKmsKeyId() != null && other.getKmsKeyId().equals(this.getKmsKeyId()) == false)
            return false;
        if (other.getDBSnapshotArn() == null ^ this.getDBSnapshotArn() == null)
            return false;
        if (other.getDBSnapshotArn() != null && other.getDBSnapshotArn().equals(this.getDBSnapshotArn()) == false)
            return false;
        if (other.getTimezone() == null ^ this.getTimezone() == null)
            return false;
        if (other.getTimezone() != null && other.getTimezone().equals(this.getTimezone()) == false)
            return false;
        if (other.getIAMDatabaseAuthenticationEnabled() == null ^ this.getIAMDatabaseAuthenticationEnabled() == null)
            return false;
        if (other.getIAMDatabaseAuthenticationEnabled() != null
                && other.getIAMDatabaseAuthenticationEnabled().equals(this.getIAMDatabaseAuthenticationEnabled()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getDBSnapshotIdentifier() == null) ? 0 : getDBSnapshotIdentifier().hashCode());
        hashCode = prime * hashCode + ((getDBInstanceIdentifier() == null) ? 0 : getDBInstanceIdentifier().hashCode());
        hashCode = prime * hashCode + ((getSnapshotCreateTime() == null) ? 0 : getSnapshotCreateTime().hashCode());
        hashCode = prime * hashCode + ((getEngine() == null) ? 0 : getEngine().hashCode());
        hashCode = prime * hashCode + ((getAllocatedStorage() == null) ? 0 : getAllocatedStorage().hashCode());
        hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode());
        hashCode = prime * hashCode + ((getPort() == null) ? 0 : getPort().hashCode());
        hashCode = prime * hashCode + ((getAvailabilityZone() == null) ? 0 : getAvailabilityZone().hashCode());
        hashCode = prime * hashCode + ((getVpcId() == null) ? 0 : getVpcId().hashCode());
        hashCode = prime * hashCode + ((getInstanceCreateTime() == null) ? 0 : getInstanceCreateTime().hashCode());
        hashCode = prime * hashCode + ((getMasterUsername() == null) ? 0 : getMasterUsername().hashCode());
        hashCode = prime * hashCode + ((getEngineVersion() == null) ? 0 : getEngineVersion().hashCode());
        hashCode = prime * hashCode + ((getLicenseModel() == null) ? 0 : getLicenseModel().hashCode());
        hashCode = prime * hashCode + ((getSnapshotType() == null) ? 0 : getSnapshotType().hashCode());
        hashCode = prime * hashCode + ((getIops() == null) ? 0 : getIops().hashCode());
        hashCode = prime * hashCode + ((getOptionGroupName() == null) ? 0 : getOptionGroupName().hashCode());
        hashCode = prime * hashCode + ((getPercentProgress() == null) ? 0 : getPercentProgress().hashCode());
        hashCode = prime * hashCode + ((getSourceRegion() == null) ? 0 : getSourceRegion().hashCode());
        hashCode = prime * hashCode + ((getSourceDBSnapshotIdentifier() == null) ? 0 : getSourceDBSnapshotIdentifier().hashCode());
        hashCode = prime * hashCode + ((getStorageType() == null) ? 0 : getStorageType().hashCode());
        hashCode = prime * hashCode + ((getTdeCredentialArn() == null) ? 0 : getTdeCredentialArn().hashCode());
        hashCode = prime * hashCode + ((getEncrypted() == null) ? 0 : getEncrypted().hashCode());
        hashCode = prime * hashCode + ((getKmsKeyId() == null) ? 0 : getKmsKeyId().hashCode());
        hashCode = prime * hashCode + ((getDBSnapshotArn() == null) ? 0 : getDBSnapshotArn().hashCode());
        hashCode = prime * hashCode + ((getTimezone() == null) ? 0 : getTimezone().hashCode());
        hashCode = prime * hashCode + ((getIAMDatabaseAuthenticationEnabled() == null) ? 0 : getIAMDatabaseAuthenticationEnabled().hashCode());
        return hashCode;
    }

    @Override
    public DBSnapshot clone() {
        try {
            return (DBSnapshot) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

}


text:
package org.elasticsearch.ingest.geoip;

import com.maxmind.db.NoCache;
import com.maxmind.db.NodeCache;
import com.maxmind.db.Reader;
import com.maxmind.geoip2.DatabaseReader;
import com.maxmind.geoip2.model.AbstractResponse;
import org.elasticsearch.common.Booleans;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.cache.Cache;
import org.elasticsearch.common.cache.CacheBuilder;
import org.elasticsearch.common.io.PathUtils;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.core.internal.io.IOUtils;
import org.elasticsearch.ingest.Processor;
import org.elasticsearch.plugins.IngestPlugin;
import org.elasticsearch.plugins.Plugin;

import java.io.Closeable;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Stream;

public class IngestGeoIpPlugin extends Plugin implements IngestPlugin, Closeable {
    public static final Setting<Long> CACHE_SIZE =
        Setting.longSetting("ingest.geoip.cache_size", 1000, 0, Setting.Property.NodeScope);

    static String[] DEFAULT_DATABASE_FILENAMES = new String[]{"GeoLite2-ASN.mmdb", "GeoLite2-City.mmdb", "GeoLite2-Country.mmdb"};

    private Map<String, DatabaseReaderLazyLoader> databaseReaders;

    @Override
    public List<Setting<?>> getSettings() {
        return Arrays.asList(CACHE_SIZE);
    }

    @Override
    public Map<String, Processor.Factory> getProcessors(Processor.Parameters parameters) {
        if (databaseReaders != null) {
            throw new IllegalStateException("getProcessors called twice for geoip plugin!!");
        }
        final Path geoIpDirectory = getGeoIpDirectory(parameters);
        final Path geoIpConfigDirectory = parameters.env.configFile().resolve("ingest-geoip");
        long cacheSize = CACHE_SIZE.get(parameters.env.settings());
        try {
            databaseReaders = loadDatabaseReaders(geoIpDirectory, geoIpConfigDirectory);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        return Collections.singletonMap(GeoIpProcessor.TYPE, new GeoIpProcessor.Factory(databaseReaders, new GeoIpCache(cacheSize)));
    }

    /*
     * In GeoIpProcessorNonIngestNodeTests, ingest-geoip is loaded on the classpath. This means that the plugin is never unbundled into a
     * directory where the database files would live. Therefore, we have to copy these database files ourselves. To do this, we need the
     * ability to specify where those database files would go. We do this by adding a plugin that registers ingest.geoip.database_path as
     * an actual setting. Otherwise, in production code, this setting is not registered and the database path is not configurable.
     */
    @SuppressForbidden(reason = "PathUtils#get")
    private Path getGeoIpDirectory(Processor.Parameters parameters) {
        final Path geoIpDirectory;
        if (parameters.env.settings().get("ingest.geoip.database_path") == null) {
            geoIpDirectory = parameters.env.modulesFile().resolve("ingest-geoip");
        } else {
            geoIpDirectory = PathUtils.get(parameters.env.settings().get("ingest.geoip.database_path"));
        }
        return geoIpDirectory;
    }

    static Map<String, DatabaseReaderLazyLoader> loadDatabaseReaders(Path geoIpDirectory, Path geoIpConfigDirectory) throws IOException {
        assertDatabaseExistence(geoIpDirectory, true);
        assertDatabaseExistence(geoIpConfigDirectory, false);
        final boolean loadDatabaseOnHeap = Booleans.parseBoolean(System.getProperty("es.geoip.load_db_on_heap", "false"));
        final Map<String, DatabaseReaderLazyLoader> databaseReaders = new HashMap<>();

        // load the default databases
        for (final String databaseFilename : DEFAULT_DATABASE_FILENAMES) {
            final Path databasePath = geoIpDirectory.resolve(databaseFilename);
            final DatabaseReaderLazyLoader loader = createLoader(databasePath, loadDatabaseOnHeap);
            databaseReaders.put(databaseFilename, loader);
        }

        // load any custom databases
        if (Files.exists(geoIpConfigDirectory)) {
            try (Stream<Path> databaseFiles = Files.list(geoIpConfigDirectory)) {
                PathMatcher pathMatcher = geoIpConfigDirectory.getFileSystem().getPathMatcher("glob:**.mmdb");
                // Use iterator instead of forEach otherwise IOException needs to be caught twice...
                Iterator<Path> iterator = databaseFiles.iterator();
                while (iterator.hasNext()) {
                    Path databasePath = iterator.next();
                    if (Files.isRegularFile(databasePath) && pathMatcher.matches(databasePath)) {
                        String databaseFileName = databasePath.getFileName().toString();
                        final DatabaseReaderLazyLoader loader = createLoader(databasePath, loadDatabaseOnHeap);
                        databaseReaders.put(databaseFileName, loader);
                    }
                }
            }
        }
        return Collections.unmodifiableMap(databaseReaders);
    }

    private static DatabaseReaderLazyLoader createLoader(Path databasePath, boolean loadDatabaseOnHeap) {
        return new DatabaseReaderLazyLoader(
                databasePath,
                () -> {
                    DatabaseReader.Builder builder = createDatabaseBuilder(databasePath).withCache(NoCache.getInstance());
                    if (loadDatabaseOnHeap) {
                        builder.fileMode(Reader.FileMode.MEMORY);
                    } else {
                        builder.fileMode(Reader.FileMode.MEMORY_MAPPED);
                    }
                    return builder.build();
                });
    }

    private static void assertDatabaseExistence(final Path path, final boolean exists) throws IOException {
        for (final String database : DEFAULT_DATABASE_FILENAMES) {
            if (Files.exists(path.resolve(database)) != exists) {
                final String message = "expected database [" + database + "] to " + (exists ? "" : "not ") + "exist in [" + path + "]";
                throw new IOException(message);
            }
        }
    }

    @SuppressForbidden(reason = "Maxmind API requires java.io.File")
    private static DatabaseReader.Builder createDatabaseBuilder(Path databasePath) {
        return new DatabaseReader.Builder(databasePath.toFile());
    }

    @Override
    public void close() throws IOException {
        if (databaseReaders != null) {
            IOUtils.close(databaseReaders.values());
        }
    }

    /**
     * The in-memory cache for the geoip data. There should only be 1 instance of this class..
     * This cache differs from the maxmind's {@link NodeCache} such that this cache stores the deserialized Json objects to avoid the
     * cost of deserialization for each lookup (cached or not). This comes at slight expense of higher memory usage, but significant
     * reduction of CPU usage.
     */
    static class GeoIpCache {
        private final Cache<CacheKey<?>, AbstractResponse> cache;

        //package private for testing
        GeoIpCache(long maxSize) {
            if (maxSize < 0) {
                throw new IllegalArgumentException("geoip max cache size must be 0 or greater");
            }
            this.cache = CacheBuilder.<CacheKey<?>, AbstractResponse>builder().setMaximumWeight(maxSize).build();
        }

        <T extends AbstractResponse> T putIfAbsent(InetAddress ip, Class<T> responseType,
                                                   Function<InetAddress, AbstractResponse> retrieveFunction) {

            //can't use cache.computeIfAbsent due to the elevated permissions for the jackson (run via the cache loader)
            CacheKey<T> cacheKey = new CacheKey<>(ip, responseType);
            //intentionally non-locking for simplicity...it's OK if we re-put the same key/value in the cache during a race condition.
            AbstractResponse response = cache.get(cacheKey);
            if (response == null) {
                response = retrieveFunction.apply(ip);
                cache.put(cacheKey, response);
            }
            return responseType.cast(response);
        }

        //only useful for testing
        <T extends AbstractResponse> T get(InetAddress ip, Class<T> responseType) {
            CacheKey<T> cacheKey = new CacheKey<>(ip, responseType);
            return responseType.cast(cache.get(cacheKey));
        }

         /**
         * The key to use for the cache. Since this cache can span multiple geoip processors that all use different databases, the response
         * type is needed to be included in the cache key. For example, if we only used the IP address as the key the City and ASN the same
         * IP may be in both with different values and we need to cache both. The response type scopes the IP to the correct database
         * provides a means to safely cast the return objects.
         * @param <T> The AbstractResponse type used to scope the key and cast the result.
         */
        private static class CacheKey<T extends AbstractResponse> {

            private final InetAddress ip;
            private final Class<T> responseType;

            private CacheKey(InetAddress ip, Class<T> responseType) {
                this.ip = ip;
                this.responseType = responseType;
            }

            //generated
            @Override
            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;
                CacheKey<?> cacheKey = (CacheKey<?>) o;
                return Objects.equals(ip, cacheKey.ip) &&
                    Objects.equals(responseType, cacheKey.responseType);
            }

            //generated
            @Override
            public int hashCode() {
                return Objects.hash(ip, responseType);
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Sbts\Bundle\CommentBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

use Sbts\Bundle\IssueBundle\Entity\Issue;
use Sbts\Bundle\UserBundle\Entity\User;

/**
 * Comment
 *
 * @ORM\Table(name="sbts_comment")
 * @ORM\Entity()
 * @ORM\HasLifecycleCallbacks()
 */
class Comment
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity="Sbts\Bundle\UserBundle\Entity\User", inversedBy="comments")
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
     **/
    private $author;

    /**
     * @var string
     *
     * @ORM\Column(name="body", type="text")
     */
    private $body;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="created_at", type="datetime")
     */
    private $created;

    /**
     * @ORM\ManyToOne(targetEntity="Sbts\Bundle\IssueBundle\Entity\Issue", inversedBy="comments")
     * @ORM\JoinColumn(name="issue_id", referencedColumnName="id", onDelete="CASCADE")
     **/
    private $issue;

    /**
     * Gets id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Sets a user who is the author of this comment
     *
     * @param User $author
     *
     * @return Comment
     */
    public function setAuthor(User $author)
    {
        $this->author = $author;

        return $this;
    }

    /**
     * Gets a user who is the author of this comment
     *
     * @return User
     */
    public function getAuthor()
    {
        return $this->author;
    }

    /**
     * Sets comment body
     *
     * @param string $body
     *
     * @return Comment
     */
    public function setBody($body)
    {
        $this->body = $body;

        return $this;
    }

    /**
     * Gets comment body
     *
     * @return string
     */
    public function getBody()
    {
        return $this->body;
    }

    /**
     * Sets created
     *
     * @param \DateTime $created
     *
     * @return Comment
     */
    public function setCreated($created)
    {
        $this->created = $created;

        return $this;
    }

    /**
     * Gets created
     *
     * @return \DateTime
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * Sets issue which was commented
     *
     * @param Issue $issue
     *
     * @return Comment
     */
    public function setIssue(Issue $issue)
    {
        $this->issue = $issue;

        return $this;
    }

    /**
     * Gets issue which was commented
     *
     * @return Issue
     */
    public function getIssue()
    {
        return $this->issue;
    }

    /**
     * @ORM\PrePersist()
     */
    public function prePersistAction()
    {
        $this->setCreated(new \DateTime());
    }
}


text:
package com.amazonaws.services.groundstation.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.groundstation.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * MissionProfileListItemMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class MissionProfileListItemMarshaller {

    private static final MarshallingInfo<String> MISSIONPROFILEARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("missionProfileArn").build();
    private static final MarshallingInfo<String> MISSIONPROFILEID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("missionProfileId").build();
    private static final MarshallingInfo<String> NAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("name").build();
    private static final MarshallingInfo<String> REGION_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("region").build();

    private static final MissionProfileListItemMarshaller instance = new MissionProfileListItemMarshaller();

    public static MissionProfileListItemMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(MissionProfileListItem missionProfileListItem, ProtocolMarshaller protocolMarshaller) {

        if (missionProfileListItem == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(missionProfileListItem.getMissionProfileArn(), MISSIONPROFILEARN_BINDING);
            protocolMarshaller.marshall(missionProfileListItem.getMissionProfileId(), MISSIONPROFILEID_BINDING);
            protocolMarshaller.marshall(missionProfileListItem.getName(), NAME_BINDING);
            protocolMarshaller.marshall(missionProfileListItem.getRegion(), REGION_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
	<appenders>
		<RollingFile name="MyRollingFile" fileName="logs/app.log"
			filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
			<PatternLayout>
				<pattern>%d [%t] %-5level %msg%n</pattern>
			</PatternLayout>
			<Policies>
				<TimeBasedTriggeringPolicy />
				<SizeBasedTriggeringPolicy size="2 MB" />
			</Policies>
			<DefaultRolloverStrategy max="100" />
		</RollingFile>
		<RollingFile name="BetScreen" fileName="logs/betscreen.log"
			filePattern="logs/$${date:yyyy-MM}/screen-%d{MM-dd-yyyy}-%i.log.gz">
			<PatternLayout>
				<pattern>%d [%t] %-5level %msg%n</pattern>
			</PatternLayout>
			<Policies>
				<TimeBasedTriggeringPolicy />
				<SizeBasedTriggeringPolicy size="2 MB" />
			</Policies>
			<DefaultRolloverStrategy max="100" />
		</RollingFile>
		<Console name="Console" target="SYSTEM_OUT">
			<PatternLayout pattern="%d [%t] %-5level %msg%n" />
		</Console>
	</appenders>
	<loggers>
		<root additivity="false" level="INFO">
			<appender-ref ref="Console" />
			<appender-ref ref="MyRollingFile" />
		</root>
	</loggers>
</configuration>


text:
package com.sequenceiq.cloudbreak.service.stack;

import java.util.Set;
import java.util.stream.Collectors;

import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.sequenceiq.cloudbreak.auth.altus.EntitlementService;
import com.sequenceiq.cloudbreak.auth.crn.Crn;
import com.sequenceiq.cloudbreak.common.orchestration.Node;
import com.sequenceiq.cloudbreak.domain.stack.DnsResolverType;
import com.sequenceiq.cloudbreak.dto.StackDto;
import com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator;
import com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig;
import com.sequenceiq.cloudbreak.service.GatewayConfigService;
import com.sequenceiq.cloudbreak.util.StackUtil;
import com.sequenceiq.cloudbreak.view.StackView;

@Service
public class TargetedUpscaleSupportService {

    private static final Logger LOGGER = LoggerFactory.getLogger(TargetedUpscaleSupportService.class);

    @Inject
    private GatewayConfigService gatewayConfigService;

    @Inject
    private EntitlementService entitlementService;

    @Inject
    private HostOrchestrator hostOrchestrator;

    @Inject
    private StackUtil stackUtil;

    public boolean targetedUpscaleOperationSupported(StackView stack) {
        try {
            return targetedUpscaleEntitlementsEnabled(stack.getResourceCrn()) && DnsResolverType.FREEIPA_FOR_ENV.equals(stack.getDomainDnsResolver());
        } catch (Exception e) {
            LOGGER.error("Error occurred during checking if targeted upscale supported, thus assuming it is not enabled, cause: ", e);
            return false;
        }
    }

    public boolean targetedUpscaleEntitlementsEnabled(String crn) {
        String accountId = Crn.safeFromString(crn).getAccountId();
        return entitlementService.targetedUpscaleSupported(accountId) && isUnboundEliminationSupported(accountId);
    }

    public DnsResolverType getActualDnsResolverType(StackDto stackDto) {
        StackView stack = stackDto.getStack();
        LOGGER.debug("Original value of domainDnsResolver field for stack {} is {}", stack.getResourceCrn(), stack.getDomainDnsResolver());
        if (!isUnboundEliminationSupported(stack.getResourceCrn())) {
            LOGGER.debug("Since unbound elimination is not supported, then targeted upscale also won't be supported, " +
                    "thus all 00-cluster.conf will be regenerated for all nodes of stack {}.", stack.getResourceCrn());
            return DnsResolverType.LOCAL_UNBOUND;
        } else {
            GatewayConfig primaryGatewayConfig = gatewayConfigService.getPrimaryGatewayConfig(stackDto);
            Set<Node> reachableNodes = stackUtil.collectReachableNodes(stackDto);
            Set<String> reachableHostnames = reachableNodes.stream().map(Node::getHostname).collect(Collectors.toSet());
            boolean unboundClusterConfigPresentOnAnyNodes = hostOrchestrator.unboundClusterConfigPresentOnAnyNodes(primaryGatewayConfig, reachableHostnames);
            LOGGER.debug("Result of check whether unbound config is present on nodes of stack [{}] is: {}",
                    stack.getResourceCrn(), unboundClusterConfigPresentOnAnyNodes);
            if (unboundClusterConfigPresentOnAnyNodes) {
                LOGGER.debug("Although unbound elimination is enabled in account, 00-cluster.conf files still present on at least one node, " +
                        "thus we will fall back to use local unbound service on all nodes of stack {}", stack.getResourceCrn());
                return DnsResolverType.LOCAL_UNBOUND;
            } else {
                LOGGER.debug("Unbound elimination is enabled in account and 00-cluster.conf files were removed from all nodes, " +
                        "thus we can use freeIPA of environment {} to resolve DNS within environment's domain for stack {}",
                        stack.getEnvironmentCrn(), stack.getResourceCrn());
                return DnsResolverType.FREEIPA_FOR_ENV;
            }
        }
    }

    public boolean isUnboundEliminationSupported(String accountId) {
        if (entitlementService.isUnboundEliminationSupported(accountId)) {
            return true;
        } else {
            LOGGER.info("Unbound elimination is disabled for account {}, thus targeted upscale is not supported!", accountId);
            return false;
        }
    }
}