com.amazonaws.services.guardduty.model.UsageStatistics Maven / Gradle / Ivy
Show all versions of aws-java-sdk-guardduty Show documentation
/*
* Copyright 2015-2020 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.guardduty.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Contains the result of GuardDuty usage. If a UsageStatisticType is provided the result for other types will be null.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UsageStatistics implements Serializable, Cloneable, StructuredPojo {
/**
*
* The usage statistic sum organized by account ID.
*
*/
private java.util.List sumByAccount;
/**
*
* The usage statistic sum organized by on data source.
*
*/
private java.util.List sumByDataSource;
/**
*
* The usage statistic sum organized by resource.
*
*/
private java.util.List sumByResource;
/**
*
* Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least expensive.
*
*/
private java.util.List topResources;
/**
*
* The usage statistic sum organized by account ID.
*
*
* @return The usage statistic sum organized by account ID.
*/
public java.util.List getSumByAccount() {
return sumByAccount;
}
/**
*
* The usage statistic sum organized by account ID.
*
*
* @param sumByAccount
* The usage statistic sum organized by account ID.
*/
public void setSumByAccount(java.util.Collection sumByAccount) {
if (sumByAccount == null) {
this.sumByAccount = null;
return;
}
this.sumByAccount = new java.util.ArrayList(sumByAccount);
}
/**
*
* The usage statistic sum organized by account ID.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSumByAccount(java.util.Collection)} or {@link #withSumByAccount(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param sumByAccount
* The usage statistic sum organized by account ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageStatistics withSumByAccount(UsageAccountResult... sumByAccount) {
if (this.sumByAccount == null) {
setSumByAccount(new java.util.ArrayList(sumByAccount.length));
}
for (UsageAccountResult ele : sumByAccount) {
this.sumByAccount.add(ele);
}
return this;
}
/**
*
* The usage statistic sum organized by account ID.
*
*
* @param sumByAccount
* The usage statistic sum organized by account ID.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageStatistics withSumByAccount(java.util.Collection sumByAccount) {
setSumByAccount(sumByAccount);
return this;
}
/**
*
* The usage statistic sum organized by on data source.
*
*
* @return The usage statistic sum organized by on data source.
*/
public java.util.List getSumByDataSource() {
return sumByDataSource;
}
/**
*
* The usage statistic sum organized by on data source.
*
*
* @param sumByDataSource
* The usage statistic sum organized by on data source.
*/
public void setSumByDataSource(java.util.Collection sumByDataSource) {
if (sumByDataSource == null) {
this.sumByDataSource = null;
return;
}
this.sumByDataSource = new java.util.ArrayList(sumByDataSource);
}
/**
*
* The usage statistic sum organized by on data source.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSumByDataSource(java.util.Collection)} or {@link #withSumByDataSource(java.util.Collection)} if you
* want to override the existing values.
*
*
* @param sumByDataSource
* The usage statistic sum organized by on data source.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageStatistics withSumByDataSource(UsageDataSourceResult... sumByDataSource) {
if (this.sumByDataSource == null) {
setSumByDataSource(new java.util.ArrayList(sumByDataSource.length));
}
for (UsageDataSourceResult ele : sumByDataSource) {
this.sumByDataSource.add(ele);
}
return this;
}
/**
*
* The usage statistic sum organized by on data source.
*
*
* @param sumByDataSource
* The usage statistic sum organized by on data source.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageStatistics withSumByDataSource(java.util.Collection sumByDataSource) {
setSumByDataSource(sumByDataSource);
return this;
}
/**
*
* The usage statistic sum organized by resource.
*
*
* @return The usage statistic sum organized by resource.
*/
public java.util.List getSumByResource() {
return sumByResource;
}
/**
*
* The usage statistic sum organized by resource.
*
*
* @param sumByResource
* The usage statistic sum organized by resource.
*/
public void setSumByResource(java.util.Collection sumByResource) {
if (sumByResource == null) {
this.sumByResource = null;
return;
}
this.sumByResource = new java.util.ArrayList(sumByResource);
}
/**
*
* The usage statistic sum organized by resource.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSumByResource(java.util.Collection)} or {@link #withSumByResource(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param sumByResource
* The usage statistic sum organized by resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageStatistics withSumByResource(UsageResourceResult... sumByResource) {
if (this.sumByResource == null) {
setSumByResource(new java.util.ArrayList(sumByResource.length));
}
for (UsageResourceResult ele : sumByResource) {
this.sumByResource.add(ele);
}
return this;
}
/**
*
* The usage statistic sum organized by resource.
*
*
* @param sumByResource
* The usage statistic sum organized by resource.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageStatistics withSumByResource(java.util.Collection sumByResource) {
setSumByResource(sumByResource);
return this;
}
/**
*
* Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least expensive.
*
*
* @return Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least
* expensive.
*/
public java.util.List getTopResources() {
return topResources;
}
/**
*
* Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least expensive.
*
*
* @param topResources
* Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least
* expensive.
*/
public void setTopResources(java.util.Collection topResources) {
if (topResources == null) {
this.topResources = null;
return;
}
this.topResources = new java.util.ArrayList(topResources);
}
/**
*
* Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least expensive.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTopResources(java.util.Collection)} or {@link #withTopResources(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param topResources
* Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least
* expensive.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageStatistics withTopResources(UsageResourceResult... topResources) {
if (this.topResources == null) {
setTopResources(new java.util.ArrayList(topResources.length));
}
for (UsageResourceResult ele : topResources) {
this.topResources.add(ele);
}
return this;
}
/**
*
* Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least expensive.
*
*
* @param topResources
* Lists the top 50 resources that have generated the most GuardDuty usage, in order from most to least
* expensive.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public UsageStatistics withTopResources(java.util.Collection topResources) {
setTopResources(topResources);
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 (getSumByAccount() != null)
sb.append("SumByAccount: ").append(getSumByAccount()).append(",");
if (getSumByDataSource() != null)
sb.append("SumByDataSource: ").append(getSumByDataSource()).append(",");
if (getSumByResource() != null)
sb.append("SumByResource: ").append(getSumByResource()).append(",");
if (getTopResources() != null)
sb.append("TopResources: ").append(getTopResources());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof UsageStatistics == false)
return false;
UsageStatistics other = (UsageStatistics) obj;
if (other.getSumByAccount() == null ^ this.getSumByAccount() == null)
return false;
if (other.getSumByAccount() != null && other.getSumByAccount().equals(this.getSumByAccount()) == false)
return false;
if (other.getSumByDataSource() == null ^ this.getSumByDataSource() == null)
return false;
if (other.getSumByDataSource() != null && other.getSumByDataSource().equals(this.getSumByDataSource()) == false)
return false;
if (other.getSumByResource() == null ^ this.getSumByResource() == null)
return false;
if (other.getSumByResource() != null && other.getSumByResource().equals(this.getSumByResource()) == false)
return false;
if (other.getTopResources() == null ^ this.getTopResources() == null)
return false;
if (other.getTopResources() != null && other.getTopResources().equals(this.getTopResources()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getSumByAccount() == null) ? 0 : getSumByAccount().hashCode());
hashCode = prime * hashCode + ((getSumByDataSource() == null) ? 0 : getSumByDataSource().hashCode());
hashCode = prime * hashCode + ((getSumByResource() == null) ? 0 : getSumByResource().hashCode());
hashCode = prime * hashCode + ((getTopResources() == null) ? 0 : getTopResources().hashCode());
return hashCode;
}
@Override
public UsageStatistics clone() {
try {
return (UsageStatistics) 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.guardduty.model.transform.UsageStatisticsMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}