/* * 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.ecr.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* The details of an image scan. *

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

* The time of the last completed image scan. *

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

* The time when the vulnerability data was last scanned. *

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

* The image vulnerability counts, sorted by severity. *

*/ private java.util.Map findingSeverityCounts; /** *

* The findings from the image scan. *

*/ private java.util.List findings; /** *

* Details about the enhanced scan findings from Amazon Inspector. *

*/ private java.util.List enhancedFindings; /** *

* The time of the last completed image scan. *

* * @param imageScanCompletedAt * The time of the last completed image scan. */ public void setImageScanCompletedAt(java.util.Date imageScanCompletedAt) { this.imageScanCompletedAt = imageScanCompletedAt; } /** *

* The time of the last completed image scan. *

* * @return The time of the last completed image scan. */ public java.util.Date getImageScanCompletedAt() { return this.imageScanCompletedAt; } /** *

* The time of the last completed image scan. *

* * @param imageScanCompletedAt * The time of the last completed image scan. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings withImageScanCompletedAt(java.util.Date imageScanCompletedAt) { setImageScanCompletedAt(imageScanCompletedAt); return this; } /** *

* The time when the vulnerability data was last scanned. *

* * @param vulnerabilitySourceUpdatedAt * The time when the vulnerability data was last scanned. */ public void setVulnerabilitySourceUpdatedAt(java.util.Date vulnerabilitySourceUpdatedAt) { this.vulnerabilitySourceUpdatedAt = vulnerabilitySourceUpdatedAt; } /** *

* The time when the vulnerability data was last scanned. *

* * @return The time when the vulnerability data was last scanned. */ public java.util.Date getVulnerabilitySourceUpdatedAt() { return this.vulnerabilitySourceUpdatedAt; } /** *

* The time when the vulnerability data was last scanned. *

* * @param vulnerabilitySourceUpdatedAt * The time when the vulnerability data was last scanned. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings withVulnerabilitySourceUpdatedAt(java.util.Date vulnerabilitySourceUpdatedAt) { setVulnerabilitySourceUpdatedAt(vulnerabilitySourceUpdatedAt); return this; } /** *

* The image vulnerability counts, sorted by severity. *

* * @return The image vulnerability counts, sorted by severity. */ public java.util.Map getFindingSeverityCounts() { return findingSeverityCounts; } /** *

* The image vulnerability counts, sorted by severity. *

* * @param findingSeverityCounts * The image vulnerability counts, sorted by severity. */ public void setFindingSeverityCounts(java.util.Map findingSeverityCounts) { this.findingSeverityCounts = findingSeverityCounts; } /** *

* The image vulnerability counts, sorted by severity. *

* * @param findingSeverityCounts * The image vulnerability counts, sorted by severity. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings withFindingSeverityCounts(java.util.Map findingSeverityCounts) { setFindingSeverityCounts(findingSeverityCounts); return this; } /** * Add a single FindingSeverityCounts entry * * @see ImageScanFindings#withFindingSeverityCounts * @returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings addFindingSeverityCountsEntry(String key, Integer value) { if (null == this.findingSeverityCounts) { this.findingSeverityCounts = new java.util.HashMap(); } if (this.findingSeverityCounts.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.findingSeverityCounts.put(key, value); return this; } /** * Removes all the entries added into FindingSeverityCounts. * * @return Returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings clearFindingSeverityCountsEntries() { this.findingSeverityCounts = null; return this; } /** *

* The findings from the image scan. *

* * @return The findings from the image scan. */ public java.util.List getFindings() { return findings; } /** *

* The findings from the image scan. *

* * @param findings * The findings from the image scan. */ public void setFindings(java.util.Collection findings) { if (findings == null) { this.findings = null; return; } this.findings = new java.util.ArrayList(findings); } /** *

* The findings from the image scan. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setFindings(java.util.Collection)} or {@link #withFindings(java.util.Collection)} if you want to override * the existing values. *

* * @param findings * The findings from the image scan. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings withFindings(ImageScanFinding... findings) { if (this.findings == null) { setFindings(new java.util.ArrayList(findings.length)); } for (ImageScanFinding ele : findings) { this.findings.add(ele); } return this; } /** *

* The findings from the image scan. *

* * @param findings * The findings from the image scan. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings withFindings(java.util.Collection findings) { setFindings(findings); return this; } /** *

* Details about the enhanced scan findings from Amazon Inspector. *

* * @return Details about the enhanced scan findings from Amazon Inspector. */ public java.util.List getEnhancedFindings() { return enhancedFindings; } /** *

* Details about the enhanced scan findings from Amazon Inspector. *

* * @param enhancedFindings * Details about the enhanced scan findings from Amazon Inspector. */ public void setEnhancedFindings(java.util.Collection enhancedFindings) { if (enhancedFindings == null) { this.enhancedFindings = null; return; } this.enhancedFindings = new java.util.ArrayList(enhancedFindings); } /** *

* Details about the enhanced scan findings from Amazon Inspector. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setEnhancedFindings(java.util.Collection)} or {@link #withEnhancedFindings(java.util.Collection)} if you * want to override the existing values. *

* * @param enhancedFindings * Details about the enhanced scan findings from Amazon Inspector. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings withEnhancedFindings(EnhancedImageScanFinding... enhancedFindings) { if (this.enhancedFindings == null) { setEnhancedFindings(new java.util.ArrayList(enhancedFindings.length)); } for (EnhancedImageScanFinding ele : enhancedFindings) { this.enhancedFindings.add(ele); } return this; } /** *

* Details about the enhanced scan findings from Amazon Inspector. *

* * @param enhancedFindings * Details about the enhanced scan findings from Amazon Inspector. * @return Returns a reference to this object so that method calls can be chained together. */ public ImageScanFindings withEnhancedFindings(java.util.Collection enhancedFindings) { setEnhancedFindings(enhancedFindings); 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 (getImageScanCompletedAt() != null) sb.append("ImageScanCompletedAt: ").append(getImageScanCompletedAt()).append(","); if (getVulnerabilitySourceUpdatedAt() != null) sb.append("VulnerabilitySourceUpdatedAt: ").append(getVulnerabilitySourceUpdatedAt()).append(","); if (getFindingSeverityCounts() != null) sb.append("FindingSeverityCounts: ").append(getFindingSeverityCounts()).append(","); if (getFindings() != null) sb.append("Findings: ").append(getFindings()).append(","); if (getEnhancedFindings() != null) sb.append("EnhancedFindings: ").append(getEnhancedFindings()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ImageScanFindings == false) return false; ImageScanFindings other = (ImageScanFindings) obj; if (other.getImageScanCompletedAt() == null ^ this.getImageScanCompletedAt() == null) return false; if (other.getImageScanCompletedAt() != null && other.getImageScanCompletedAt().equals(this.getImageScanCompletedAt()) == false) return false; if (other.getVulnerabilitySourceUpdatedAt() == null ^ this.getVulnerabilitySourceUpdatedAt() == null) return false; if (other.getVulnerabilitySourceUpdatedAt() != null && other.getVulnerabilitySourceUpdatedAt().equals(this.getVulnerabilitySourceUpdatedAt()) == false) return false; if (other.getFindingSeverityCounts() == null ^ this.getFindingSeverityCounts() == null) return false; if (other.getFindingSeverityCounts() != null && other.getFindingSeverityCounts().equals(this.getFindingSeverityCounts()) == false) return false; if (other.getFindings() == null ^ this.getFindings() == null) return false; if (other.getFindings() != null && other.getFindings().equals(this.getFindings()) == false) return false; if (other.getEnhancedFindings() == null ^ this.getEnhancedFindings() == null) return false; if (other.getEnhancedFindings() != null && other.getEnhancedFindings().equals(this.getEnhancedFindings()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getImageScanCompletedAt() == null) ? 0 : getImageScanCompletedAt().hashCode()); hashCode = prime * hashCode + ((getVulnerabilitySourceUpdatedAt() == null) ? 0 : getVulnerabilitySourceUpdatedAt().hashCode()); hashCode = prime * hashCode + ((getFindingSeverityCounts() == null) ? 0 : getFindingSeverityCounts().hashCode()); hashCode = prime * hashCode + ((getFindings() == null) ? 0 : getFindings().hashCode()); hashCode = prime * hashCode + ((getEnhancedFindings() == null) ? 0 : getEnhancedFindings().hashCode()); return hashCode; } @Override public ImageScanFindings clone() { try { return (ImageScanFindings) 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.ecr.model.transform.ImageScanFindingsMarshaller.getInstance().marshall(this, protocolMarshaller); } }