com.amazonaws.services.securityhub.model.Vulnerability Maven / Gradle / Ivy
Show all versions of aws-java-sdk-securityhub Show documentation
/*
* Copyright 2016-2021 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.securityhub.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A vulnerability associated with a finding.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Vulnerability implements Serializable, Cloneable, StructuredPojo {
/**
*
* The identifier of the vulnerability.
*
*/
private String id;
/**
*
* List of software packages that have the vulnerability.
*
*/
private java.util.List vulnerablePackages;
/**
*
* CVSS scores from the advisory related to the vulnerability.
*
*/
private java.util.List cvss;
/**
*
* List of vulnerabilities that are related to this vulnerability.
*
*/
private java.util.List relatedVulnerabilities;
/**
*
* Information about the vendor that generates the vulnerability report.
*
*/
private VulnerabilityVendor vendor;
/**
*
* A list of URLs that provide additional information about the vulnerability.
*
*/
private java.util.List referenceUrls;
/**
*
* The identifier of the vulnerability.
*
*
* @param id
* The identifier of the vulnerability.
*/
public void setId(String id) {
this.id = id;
}
/**
*
* The identifier of the vulnerability.
*
*
* @return The identifier of the vulnerability.
*/
public String getId() {
return this.id;
}
/**
*
* The identifier of the vulnerability.
*
*
* @param id
* The identifier of the vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withId(String id) {
setId(id);
return this;
}
/**
*
* List of software packages that have the vulnerability.
*
*
* @return List of software packages that have the vulnerability.
*/
public java.util.List getVulnerablePackages() {
return vulnerablePackages;
}
/**
*
* List of software packages that have the vulnerability.
*
*
* @param vulnerablePackages
* List of software packages that have the vulnerability.
*/
public void setVulnerablePackages(java.util.Collection vulnerablePackages) {
if (vulnerablePackages == null) {
this.vulnerablePackages = null;
return;
}
this.vulnerablePackages = new java.util.ArrayList(vulnerablePackages);
}
/**
*
* List of software packages that have the vulnerability.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setVulnerablePackages(java.util.Collection)} or {@link #withVulnerablePackages(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param vulnerablePackages
* List of software packages that have the vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withVulnerablePackages(SoftwarePackage... vulnerablePackages) {
if (this.vulnerablePackages == null) {
setVulnerablePackages(new java.util.ArrayList(vulnerablePackages.length));
}
for (SoftwarePackage ele : vulnerablePackages) {
this.vulnerablePackages.add(ele);
}
return this;
}
/**
*
* List of software packages that have the vulnerability.
*
*
* @param vulnerablePackages
* List of software packages that have the vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withVulnerablePackages(java.util.Collection vulnerablePackages) {
setVulnerablePackages(vulnerablePackages);
return this;
}
/**
*
* CVSS scores from the advisory related to the vulnerability.
*
*
* @return CVSS scores from the advisory related to the vulnerability.
*/
public java.util.List getCvss() {
return cvss;
}
/**
*
* CVSS scores from the advisory related to the vulnerability.
*
*
* @param cvss
* CVSS scores from the advisory related to the vulnerability.
*/
public void setCvss(java.util.Collection cvss) {
if (cvss == null) {
this.cvss = null;
return;
}
this.cvss = new java.util.ArrayList(cvss);
}
/**
*
* CVSS scores from the advisory related to the vulnerability.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setCvss(java.util.Collection)} or {@link #withCvss(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param cvss
* CVSS scores from the advisory related to the vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withCvss(Cvss... cvss) {
if (this.cvss == null) {
setCvss(new java.util.ArrayList(cvss.length));
}
for (Cvss ele : cvss) {
this.cvss.add(ele);
}
return this;
}
/**
*
* CVSS scores from the advisory related to the vulnerability.
*
*
* @param cvss
* CVSS scores from the advisory related to the vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withCvss(java.util.Collection cvss) {
setCvss(cvss);
return this;
}
/**
*
* List of vulnerabilities that are related to this vulnerability.
*
*
* @return List of vulnerabilities that are related to this vulnerability.
*/
public java.util.List getRelatedVulnerabilities() {
return relatedVulnerabilities;
}
/**
*
* List of vulnerabilities that are related to this vulnerability.
*
*
* @param relatedVulnerabilities
* List of vulnerabilities that are related to this vulnerability.
*/
public void setRelatedVulnerabilities(java.util.Collection relatedVulnerabilities) {
if (relatedVulnerabilities == null) {
this.relatedVulnerabilities = null;
return;
}
this.relatedVulnerabilities = new java.util.ArrayList(relatedVulnerabilities);
}
/**
*
* List of vulnerabilities that are related to this vulnerability.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setRelatedVulnerabilities(java.util.Collection)} or
* {@link #withRelatedVulnerabilities(java.util.Collection)} if you want to override the existing values.
*
*
* @param relatedVulnerabilities
* List of vulnerabilities that are related to this vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withRelatedVulnerabilities(String... relatedVulnerabilities) {
if (this.relatedVulnerabilities == null) {
setRelatedVulnerabilities(new java.util.ArrayList(relatedVulnerabilities.length));
}
for (String ele : relatedVulnerabilities) {
this.relatedVulnerabilities.add(ele);
}
return this;
}
/**
*
* List of vulnerabilities that are related to this vulnerability.
*
*
* @param relatedVulnerabilities
* List of vulnerabilities that are related to this vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withRelatedVulnerabilities(java.util.Collection relatedVulnerabilities) {
setRelatedVulnerabilities(relatedVulnerabilities);
return this;
}
/**
*
* Information about the vendor that generates the vulnerability report.
*
*
* @param vendor
* Information about the vendor that generates the vulnerability report.
*/
public void setVendor(VulnerabilityVendor vendor) {
this.vendor = vendor;
}
/**
*
* Information about the vendor that generates the vulnerability report.
*
*
* @return Information about the vendor that generates the vulnerability report.
*/
public VulnerabilityVendor getVendor() {
return this.vendor;
}
/**
*
* Information about the vendor that generates the vulnerability report.
*
*
* @param vendor
* Information about the vendor that generates the vulnerability report.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withVendor(VulnerabilityVendor vendor) {
setVendor(vendor);
return this;
}
/**
*
* A list of URLs that provide additional information about the vulnerability.
*
*
* @return A list of URLs that provide additional information about the vulnerability.
*/
public java.util.List getReferenceUrls() {
return referenceUrls;
}
/**
*
* A list of URLs that provide additional information about the vulnerability.
*
*
* @param referenceUrls
* A list of URLs that provide additional information about the vulnerability.
*/
public void setReferenceUrls(java.util.Collection referenceUrls) {
if (referenceUrls == null) {
this.referenceUrls = null;
return;
}
this.referenceUrls = new java.util.ArrayList(referenceUrls);
}
/**
*
* A list of URLs that provide additional information about the vulnerability.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setReferenceUrls(java.util.Collection)} or {@link #withReferenceUrls(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param referenceUrls
* A list of URLs that provide additional information about the vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withReferenceUrls(String... referenceUrls) {
if (this.referenceUrls == null) {
setReferenceUrls(new java.util.ArrayList(referenceUrls.length));
}
for (String ele : referenceUrls) {
this.referenceUrls.add(ele);
}
return this;
}
/**
*
* A list of URLs that provide additional information about the vulnerability.
*
*
* @param referenceUrls
* A list of URLs that provide additional information about the vulnerability.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Vulnerability withReferenceUrls(java.util.Collection referenceUrls) {
setReferenceUrls(referenceUrls);
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 (getId() != null)
sb.append("Id: ").append(getId()).append(",");
if (getVulnerablePackages() != null)
sb.append("VulnerablePackages: ").append(getVulnerablePackages()).append(",");
if (getCvss() != null)
sb.append("Cvss: ").append(getCvss()).append(",");
if (getRelatedVulnerabilities() != null)
sb.append("RelatedVulnerabilities: ").append(getRelatedVulnerabilities()).append(",");
if (getVendor() != null)
sb.append("Vendor: ").append(getVendor()).append(",");
if (getReferenceUrls() != null)
sb.append("ReferenceUrls: ").append(getReferenceUrls());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Vulnerability == false)
return false;
Vulnerability other = (Vulnerability) obj;
if (other.getId() == null ^ this.getId() == null)
return false;
if (other.getId() != null && other.getId().equals(this.getId()) == false)
return false;
if (other.getVulnerablePackages() == null ^ this.getVulnerablePackages() == null)
return false;
if (other.getVulnerablePackages() != null && other.getVulnerablePackages().equals(this.getVulnerablePackages()) == false)
return false;
if (other.getCvss() == null ^ this.getCvss() == null)
return false;
if (other.getCvss() != null && other.getCvss().equals(this.getCvss()) == false)
return false;
if (other.getRelatedVulnerabilities() == null ^ this.getRelatedVulnerabilities() == null)
return false;
if (other.getRelatedVulnerabilities() != null && other.getRelatedVulnerabilities().equals(this.getRelatedVulnerabilities()) == false)
return false;
if (other.getVendor() == null ^ this.getVendor() == null)
return false;
if (other.getVendor() != null && other.getVendor().equals(this.getVendor()) == false)
return false;
if (other.getReferenceUrls() == null ^ this.getReferenceUrls() == null)
return false;
if (other.getReferenceUrls() != null && other.getReferenceUrls().equals(this.getReferenceUrls()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode());
hashCode = prime * hashCode + ((getVulnerablePackages() == null) ? 0 : getVulnerablePackages().hashCode());
hashCode = prime * hashCode + ((getCvss() == null) ? 0 : getCvss().hashCode());
hashCode = prime * hashCode + ((getRelatedVulnerabilities() == null) ? 0 : getRelatedVulnerabilities().hashCode());
hashCode = prime * hashCode + ((getVendor() == null) ? 0 : getVendor().hashCode());
hashCode = prime * hashCode + ((getReferenceUrls() == null) ? 0 : getReferenceUrls().hashCode());
return hashCode;
}
@Override
public Vulnerability clone() {
try {
return (Vulnerability) 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.securityhub.model.transform.VulnerabilityMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}