Untitled

mail@pastecode.io avatar
unknown
plain_text
11 days ago
6.1 kB
1
Indexable
Never
package com.amazonaws.cognito.signin.domain;

import com.amazonaws.cognito.common.cache.NegativeCacheable;
import com.amazonaws.cognito.dynamodbv2.datamodeling.DynamoDBAttribute;
import com.amazonaws.cognito.dynamodbv2.datamodeling.DynamoDBHashKey;
import com.amazonaws.cognito.dynamodbv2.datamodeling.DynamoDBIgnore;
import com.amazonaws.cognito.dynamodbv2.datamodeling.DynamoDBIndexHashKey;
import com.amazonaws.cognito.dynamodbv2.datamodeling.DynamoDBIndexRangeKey;
import com.amazonaws.cognito.dynamodbv2.datamodeling.DynamoDBTable;
import com.amazonaws.cognito.dynamodbv2.datamodeling.encryption.DoNotEncrypt;
import com.amazonaws.cognito.dynamodbv2.datamodeling.encryption.DoNotTouch;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import static com.amazonaws.cognito.signin.domain.DynamoDBConstants.*;

import com.amazonaws.cognito.common.dao.data.DynamoDBDO;

/**
 * Stores status of accounts that have been marked for closure or termination.
 * Accounts that are not in this table have are not marked for status change.
 */
@DynamoDBTable(tableName = ADMS_ACCOUNT_STATUS_TABLE)
@JsonIgnoreProperties(ignoreUnknown = true)
public class AWSAccountStatusDO extends DynamoDBDO implements NegativeCacheable {

    // AWS Account Id.
    private String awsAccountId;

    // Current status of the account.
    private String status;

    // Indicates the time when this Account was closed.
    // Also marks the time when the account resources were isolated.
    private Long closeTime;

    // Indicates the time when this Account was marked for termination.
    private Long terminationTime;

    // Indicates the time when the next action is scheduled for this
    // account.
    private Long nextActionTime;

    // Indicates the time when this Account was referred to service
    // team for further investigation.
    private Long investigationRequestTime;

    // Last event received from ADMS.
    private String admsEventBody;

    // Indicates the time-stamp of the last event arrival from ADMS.
    private Long admsEventReceiveTime;

    private String regionOptInOptOutEventBody;

    private Long regionOptInOptOutEventReceiveTime;

    private String regionOptInOptOutStatus;

    @DoNotTouch
    @DoNotEncrypt
    @DynamoDBHashKey(attributeName = AWS_ACCOUNT_ID)
    public String getAwsAccountId() {
        return awsAccountId;
    }

    public void setAwsAccountId(String awsAccountId) {
        this.awsAccountId = awsAccountId;
    }

    @DoNotTouch
    @DoNotEncrypt
    @DynamoDBIndexHashKey(attributeName = ADMS_STATUS, globalSecondaryIndexNames = { GSI_STATUS_CLOSED_TIME, GSI_STATUS_TERMINATION_TIME, GSI_STATUS_NEXT_ACTION_TIME, GSI_STATUS_INVESTIGATION_REQUEST_TIME})
    public String getStatus() {
        return status;
    }

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

    @DoNotTouch
    @DynamoDBAttribute(attributeName = REGION_OPTIN_OPTOUT_EVENT_RECEIVE_TIME)
    public Long getRegionOptInOptOutEventReceiveTime() {
        return regionOptInOptOutEventReceiveTime;
    }

    public void setRegionOptInOptOutEventReceiveTime(Long regionOptInOptOutEventReceiveTime) {
        this.regionOptInOptOutEventReceiveTime = regionOptInOptOutEventReceiveTime;
    }

    @DoNotTouch
    @DynamoDBAttribute(attributeName = REGION_OPTIN_OPTOUT_STATUS)
    public String getRegionOptInOptOutStatus() {
        return regionOptInOptOutStatus;
    }

    public void setRegionOptInOptOutStatus(String regionOptInOptOutStatus) {
        this.regionOptInOptOutStatus = regionOptInOptOutStatus;
    }

    @DoNotTouch
    @DynamoDBAttribute(attributeName = REGION_OPTIN_OPTOUT_EVENT_BODY)
    public String getRegionOptInOptOutEventBody() {
        return regionOptInOptOutEventBody;
    }

    public void setRegionOptInOptOutEventBody(String regionOptInOptOutEventBody) {
        this.regionOptInOptOutEventBody = regionOptInOptOutEventBody;
    }

    @DoNotTouch
    @DoNotEncrypt
    @DynamoDBIndexRangeKey(globalSecondaryIndexName = GSI_STATUS_CLOSED_TIME, attributeName = ADMS_CLOSE_TIME)
    public Long getCloseTime() {
        return closeTime;
    }

    public void setCloseTime(Long closeTime) {
        this.closeTime = closeTime;
    }

    @DoNotTouch
    @DoNotEncrypt
    @DynamoDBIndexRangeKey(globalSecondaryIndexName = GSI_STATUS_TERMINATION_TIME, attributeName = ADMS_TERMINATION_TIME)
    public Long getTerminationTime() {
        return terminationTime;
    }

    public void setTerminationTime(Long terminationTime) {
        this.terminationTime = terminationTime;
    }

    @DoNotTouch
    @DoNotEncrypt
    @DynamoDBIndexRangeKey(globalSecondaryIndexName = GSI_STATUS_NEXT_ACTION_TIME, attributeName = ADMS_NEXT_ACTION_TIME)
    public Long getNextActionTime() {
        return nextActionTime;
    }

    public void setNextActionTime(Long nextActionTime) {
        this.nextActionTime = nextActionTime;
    }

    @DoNotTouch
    @DoNotEncrypt
    @DynamoDBIndexRangeKey(globalSecondaryIndexName = GSI_STATUS_INVESTIGATION_REQUEST_TIME, attributeName = ADMS_INVESTIGATION_REQUEST_TIME)
    public Long getInvestigationRequestTime() {
        return investigationRequestTime;
    }

    public void setInvestigationRequestTime(Long investigationRequestTime) {
        this.investigationRequestTime = investigationRequestTime;
    }

    @DoNotTouch
    @DoNotEncrypt
    @DynamoDBAttribute(attributeName = ADMS_EVENT_BODY)
    public String getAdmsEventBody() {
        return admsEventBody;
    }

    public void setAdmsEventBody(String admsEventBody) {
        this.admsEventBody = admsEventBody;
    }

    @DoNotTouch
    @DynamoDBAttribute(attributeName = ADMS_EVENT_RECEIVE_TIME)
    public Long getAdmsEventReceiveTime() {
        return admsEventReceiveTime;
    }

    public void setAdmsEventReceiveTime(Long admsEventReceiveTime) {
        this.admsEventReceiveTime = admsEventReceiveTime;
    }

    @Override
    @DynamoDBIgnore
    @JsonIgnore
    public boolean isNegativelyCached() {
        return this.awsAccountId == null;
    }
}
Leave a Comment