Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.securityhub.model.AwsSecurityFinding Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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 software.amazon.awssdk.services.securityhub.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Provides consistent format for the contents of the Security Hub-aggregated findings. AwsSecurityFinding
* format enables you to share findings between AWS security services and third-party solutions, and compliance checks.
*
*
*
* A finding is a potential security issue generated either by AWS services (Amazon GuardDuty, Amazon Inspector, and
* Amazon Macie) or by the integrated third-party solutions and compliance checks.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AwsSecurityFinding implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField SCHEMA_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::schemaVersion)).setter(setter(Builder::schemaVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SchemaVersion").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField PRODUCT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::productArn)).setter(setter(Builder::productArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProductArn").build()).build();
private static final SdkField GENERATOR_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::generatorId)).setter(setter(Builder::generatorId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GeneratorId").build()).build();
private static final SdkField AWS_ACCOUNT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::awsAccountId)).setter(setter(Builder::awsAccountId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AwsAccountId").build()).build();
private static final SdkField> TYPES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(AwsSecurityFinding::types))
.setter(setter(Builder::types))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Types").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField FIRST_OBSERVED_AT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::firstObservedAt)).setter(setter(Builder::firstObservedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FirstObservedAt").build()).build();
private static final SdkField LAST_OBSERVED_AT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::lastObservedAt)).setter(setter(Builder::lastObservedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastObservedAt").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedAt").build()).build();
private static final SdkField UPDATED_AT_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::updatedAt)).setter(setter(Builder::updatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdatedAt").build()).build();
private static final SdkField SEVERITY_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(AwsSecurityFinding::severity)).setter(setter(Builder::severity)).constructor(Severity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Severity").build()).build();
private static final SdkField CONFIDENCE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(AwsSecurityFinding::confidence)).setter(setter(Builder::confidence))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Confidence").build()).build();
private static final SdkField CRITICALITY_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(AwsSecurityFinding::criticality)).setter(setter(Builder::criticality))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Criticality").build()).build();
private static final SdkField TITLE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::title)).setter(setter(Builder::title))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Title").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField REMEDIATION_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(AwsSecurityFinding::remediation)).setter(setter(Builder::remediation))
.constructor(Remediation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Remediation").build()).build();
private static final SdkField SOURCE_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::sourceUrl)).setter(setter(Builder::sourceUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceUrl").build()).build();
private static final SdkField> PRODUCT_FIELDS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(AwsSecurityFinding::productFields))
.setter(setter(Builder::productFields))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProductFields").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField> USER_DEFINED_FIELDS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.getter(getter(AwsSecurityFinding::userDefinedFields))
.setter(setter(Builder::userDefinedFields))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UserDefinedFields").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField> MALWARE_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(AwsSecurityFinding::malware))
.setter(setter(Builder::malware))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Malware").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Malware::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField NETWORK_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(AwsSecurityFinding::network)).setter(setter(Builder::network)).constructor(Network::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Network").build()).build();
private static final SdkField PROCESS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(AwsSecurityFinding::process)).setter(setter(Builder::process)).constructor(ProcessDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Process").build()).build();
private static final SdkField> THREAT_INTEL_INDICATORS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(AwsSecurityFinding::threatIntelIndicators))
.setter(setter(Builder::threatIntelIndicators))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ThreatIntelIndicators").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ThreatIntelIndicator::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> RESOURCES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(AwsSecurityFinding::resources))
.setter(setter(Builder::resources))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Resources").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Resource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField COMPLIANCE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(AwsSecurityFinding::compliance)).setter(setter(Builder::compliance)).constructor(Compliance::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Compliance").build()).build();
private static final SdkField VERIFICATION_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::verificationStateAsString)).setter(setter(Builder::verificationState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VerificationState").build()).build();
private static final SdkField WORKFLOW_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::workflowStateAsString)).setter(setter(Builder::workflowState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WorkflowState").build()).build();
private static final SdkField RECORD_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(AwsSecurityFinding::recordStateAsString)).setter(setter(Builder::recordState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecordState").build()).build();
private static final SdkField> RELATED_FINDINGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(AwsSecurityFinding::relatedFindings))
.setter(setter(Builder::relatedFindings))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RelatedFindings").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(RelatedFinding::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField NOTE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.getter(getter(AwsSecurityFinding::note)).setter(setter(Builder::note)).constructor(Note::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Note").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(SCHEMA_VERSION_FIELD,
ID_FIELD, PRODUCT_ARN_FIELD, GENERATOR_ID_FIELD, AWS_ACCOUNT_ID_FIELD, TYPES_FIELD, FIRST_OBSERVED_AT_FIELD,
LAST_OBSERVED_AT_FIELD, CREATED_AT_FIELD, UPDATED_AT_FIELD, SEVERITY_FIELD, CONFIDENCE_FIELD, CRITICALITY_FIELD,
TITLE_FIELD, DESCRIPTION_FIELD, REMEDIATION_FIELD, SOURCE_URL_FIELD, PRODUCT_FIELDS_FIELD, USER_DEFINED_FIELDS_FIELD,
MALWARE_FIELD, NETWORK_FIELD, PROCESS_FIELD, THREAT_INTEL_INDICATORS_FIELD, RESOURCES_FIELD, COMPLIANCE_FIELD,
VERIFICATION_STATE_FIELD, WORKFLOW_STATE_FIELD, RECORD_STATE_FIELD, RELATED_FINDINGS_FIELD, NOTE_FIELD));
private static final long serialVersionUID = 1L;
private final String schemaVersion;
private final String id;
private final String productArn;
private final String generatorId;
private final String awsAccountId;
private final List types;
private final String firstObservedAt;
private final String lastObservedAt;
private final String createdAt;
private final String updatedAt;
private final Severity severity;
private final Integer confidence;
private final Integer criticality;
private final String title;
private final String description;
private final Remediation remediation;
private final String sourceUrl;
private final Map productFields;
private final Map userDefinedFields;
private final List malware;
private final Network network;
private final ProcessDetails process;
private final List threatIntelIndicators;
private final List resources;
private final Compliance compliance;
private final String verificationState;
private final String workflowState;
private final String recordState;
private final List relatedFindings;
private final Note note;
private AwsSecurityFinding(BuilderImpl builder) {
this.schemaVersion = builder.schemaVersion;
this.id = builder.id;
this.productArn = builder.productArn;
this.generatorId = builder.generatorId;
this.awsAccountId = builder.awsAccountId;
this.types = builder.types;
this.firstObservedAt = builder.firstObservedAt;
this.lastObservedAt = builder.lastObservedAt;
this.createdAt = builder.createdAt;
this.updatedAt = builder.updatedAt;
this.severity = builder.severity;
this.confidence = builder.confidence;
this.criticality = builder.criticality;
this.title = builder.title;
this.description = builder.description;
this.remediation = builder.remediation;
this.sourceUrl = builder.sourceUrl;
this.productFields = builder.productFields;
this.userDefinedFields = builder.userDefinedFields;
this.malware = builder.malware;
this.network = builder.network;
this.process = builder.process;
this.threatIntelIndicators = builder.threatIntelIndicators;
this.resources = builder.resources;
this.compliance = builder.compliance;
this.verificationState = builder.verificationState;
this.workflowState = builder.workflowState;
this.recordState = builder.recordState;
this.relatedFindings = builder.relatedFindings;
this.note = builder.note;
}
/**
*
* The schema version that a finding is formatted for.
*
*
* @return The schema version that a finding is formatted for.
*/
public String schemaVersion() {
return schemaVersion;
}
/**
*
* The security findings provider-specific identifier for a finding.
*
*
* @return The security findings provider-specific identifier for a finding.
*/
public String id() {
return id;
}
/**
*
* The ARN generated by Security Hub that uniquely identifies a third-party company (security-findings provider)
* after this provider's product (solution that generates findings) is registered with Security Hub.
*
*
* @return The ARN generated by Security Hub that uniquely identifies a third-party company (security-findings
* provider) after this provider's product (solution that generates findings) is registered with Security
* Hub.
*/
public String productArn() {
return productArn;
}
/**
*
* The identifier for the solution-specific component (a discrete unit of logic) that generated a finding. In
* various security-findings providers' solutions, this generator can be called a rule, a check, a detector, a
* plug-in, etc.
*
*
* @return The identifier for the solution-specific component (a discrete unit of logic) that generated a finding.
* In various security-findings providers' solutions, this generator can be called a rule, a check, a
* detector, a plug-in, etc.
*/
public String generatorId() {
return generatorId;
}
/**
*
* The AWS account ID that a finding is generated in.
*
*
* @return The AWS account ID that a finding is generated in.
*/
public String awsAccountId() {
return awsAccountId;
}
/**
*
* One or more finding types in the format of namespace/category/classifier
that classify a finding.
*
*
* Valid namespace values are: Software and Configuration Checks | TTPs | Effects | Unusual Behaviors | Sensitive
* Data Identifications
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return One or more finding types in the format of namespace/category/classifier
that classify a
* finding.
*
* Valid namespace values are: Software and Configuration Checks | TTPs | Effects | Unusual Behaviors |
* Sensitive Data Identifications
*/
public List types() {
return types;
}
/**
*
* An ISO8601-formatted timestamp that indicates when the security-findings provider first observed the potential
* security issue that a finding captured.
*
*
* @return An ISO8601-formatted timestamp that indicates when the security-findings provider first observed the
* potential security issue that a finding captured.
*/
public String firstObservedAt() {
return firstObservedAt;
}
/**
*
* An ISO8601-formatted timestamp that indicates when the security-findings provider most recently observed the
* potential security issue that a finding captured.
*
*
* @return An ISO8601-formatted timestamp that indicates when the security-findings provider most recently observed
* the potential security issue that a finding captured.
*/
public String lastObservedAt() {
return lastObservedAt;
}
/**
*
* An ISO8601-formatted timestamp that indicates when the security-findings provider created the potential security
* issue that a finding captured.
*
*
* @return An ISO8601-formatted timestamp that indicates when the security-findings provider created the potential
* security issue that a finding captured.
*/
public String createdAt() {
return createdAt;
}
/**
*
* An ISO8601-formatted timestamp that indicates when the security-findings provider last updated the finding
* record.
*
*
* @return An ISO8601-formatted timestamp that indicates when the security-findings provider last updated the
* finding record.
*/
public String updatedAt() {
return updatedAt;
}
/**
*
* A finding's severity.
*
*
* @return A finding's severity.
*/
public Severity severity() {
return severity;
}
/**
*
* A finding's confidence. Confidence is defined as the likelihood that a finding accurately identifies the behavior
* or issue that it was intended to identify. Confidence is scored on a 0-100 basis using a ratio scale, where 0
* means zero percent confidence and 100 means 100 percent confidence.
*
*
* @return A finding's confidence. Confidence is defined as the likelihood that a finding accurately identifies the
* behavior or issue that it was intended to identify. Confidence is scored on a 0-100 basis using a ratio
* scale, where 0 means zero percent confidence and 100 means 100 percent confidence.
*/
public Integer confidence() {
return confidence;
}
/**
*
* The level of importance assigned to the resources associated with the finding. A score of 0 means that the
* underlying resources have no criticality, and a score of 100 is reserved for the most critical resources.
*
*
* @return The level of importance assigned to the resources associated with the finding. A score of 0 means that
* the underlying resources have no criticality, and a score of 100 is reserved for the most critical
* resources.
*/
public Integer criticality() {
return criticality;
}
/**
*
* A finding's title.
*
*
*
* In this release, Title
is a required property.
*
*
*
* @return A finding's title.
*
* In this release, Title
is a required property.
*
*/
public String title() {
return title;
}
/**
*
* A finding's description.
*
*
*
* In this release, Description
is a required property.
*
*
*
* @return A finding's description.
*
* In this release, Description
is a required property.
*
*/
public String description() {
return description;
}
/**
*
* A data type that describes the remediation options for a finding.
*
*
* @return A data type that describes the remediation options for a finding.
*/
public Remediation remediation() {
return remediation;
}
/**
*
* A URL that links to a page about the current finding in the security-findings provider's solution.
*
*
* @return A URL that links to a page about the current finding in the security-findings provider's solution.
*/
public String sourceUrl() {
return sourceUrl;
}
/**
*
* A data type where security-findings providers can include additional solution-specific details that aren't part
* of the defined AwsSecurityFinding
format.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A data type where security-findings providers can include additional solution-specific details that
* aren't part of the defined AwsSecurityFinding
format.
*/
public Map productFields() {
return productFields;
}
/**
*
* A list of name/value string pairs associated with the finding. These are custom, user-defined fields added to a
* finding.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of name/value string pairs associated with the finding. These are custom, user-defined fields
* added to a finding.
*/
public Map userDefinedFields() {
return userDefinedFields;
}
/**
*
* A list of malware related to a finding.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of malware related to a finding.
*/
public List malware() {
return malware;
}
/**
*
* The details of network-related information about a finding.
*
*
* @return The details of network-related information about a finding.
*/
public Network network() {
return network;
}
/**
*
* The details of process-related information about a finding.
*
*
* @return The details of process-related information about a finding.
*/
public ProcessDetails process() {
return process;
}
/**
*
* Threat intel details related to a finding.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return Threat intel details related to a finding.
*/
public List threatIntelIndicators() {
return threatIntelIndicators;
}
/**
*
* A set of resource data types that describe the resources that the finding refers to.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A set of resource data types that describe the resources that the finding refers to.
*/
public List resources() {
return resources;
}
/**
*
* This data type is exclusive to findings that are generated as the result of a check run against a specific rule
* in a supported standard (for example, CIS AWS Foundations). Contains compliance-related finding details.
*
*
* @return This data type is exclusive to findings that are generated as the result of a check run against a
* specific rule in a supported standard (for example, CIS AWS Foundations). Contains compliance-related
* finding details.
*/
public Compliance compliance() {
return compliance;
}
/**
*
* Indicates the veracity of a finding.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #verificationState}
* will return {@link VerificationState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #verificationStateAsString}.
*
*
* @return Indicates the veracity of a finding.
* @see VerificationState
*/
public VerificationState verificationState() {
return VerificationState.fromValue(verificationState);
}
/**
*
* Indicates the veracity of a finding.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #verificationState}
* will return {@link VerificationState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #verificationStateAsString}.
*
*
* @return Indicates the veracity of a finding.
* @see VerificationState
*/
public String verificationStateAsString() {
return verificationState;
}
/**
*
* The workflow state of a finding.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #workflowState}
* will return {@link WorkflowState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #workflowStateAsString}.
*
*
* @return The workflow state of a finding.
* @see WorkflowState
*/
public WorkflowState workflowState() {
return WorkflowState.fromValue(workflowState);
}
/**
*
* The workflow state of a finding.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #workflowState}
* will return {@link WorkflowState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #workflowStateAsString}.
*
*
* @return The workflow state of a finding.
* @see WorkflowState
*/
public String workflowStateAsString() {
return workflowState;
}
/**
*
* The record state of a finding.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #recordState} will
* return {@link RecordState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #recordStateAsString}.
*
*
* @return The record state of a finding.
* @see RecordState
*/
public RecordState recordState() {
return RecordState.fromValue(recordState);
}
/**
*
* The record state of a finding.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #recordState} will
* return {@link RecordState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #recordStateAsString}.
*
*
* @return The record state of a finding.
* @see RecordState
*/
public String recordStateAsString() {
return recordState;
}
/**
*
* A list of related findings.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of related findings.
*/
public List relatedFindings() {
return relatedFindings;
}
/**
*
* A user-defined note added to a finding.
*
*
* @return A user-defined note added to a finding.
*/
public Note note() {
return note;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(schemaVersion());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(productArn());
hashCode = 31 * hashCode + Objects.hashCode(generatorId());
hashCode = 31 * hashCode + Objects.hashCode(awsAccountId());
hashCode = 31 * hashCode + Objects.hashCode(types());
hashCode = 31 * hashCode + Objects.hashCode(firstObservedAt());
hashCode = 31 * hashCode + Objects.hashCode(lastObservedAt());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(updatedAt());
hashCode = 31 * hashCode + Objects.hashCode(severity());
hashCode = 31 * hashCode + Objects.hashCode(confidence());
hashCode = 31 * hashCode + Objects.hashCode(criticality());
hashCode = 31 * hashCode + Objects.hashCode(title());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(remediation());
hashCode = 31 * hashCode + Objects.hashCode(sourceUrl());
hashCode = 31 * hashCode + Objects.hashCode(productFields());
hashCode = 31 * hashCode + Objects.hashCode(userDefinedFields());
hashCode = 31 * hashCode + Objects.hashCode(malware());
hashCode = 31 * hashCode + Objects.hashCode(network());
hashCode = 31 * hashCode + Objects.hashCode(process());
hashCode = 31 * hashCode + Objects.hashCode(threatIntelIndicators());
hashCode = 31 * hashCode + Objects.hashCode(resources());
hashCode = 31 * hashCode + Objects.hashCode(compliance());
hashCode = 31 * hashCode + Objects.hashCode(verificationStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(workflowStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(recordStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(relatedFindings());
hashCode = 31 * hashCode + Objects.hashCode(note());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof AwsSecurityFinding)) {
return false;
}
AwsSecurityFinding other = (AwsSecurityFinding) obj;
return Objects.equals(schemaVersion(), other.schemaVersion()) && Objects.equals(id(), other.id())
&& Objects.equals(productArn(), other.productArn()) && Objects.equals(generatorId(), other.generatorId())
&& Objects.equals(awsAccountId(), other.awsAccountId()) && Objects.equals(types(), other.types())
&& Objects.equals(firstObservedAt(), other.firstObservedAt())
&& Objects.equals(lastObservedAt(), other.lastObservedAt()) && Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(updatedAt(), other.updatedAt()) && Objects.equals(severity(), other.severity())
&& Objects.equals(confidence(), other.confidence()) && Objects.equals(criticality(), other.criticality())
&& Objects.equals(title(), other.title()) && Objects.equals(description(), other.description())
&& Objects.equals(remediation(), other.remediation()) && Objects.equals(sourceUrl(), other.sourceUrl())
&& Objects.equals(productFields(), other.productFields())
&& Objects.equals(userDefinedFields(), other.userDefinedFields()) && Objects.equals(malware(), other.malware())
&& Objects.equals(network(), other.network()) && Objects.equals(process(), other.process())
&& Objects.equals(threatIntelIndicators(), other.threatIntelIndicators())
&& Objects.equals(resources(), other.resources()) && Objects.equals(compliance(), other.compliance())
&& Objects.equals(verificationStateAsString(), other.verificationStateAsString())
&& Objects.equals(workflowStateAsString(), other.workflowStateAsString())
&& Objects.equals(recordStateAsString(), other.recordStateAsString())
&& Objects.equals(relatedFindings(), other.relatedFindings()) && Objects.equals(note(), other.note());
}
/**
* 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.
*/
@Override
public String toString() {
return ToString.builder("AwsSecurityFinding").add("SchemaVersion", schemaVersion()).add("Id", id())
.add("ProductArn", productArn()).add("GeneratorId", generatorId()).add("AwsAccountId", awsAccountId())
.add("Types", types()).add("FirstObservedAt", firstObservedAt()).add("LastObservedAt", lastObservedAt())
.add("CreatedAt", createdAt()).add("UpdatedAt", updatedAt()).add("Severity", severity())
.add("Confidence", confidence()).add("Criticality", criticality()).add("Title", title())
.add("Description", description()).add("Remediation", remediation()).add("SourceUrl", sourceUrl())
.add("ProductFields", productFields()).add("UserDefinedFields", userDefinedFields()).add("Malware", malware())
.add("Network", network()).add("Process", process()).add("ThreatIntelIndicators", threatIntelIndicators())
.add("Resources", resources()).add("Compliance", compliance())
.add("VerificationState", verificationStateAsString()).add("WorkflowState", workflowStateAsString())
.add("RecordState", recordStateAsString()).add("RelatedFindings", relatedFindings()).add("Note", note()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "SchemaVersion":
return Optional.ofNullable(clazz.cast(schemaVersion()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "ProductArn":
return Optional.ofNullable(clazz.cast(productArn()));
case "GeneratorId":
return Optional.ofNullable(clazz.cast(generatorId()));
case "AwsAccountId":
return Optional.ofNullable(clazz.cast(awsAccountId()));
case "Types":
return Optional.ofNullable(clazz.cast(types()));
case "FirstObservedAt":
return Optional.ofNullable(clazz.cast(firstObservedAt()));
case "LastObservedAt":
return Optional.ofNullable(clazz.cast(lastObservedAt()));
case "CreatedAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "UpdatedAt":
return Optional.ofNullable(clazz.cast(updatedAt()));
case "Severity":
return Optional.ofNullable(clazz.cast(severity()));
case "Confidence":
return Optional.ofNullable(clazz.cast(confidence()));
case "Criticality":
return Optional.ofNullable(clazz.cast(criticality()));
case "Title":
return Optional.ofNullable(clazz.cast(title()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Remediation":
return Optional.ofNullable(clazz.cast(remediation()));
case "SourceUrl":
return Optional.ofNullable(clazz.cast(sourceUrl()));
case "ProductFields":
return Optional.ofNullable(clazz.cast(productFields()));
case "UserDefinedFields":
return Optional.ofNullable(clazz.cast(userDefinedFields()));
case "Malware":
return Optional.ofNullable(clazz.cast(malware()));
case "Network":
return Optional.ofNullable(clazz.cast(network()));
case "Process":
return Optional.ofNullable(clazz.cast(process()));
case "ThreatIntelIndicators":
return Optional.ofNullable(clazz.cast(threatIntelIndicators()));
case "Resources":
return Optional.ofNullable(clazz.cast(resources()));
case "Compliance":
return Optional.ofNullable(clazz.cast(compliance()));
case "VerificationState":
return Optional.ofNullable(clazz.cast(verificationStateAsString()));
case "WorkflowState":
return Optional.ofNullable(clazz.cast(workflowStateAsString()));
case "RecordState":
return Optional.ofNullable(clazz.cast(recordStateAsString()));
case "RelatedFindings":
return Optional.ofNullable(clazz.cast(relatedFindings()));
case "Note":
return Optional.ofNullable(clazz.cast(note()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((AwsSecurityFinding) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* The schema version that a finding is formatted for.
*
*
* @param schemaVersion
* The schema version that a finding is formatted for.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder schemaVersion(String schemaVersion);
/**
*
* The security findings provider-specific identifier for a finding.
*
*
* @param id
* The security findings provider-specific identifier for a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* The ARN generated by Security Hub that uniquely identifies a third-party company (security-findings provider)
* after this provider's product (solution that generates findings) is registered with Security Hub.
*
*
* @param productArn
* The ARN generated by Security Hub that uniquely identifies a third-party company (security-findings
* provider) after this provider's product (solution that generates findings) is registered with Security
* Hub.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder productArn(String productArn);
/**
*
* The identifier for the solution-specific component (a discrete unit of logic) that generated a finding. In
* various security-findings providers' solutions, this generator can be called a rule, a check, a detector, a
* plug-in, etc.
*
*
* @param generatorId
* The identifier for the solution-specific component (a discrete unit of logic) that generated a
* finding. In various security-findings providers' solutions, this generator can be called a rule, a
* check, a detector, a plug-in, etc.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder generatorId(String generatorId);
/**
*
* The AWS account ID that a finding is generated in.
*
*
* @param awsAccountId
* The AWS account ID that a finding is generated in.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder awsAccountId(String awsAccountId);
/**
*
* One or more finding types in the format of namespace/category/classifier
that classify a
* finding.
*
*
* Valid namespace values are: Software and Configuration Checks | TTPs | Effects | Unusual Behaviors |
* Sensitive Data Identifications
*
*
* @param types
* One or more finding types in the format of namespace/category/classifier
that classify a
* finding.
*
* Valid namespace values are: Software and Configuration Checks | TTPs | Effects | Unusual Behaviors |
* Sensitive Data Identifications
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder types(Collection types);
/**
*
* One or more finding types in the format of namespace/category/classifier
that classify a
* finding.
*
*
* Valid namespace values are: Software and Configuration Checks | TTPs | Effects | Unusual Behaviors |
* Sensitive Data Identifications
*
*
* @param types
* One or more finding types in the format of namespace/category/classifier
that classify a
* finding.
*
* Valid namespace values are: Software and Configuration Checks | TTPs | Effects | Unusual Behaviors |
* Sensitive Data Identifications
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder types(String... types);
/**
*
* An ISO8601-formatted timestamp that indicates when the security-findings provider first observed the
* potential security issue that a finding captured.
*
*
* @param firstObservedAt
* An ISO8601-formatted timestamp that indicates when the security-findings provider first observed the
* potential security issue that a finding captured.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder firstObservedAt(String firstObservedAt);
/**
*
* An ISO8601-formatted timestamp that indicates when the security-findings provider most recently observed the
* potential security issue that a finding captured.
*
*
* @param lastObservedAt
* An ISO8601-formatted timestamp that indicates when the security-findings provider most recently
* observed the potential security issue that a finding captured.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastObservedAt(String lastObservedAt);
/**
*
* An ISO8601-formatted timestamp that indicates when the security-findings provider created the potential
* security issue that a finding captured.
*
*
* @param createdAt
* An ISO8601-formatted timestamp that indicates when the security-findings provider created the
* potential security issue that a finding captured.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder createdAt(String createdAt);
/**
*
* An ISO8601-formatted timestamp that indicates when the security-findings provider last updated the finding
* record.
*
*
* @param updatedAt
* An ISO8601-formatted timestamp that indicates when the security-findings provider last updated the
* finding record.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder updatedAt(String updatedAt);
/**
*
* A finding's severity.
*
*
* @param severity
* A finding's severity.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder severity(Severity severity);
/**
*
* A finding's severity.
*
* This is a convenience that creates an instance of the {@link Severity.Builder} avoiding the need to create
* one manually via {@link Severity#builder()}.
*
* When the {@link Consumer} completes, {@link Severity.Builder#build()} is called immediately and its result is
* passed to {@link #severity(Severity)}.
*
* @param severity
* a consumer that will call methods on {@link Severity.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #severity(Severity)
*/
default Builder severity(Consumer severity) {
return severity(Severity.builder().applyMutation(severity).build());
}
/**
*
* A finding's confidence. Confidence is defined as the likelihood that a finding accurately identifies the
* behavior or issue that it was intended to identify. Confidence is scored on a 0-100 basis using a ratio
* scale, where 0 means zero percent confidence and 100 means 100 percent confidence.
*
*
* @param confidence
* A finding's confidence. Confidence is defined as the likelihood that a finding accurately identifies
* the behavior or issue that it was intended to identify. Confidence is scored on a 0-100 basis using a
* ratio scale, where 0 means zero percent confidence and 100 means 100 percent confidence.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder confidence(Integer confidence);
/**
*
* The level of importance assigned to the resources associated with the finding. A score of 0 means that the
* underlying resources have no criticality, and a score of 100 is reserved for the most critical resources.
*
*
* @param criticality
* The level of importance assigned to the resources associated with the finding. A score of 0 means that
* the underlying resources have no criticality, and a score of 100 is reserved for the most critical
* resources.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder criticality(Integer criticality);
/**
*
* A finding's title.
*
*
*
* In this release, Title
is a required property.
*
*
*
* @param title
* A finding's title.
*
* In this release, Title
is a required property.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder title(String title);
/**
*
* A finding's description.
*
*
*
* In this release, Description
is a required property.
*
*
*
* @param description
* A finding's description.
*
* In this release, Description
is a required property.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* A data type that describes the remediation options for a finding.
*
*
* @param remediation
* A data type that describes the remediation options for a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder remediation(Remediation remediation);
/**
*
* A data type that describes the remediation options for a finding.
*
* This is a convenience that creates an instance of the {@link Remediation.Builder} avoiding the need to create
* one manually via {@link Remediation#builder()}.
*
* When the {@link Consumer} completes, {@link Remediation.Builder#build()} is called immediately and its result
* is passed to {@link #remediation(Remediation)}.
*
* @param remediation
* a consumer that will call methods on {@link Remediation.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #remediation(Remediation)
*/
default Builder remediation(Consumer remediation) {
return remediation(Remediation.builder().applyMutation(remediation).build());
}
/**
*
* A URL that links to a page about the current finding in the security-findings provider's solution.
*
*
* @param sourceUrl
* A URL that links to a page about the current finding in the security-findings provider's solution.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sourceUrl(String sourceUrl);
/**
*
* A data type where security-findings providers can include additional solution-specific details that aren't
* part of the defined AwsSecurityFinding
format.
*
*
* @param productFields
* A data type where security-findings providers can include additional solution-specific details that
* aren't part of the defined AwsSecurityFinding
format.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder productFields(Map productFields);
/**
*
* A list of name/value string pairs associated with the finding. These are custom, user-defined fields added to
* a finding.
*
*
* @param userDefinedFields
* A list of name/value string pairs associated with the finding. These are custom, user-defined fields
* added to a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder userDefinedFields(Map userDefinedFields);
/**
*
* A list of malware related to a finding.
*
*
* @param malware
* A list of malware related to a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder malware(Collection malware);
/**
*
* A list of malware related to a finding.
*
*
* @param malware
* A list of malware related to a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder malware(Malware... malware);
/**
*
* A list of malware related to a finding.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to
* create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its
* result is passed to {@link #malware(List)}.
*
* @param malware
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #malware(List)
*/
Builder malware(Consumer... malware);
/**
*
* The details of network-related information about a finding.
*
*
* @param network
* The details of network-related information about a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder network(Network network);
/**
*
* The details of network-related information about a finding.
*
* This is a convenience that creates an instance of the {@link Network.Builder} avoiding the need to create one
* manually via {@link Network#builder()}.
*
* When the {@link Consumer} completes, {@link Network.Builder#build()} is called immediately and its result is
* passed to {@link #network(Network)}.
*
* @param network
* a consumer that will call methods on {@link Network.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #network(Network)
*/
default Builder network(Consumer network) {
return network(Network.builder().applyMutation(network).build());
}
/**
*
* The details of process-related information about a finding.
*
*
* @param process
* The details of process-related information about a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder process(ProcessDetails process);
/**
*
* The details of process-related information about a finding.
*
* This is a convenience that creates an instance of the {@link ProcessDetails.Builder} avoiding the need to
* create one manually via {@link ProcessDetails#builder()}.
*
* When the {@link Consumer} completes, {@link ProcessDetails.Builder#build()} is called immediately and its
* result is passed to {@link #process(ProcessDetails)}.
*
* @param process
* a consumer that will call methods on {@link ProcessDetails.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #process(ProcessDetails)
*/
default Builder process(Consumer process) {
return process(ProcessDetails.builder().applyMutation(process).build());
}
/**
*
* Threat intel details related to a finding.
*
*
* @param threatIntelIndicators
* Threat intel details related to a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder threatIntelIndicators(Collection threatIntelIndicators);
/**
*
* Threat intel details related to a finding.
*
*
* @param threatIntelIndicators
* Threat intel details related to a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder threatIntelIndicators(ThreatIntelIndicator... threatIntelIndicators);
/**
*
* Threat intel details related to a finding.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the
* need to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately
* and its result is passed to {@link #threatIntelIndicators(List)}.
*
* @param threatIntelIndicators
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #threatIntelIndicators(List)
*/
Builder threatIntelIndicators(Consumer... threatIntelIndicators);
/**
*
* A set of resource data types that describe the resources that the finding refers to.
*
*
* @param resources
* A set of resource data types that describe the resources that the finding refers to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder resources(Collection resources);
/**
*
* A set of resource data types that describe the resources that the finding refers to.
*
*
* @param resources
* A set of resource data types that describe the resources that the finding refers to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder resources(Resource... resources);
/**
*
* A set of resource data types that describe the resources that the finding refers to.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to
* create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its
* result is passed to {@link #resources(List)}.
*
* @param resources
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #resources(List)
*/
Builder resources(Consumer... resources);
/**
*
* This data type is exclusive to findings that are generated as the result of a check run against a specific
* rule in a supported standard (for example, CIS AWS Foundations). Contains compliance-related finding details.
*
*
* @param compliance
* This data type is exclusive to findings that are generated as the result of a check run against a
* specific rule in a supported standard (for example, CIS AWS Foundations). Contains compliance-related
* finding details.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder compliance(Compliance compliance);
/**
*
* This data type is exclusive to findings that are generated as the result of a check run against a specific
* rule in a supported standard (for example, CIS AWS Foundations). Contains compliance-related finding details.
*
* This is a convenience that creates an instance of the {@link Compliance.Builder} avoiding the need to create
* one manually via {@link Compliance#builder()}.
*
* When the {@link Consumer} completes, {@link Compliance.Builder#build()} is called immediately and its result
* is passed to {@link #compliance(Compliance)}.
*
* @param compliance
* a consumer that will call methods on {@link Compliance.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #compliance(Compliance)
*/
default Builder compliance(Consumer compliance) {
return compliance(Compliance.builder().applyMutation(compliance).build());
}
/**
*
* Indicates the veracity of a finding.
*
*
* @param verificationState
* Indicates the veracity of a finding.
* @see VerificationState
* @return Returns a reference to this object so that method calls can be chained together.
* @see VerificationState
*/
Builder verificationState(String verificationState);
/**
*
* Indicates the veracity of a finding.
*
*
* @param verificationState
* Indicates the veracity of a finding.
* @see VerificationState
* @return Returns a reference to this object so that method calls can be chained together.
* @see VerificationState
*/
Builder verificationState(VerificationState verificationState);
/**
*
* The workflow state of a finding.
*
*
* @param workflowState
* The workflow state of a finding.
* @see WorkflowState
* @return Returns a reference to this object so that method calls can be chained together.
* @see WorkflowState
*/
Builder workflowState(String workflowState);
/**
*
* The workflow state of a finding.
*
*
* @param workflowState
* The workflow state of a finding.
* @see WorkflowState
* @return Returns a reference to this object so that method calls can be chained together.
* @see WorkflowState
*/
Builder workflowState(WorkflowState workflowState);
/**
*
* The record state of a finding.
*
*
* @param recordState
* The record state of a finding.
* @see RecordState
* @return Returns a reference to this object so that method calls can be chained together.
* @see RecordState
*/
Builder recordState(String recordState);
/**
*
* The record state of a finding.
*
*
* @param recordState
* The record state of a finding.
* @see RecordState
* @return Returns a reference to this object so that method calls can be chained together.
* @see RecordState
*/
Builder recordState(RecordState recordState);
/**
*
* A list of related findings.
*
*
* @param relatedFindings
* A list of related findings.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder relatedFindings(Collection relatedFindings);
/**
*
* A list of related findings.
*
*
* @param relatedFindings
* A list of related findings.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder relatedFindings(RelatedFinding... relatedFindings);
/**
*
* A list of related findings.
*
* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need
* to create one manually via {@link List#builder()}.
*
* When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and
* its result is passed to {@link #relatedFindings(List)}.
*
* @param relatedFindings
* a consumer that will call methods on {@link List.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #relatedFindings(List)
*/
Builder relatedFindings(Consumer... relatedFindings);
/**
*
* A user-defined note added to a finding.
*
*
* @param note
* A user-defined note added to a finding.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder note(Note note);
/**
*
* A user-defined note added to a finding.
*
* This is a convenience that creates an instance of the {@link Note.Builder} avoiding the need to create one
* manually via {@link Note#builder()}.
*
* When the {@link Consumer} completes, {@link Note.Builder#build()} is called immediately and its result is
* passed to {@link #note(Note)}.
*
* @param note
* a consumer that will call methods on {@link Note.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #note(Note)
*/
default Builder note(Consumer note) {
return note(Note.builder().applyMutation(note).build());
}
}
static final class BuilderImpl implements Builder {
private String schemaVersion;
private String id;
private String productArn;
private String generatorId;
private String awsAccountId;
private List types = DefaultSdkAutoConstructList.getInstance();
private String firstObservedAt;
private String lastObservedAt;
private String createdAt;
private String updatedAt;
private Severity severity;
private Integer confidence;
private Integer criticality;
private String title;
private String description;
private Remediation remediation;
private String sourceUrl;
private Map productFields = DefaultSdkAutoConstructMap.getInstance();
private Map userDefinedFields = DefaultSdkAutoConstructMap.getInstance();
private List malware = DefaultSdkAutoConstructList.getInstance();
private Network network;
private ProcessDetails process;
private List threatIntelIndicators = DefaultSdkAutoConstructList.getInstance();
private List resources = DefaultSdkAutoConstructList.getInstance();
private Compliance compliance;
private String verificationState;
private String workflowState;
private String recordState;
private List relatedFindings = DefaultSdkAutoConstructList.getInstance();
private Note note;
private BuilderImpl() {
}
private BuilderImpl(AwsSecurityFinding model) {
schemaVersion(model.schemaVersion);
id(model.id);
productArn(model.productArn);
generatorId(model.generatorId);
awsAccountId(model.awsAccountId);
types(model.types);
firstObservedAt(model.firstObservedAt);
lastObservedAt(model.lastObservedAt);
createdAt(model.createdAt);
updatedAt(model.updatedAt);
severity(model.severity);
confidence(model.confidence);
criticality(model.criticality);
title(model.title);
description(model.description);
remediation(model.remediation);
sourceUrl(model.sourceUrl);
productFields(model.productFields);
userDefinedFields(model.userDefinedFields);
malware(model.malware);
network(model.network);
process(model.process);
threatIntelIndicators(model.threatIntelIndicators);
resources(model.resources);
compliance(model.compliance);
verificationState(model.verificationState);
workflowState(model.workflowState);
recordState(model.recordState);
relatedFindings(model.relatedFindings);
note(model.note);
}
public final String getSchemaVersion() {
return schemaVersion;
}
@Override
public final Builder schemaVersion(String schemaVersion) {
this.schemaVersion = schemaVersion;
return this;
}
public final void setSchemaVersion(String schemaVersion) {
this.schemaVersion = schemaVersion;
}
public final String getId() {
return id;
}
@Override
public final Builder id(String id) {
this.id = id;
return this;
}
public final void setId(String id) {
this.id = id;
}
public final String getProductArn() {
return productArn;
}
@Override
public final Builder productArn(String productArn) {
this.productArn = productArn;
return this;
}
public final void setProductArn(String productArn) {
this.productArn = productArn;
}
public final String getGeneratorId() {
return generatorId;
}
@Override
public final Builder generatorId(String generatorId) {
this.generatorId = generatorId;
return this;
}
public final void setGeneratorId(String generatorId) {
this.generatorId = generatorId;
}
public final String getAwsAccountId() {
return awsAccountId;
}
@Override
public final Builder awsAccountId(String awsAccountId) {
this.awsAccountId = awsAccountId;
return this;
}
public final void setAwsAccountId(String awsAccountId) {
this.awsAccountId = awsAccountId;
}
public final Collection getTypes() {
return types;
}
@Override
public final Builder types(Collection types) {
this.types = TypeListCopier.copy(types);
return this;
}
@Override
@SafeVarargs
public final Builder types(String... types) {
types(Arrays.asList(types));
return this;
}
public final void setTypes(Collection types) {
this.types = TypeListCopier.copy(types);
}
public final String getFirstObservedAt() {
return firstObservedAt;
}
@Override
public final Builder firstObservedAt(String firstObservedAt) {
this.firstObservedAt = firstObservedAt;
return this;
}
public final void setFirstObservedAt(String firstObservedAt) {
this.firstObservedAt = firstObservedAt;
}
public final String getLastObservedAt() {
return lastObservedAt;
}
@Override
public final Builder lastObservedAt(String lastObservedAt) {
this.lastObservedAt = lastObservedAt;
return this;
}
public final void setLastObservedAt(String lastObservedAt) {
this.lastObservedAt = lastObservedAt;
}
public final String getCreatedAt() {
return createdAt;
}
@Override
public final Builder createdAt(String createdAt) {
this.createdAt = createdAt;
return this;
}
public final void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public final String getUpdatedAt() {
return updatedAt;
}
@Override
public final Builder updatedAt(String updatedAt) {
this.updatedAt = updatedAt;
return this;
}
public final void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public final Severity.Builder getSeverity() {
return severity != null ? severity.toBuilder() : null;
}
@Override
public final Builder severity(Severity severity) {
this.severity = severity;
return this;
}
public final void setSeverity(Severity.BuilderImpl severity) {
this.severity = severity != null ? severity.build() : null;
}
public final Integer getConfidence() {
return confidence;
}
@Override
public final Builder confidence(Integer confidence) {
this.confidence = confidence;
return this;
}
public final void setConfidence(Integer confidence) {
this.confidence = confidence;
}
public final Integer getCriticality() {
return criticality;
}
@Override
public final Builder criticality(Integer criticality) {
this.criticality = criticality;
return this;
}
public final void setCriticality(Integer criticality) {
this.criticality = criticality;
}
public final String getTitle() {
return title;
}
@Override
public final Builder title(String title) {
this.title = title;
return this;
}
public final void setTitle(String title) {
this.title = title;
}
public final String getDescription() {
return description;
}
@Override
public final Builder description(String description) {
this.description = description;
return this;
}
public final void setDescription(String description) {
this.description = description;
}
public final Remediation.Builder getRemediation() {
return remediation != null ? remediation.toBuilder() : null;
}
@Override
public final Builder remediation(Remediation remediation) {
this.remediation = remediation;
return this;
}
public final void setRemediation(Remediation.BuilderImpl remediation) {
this.remediation = remediation != null ? remediation.build() : null;
}
public final String getSourceUrl() {
return sourceUrl;
}
@Override
public final Builder sourceUrl(String sourceUrl) {
this.sourceUrl = sourceUrl;
return this;
}
public final void setSourceUrl(String sourceUrl) {
this.sourceUrl = sourceUrl;
}
public final Map getProductFields() {
return productFields;
}
@Override
public final Builder productFields(Map productFields) {
this.productFields = FieldMapCopier.copy(productFields);
return this;
}
public final void setProductFields(Map productFields) {
this.productFields = FieldMapCopier.copy(productFields);
}
public final Map getUserDefinedFields() {
return userDefinedFields;
}
@Override
public final Builder userDefinedFields(Map userDefinedFields) {
this.userDefinedFields = FieldMapCopier.copy(userDefinedFields);
return this;
}
public final void setUserDefinedFields(Map userDefinedFields) {
this.userDefinedFields = FieldMapCopier.copy(userDefinedFields);
}
public final Collection getMalware() {
return malware != null ? malware.stream().map(Malware::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder malware(Collection malware) {
this.malware = MalwareListCopier.copy(malware);
return this;
}
@Override
@SafeVarargs
public final Builder malware(Malware... malware) {
malware(Arrays.asList(malware));
return this;
}
@Override
@SafeVarargs
public final Builder malware(Consumer... malware) {
malware(Stream.of(malware).map(c -> Malware.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setMalware(Collection malware) {
this.malware = MalwareListCopier.copyFromBuilder(malware);
}
public final Network.Builder getNetwork() {
return network != null ? network.toBuilder() : null;
}
@Override
public final Builder network(Network network) {
this.network = network;
return this;
}
public final void setNetwork(Network.BuilderImpl network) {
this.network = network != null ? network.build() : null;
}
public final ProcessDetails.Builder getProcess() {
return process != null ? process.toBuilder() : null;
}
@Override
public final Builder process(ProcessDetails process) {
this.process = process;
return this;
}
public final void setProcess(ProcessDetails.BuilderImpl process) {
this.process = process != null ? process.build() : null;
}
public final Collection getThreatIntelIndicators() {
return threatIntelIndicators != null ? threatIntelIndicators.stream().map(ThreatIntelIndicator::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder threatIntelIndicators(Collection threatIntelIndicators) {
this.threatIntelIndicators = ThreatIntelIndicatorListCopier.copy(threatIntelIndicators);
return this;
}
@Override
@SafeVarargs
public final Builder threatIntelIndicators(ThreatIntelIndicator... threatIntelIndicators) {
threatIntelIndicators(Arrays.asList(threatIntelIndicators));
return this;
}
@Override
@SafeVarargs
public final Builder threatIntelIndicators(Consumer... threatIntelIndicators) {
threatIntelIndicators(Stream.of(threatIntelIndicators)
.map(c -> ThreatIntelIndicator.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setThreatIntelIndicators(Collection threatIntelIndicators) {
this.threatIntelIndicators = ThreatIntelIndicatorListCopier.copyFromBuilder(threatIntelIndicators);
}
public final Collection getResources() {
return resources != null ? resources.stream().map(Resource::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder resources(Collection resources) {
this.resources = ResourceListCopier.copy(resources);
return this;
}
@Override
@SafeVarargs
public final Builder resources(Resource... resources) {
resources(Arrays.asList(resources));
return this;
}
@Override
@SafeVarargs
public final Builder resources(Consumer... resources) {
resources(Stream.of(resources).map(c -> Resource.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
public final void setResources(Collection resources) {
this.resources = ResourceListCopier.copyFromBuilder(resources);
}
public final Compliance.Builder getCompliance() {
return compliance != null ? compliance.toBuilder() : null;
}
@Override
public final Builder compliance(Compliance compliance) {
this.compliance = compliance;
return this;
}
public final void setCompliance(Compliance.BuilderImpl compliance) {
this.compliance = compliance != null ? compliance.build() : null;
}
public final String getVerificationStateAsString() {
return verificationState;
}
@Override
public final Builder verificationState(String verificationState) {
this.verificationState = verificationState;
return this;
}
@Override
public final Builder verificationState(VerificationState verificationState) {
this.verificationState(verificationState == null ? null : verificationState.toString());
return this;
}
public final void setVerificationState(String verificationState) {
this.verificationState = verificationState;
}
public final String getWorkflowStateAsString() {
return workflowState;
}
@Override
public final Builder workflowState(String workflowState) {
this.workflowState = workflowState;
return this;
}
@Override
public final Builder workflowState(WorkflowState workflowState) {
this.workflowState(workflowState == null ? null : workflowState.toString());
return this;
}
public final void setWorkflowState(String workflowState) {
this.workflowState = workflowState;
}
public final String getRecordStateAsString() {
return recordState;
}
@Override
public final Builder recordState(String recordState) {
this.recordState = recordState;
return this;
}
@Override
public final Builder recordState(RecordState recordState) {
this.recordState(recordState == null ? null : recordState.toString());
return this;
}
public final void setRecordState(String recordState) {
this.recordState = recordState;
}
public final Collection getRelatedFindings() {
return relatedFindings != null ? relatedFindings.stream().map(RelatedFinding::toBuilder).collect(Collectors.toList())
: null;
}
@Override
public final Builder relatedFindings(Collection relatedFindings) {
this.relatedFindings = RelatedFindingListCopier.copy(relatedFindings);
return this;
}
@Override
@SafeVarargs
public final Builder relatedFindings(RelatedFinding... relatedFindings) {
relatedFindings(Arrays.asList(relatedFindings));
return this;
}
@Override
@SafeVarargs
public final Builder relatedFindings(Consumer... relatedFindings) {
relatedFindings(Stream.of(relatedFindings).map(c -> RelatedFinding.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final void setRelatedFindings(Collection relatedFindings) {
this.relatedFindings = RelatedFindingListCopier.copyFromBuilder(relatedFindings);
}
public final Note.Builder getNote() {
return note != null ? note.toBuilder() : null;
}
@Override
public final Builder note(Note note) {
this.note = note;
return this;
}
public final void setNote(Note.BuilderImpl note) {
this.note = note != null ? note.build() : null;
}
@Override
public AwsSecurityFinding build() {
return new AwsSecurityFinding(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}