tags;
private CreateScanRequest(BuilderImpl builder) {
super(builder);
this.analysisType = builder.analysisType;
this.clientToken = builder.clientToken;
this.resourceId = builder.resourceId;
this.scanName = builder.scanName;
this.scanType = builder.scanType;
this.tags = builder.tags;
}
/**
*
* The type of analysis you want CodeGuru Security to perform in the scan, either Security
or
* All
. The Security
type only generates findings related to security. The
* All
type generates both security findings and quality findings. Defaults to Security
* type if missing.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #analysisType} will
* return {@link AnalysisType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #analysisTypeAsString}.
*
*
* @return The type of analysis you want CodeGuru Security to perform in the scan, either Security
or
* All
. The Security
type only generates findings related to security. The
* All
type generates both security findings and quality findings. Defaults to
* Security
type if missing.
* @see AnalysisType
*/
public final AnalysisType analysisType() {
return AnalysisType.fromValue(analysisType);
}
/**
*
* The type of analysis you want CodeGuru Security to perform in the scan, either Security
or
* All
. The Security
type only generates findings related to security. The
* All
type generates both security findings and quality findings. Defaults to Security
* type if missing.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #analysisType} will
* return {@link AnalysisType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #analysisTypeAsString}.
*
*
* @return The type of analysis you want CodeGuru Security to perform in the scan, either Security
or
* All
. The Security
type only generates findings related to security. The
* All
type generates both security findings and quality findings. Defaults to
* Security
type if missing.
* @see AnalysisType
*/
public final String analysisTypeAsString() {
return analysisType;
}
/**
*
* The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental
* creation of duplicate scans if there are failures and retries.
*
*
* @return The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental
* creation of duplicate scans if there are failures and retries.
*/
public final String clientToken() {
return clientToken;
}
/**
*
* The identifier for the resource object to be scanned.
*
*
* @return The identifier for the resource object to be scanned.
*/
public final ResourceId resourceId() {
return resourceId;
}
/**
*
* The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource. Only
* allowed for a STANDARD
scan type.
*
*
* @return The unique name that CodeGuru Security uses to track revisions across multiple scans of the same
* resource. Only allowed for a STANDARD
scan type.
*/
public final String scanName() {
return scanName;
}
/**
*
* The type of scan, either Standard
or Express
. Defaults to Standard
type if
* missing.
*
*
* Express
scans run on limited resources and use a limited set of detectors to analyze your code in
* near-real time. Standard
scans have standard resource limits and use the full set of detectors to
* analyze your code.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #scanType} will
* return {@link ScanType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #scanTypeAsString}.
*
*
* @return The type of scan, either Standard
or Express
. Defaults to Standard
* type if missing.
*
* Express
scans run on limited resources and use a limited set of detectors to analyze your
* code in near-real time. Standard
scans have standard resource limits and use the full set of
* detectors to analyze your code.
* @see ScanType
*/
public final ScanType scanType() {
return ScanType.fromValue(scanType);
}
/**
*
* The type of scan, either Standard
or Express
. Defaults to Standard
type if
* missing.
*
*
* Express
scans run on limited resources and use a limited set of detectors to analyze your code in
* near-real time. Standard
scans have standard resource limits and use the full set of detectors to
* analyze your code.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #scanType} will
* return {@link ScanType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #scanTypeAsString}.
*
*
* @return The type of scan, either Standard
or Express
. Defaults to Standard
* type if missing.
*
* Express
scans run on limited resources and use a limited set of detectors to analyze your
* code in near-real time. Standard
scans have standard resource limits and use the full set of
* detectors to analyze your code.
* @see ScanType
*/
public final String scanTypeAsString() {
return scanType;
}
/**
* For responses, this returns true if the service returned a value for the Tags property. This DOES NOT check that
* the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful
* because the SDK will never return a null collection or map, but you may need to differentiate between the service
* returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true
* if a value for the property was specified in the request builder, and false if a value was not specified.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:
*
*
*
*
* A tag key. For example, CostCenter
, Environment
, or Secret
. Tag keys are
* case sensitive.
*
*
*
*
* An optional tag value field. For example, 111122223333
, Production
, or a team name.
* Omitting the tag value is the same as using an empty string. Tag values are case sensitive.
*
*
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTags} method.
*
*
* @return An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:
*
*
*
* A tag key. For example, CostCenter
, Environment
, or Secret
. Tag
* keys are case sensitive.
*
*
*
*
* An optional tag value field. For example, 111122223333
, Production
, or a team
* name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.
*
*
*/
public final Map tags() {
return tags;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(analysisTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(clientToken());
hashCode = 31 * hashCode + Objects.hashCode(resourceId());
hashCode = 31 * hashCode + Objects.hashCode(scanName());
hashCode = 31 * hashCode + Objects.hashCode(scanTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CreateScanRequest)) {
return false;
}
CreateScanRequest other = (CreateScanRequest) obj;
return Objects.equals(analysisTypeAsString(), other.analysisTypeAsString())
&& Objects.equals(clientToken(), other.clientToken()) && Objects.equals(resourceId(), other.resourceId())
&& Objects.equals(scanName(), other.scanName()) && Objects.equals(scanTypeAsString(), other.scanTypeAsString())
&& hasTags() == other.hasTags() && Objects.equals(tags(), other.tags());
}
/**
* 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 final String toString() {
return ToString.builder("CreateScanRequest").add("AnalysisType", analysisTypeAsString())
.add("ClientToken", clientToken()).add("ResourceId", resourceId()).add("ScanName", scanName())
.add("ScanType", scanTypeAsString()).add("Tags", hasTags() ? tags() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "analysisType":
return Optional.ofNullable(clazz.cast(analysisTypeAsString()));
case "clientToken":
return Optional.ofNullable(clazz.cast(clientToken()));
case "resourceId":
return Optional.ofNullable(clazz.cast(resourceId()));
case "scanName":
return Optional.ofNullable(clazz.cast(scanName()));
case "scanType":
return Optional.ofNullable(clazz.cast(scanTypeAsString()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((CreateScanRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends CodeGuruSecurityRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The type of analysis you want CodeGuru Security to perform in the scan, either Security
or
* All
. The Security
type only generates findings related to security. The
* All
type generates both security findings and quality findings. Defaults to
* Security
type if missing.
*
*
* @param analysisType
* The type of analysis you want CodeGuru Security to perform in the scan, either Security
* or All
. The Security
type only generates findings related to security. The
* All
type generates both security findings and quality findings. Defaults to
* Security
type if missing.
* @see AnalysisType
* @return Returns a reference to this object so that method calls can be chained together.
* @see AnalysisType
*/
Builder analysisType(String analysisType);
/**
*
* The type of analysis you want CodeGuru Security to perform in the scan, either Security
or
* All
. The Security
type only generates findings related to security. The
* All
type generates both security findings and quality findings. Defaults to
* Security
type if missing.
*
*
* @param analysisType
* The type of analysis you want CodeGuru Security to perform in the scan, either Security
* or All
. The Security
type only generates findings related to security. The
* All
type generates both security findings and quality findings. Defaults to
* Security
type if missing.
* @see AnalysisType
* @return Returns a reference to this object so that method calls can be chained together.
* @see AnalysisType
*/
Builder analysisType(AnalysisType analysisType);
/**
*
* The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the accidental
* creation of duplicate scans if there are failures and retries.
*
*
* @param clientToken
* The idempotency token for the request. Amazon CodeGuru Security uses this value to prevent the
* accidental creation of duplicate scans if there are failures and retries.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clientToken(String clientToken);
/**
*
* The identifier for the resource object to be scanned.
*
*
* @param resourceId
* The identifier for the resource object to be scanned.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder resourceId(ResourceId resourceId);
/**
*
* The identifier for the resource object to be scanned.
*
* This is a convenience method that creates an instance of the {@link ResourceId.Builder} avoiding the need to
* create one manually via {@link ResourceId#builder()}.
*
*
* When the {@link Consumer} completes, {@link ResourceId.Builder#build()} is called immediately and its result
* is passed to {@link #resourceId(ResourceId)}.
*
* @param resourceId
* a consumer that will call methods on {@link ResourceId.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #resourceId(ResourceId)
*/
default Builder resourceId(Consumer resourceId) {
return resourceId(ResourceId.builder().applyMutation(resourceId).build());
}
/**
*
* The unique name that CodeGuru Security uses to track revisions across multiple scans of the same resource.
* Only allowed for a STANDARD
scan type.
*
*
* @param scanName
* The unique name that CodeGuru Security uses to track revisions across multiple scans of the same
* resource. Only allowed for a STANDARD
scan type.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder scanName(String scanName);
/**
*
* The type of scan, either Standard
or Express
. Defaults to Standard
* type if missing.
*
*
* Express
scans run on limited resources and use a limited set of detectors to analyze your code
* in near-real time. Standard
scans have standard resource limits and use the full set of
* detectors to analyze your code.
*
*
* @param scanType
* The type of scan, either Standard
or Express
. Defaults to
* Standard
type if missing.
*
* Express
scans run on limited resources and use a limited set of detectors to analyze your
* code in near-real time. Standard
scans have standard resource limits and use the full set
* of detectors to analyze your code.
* @see ScanType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ScanType
*/
Builder scanType(String scanType);
/**
*
* The type of scan, either Standard
or Express
. Defaults to Standard
* type if missing.
*
*
* Express
scans run on limited resources and use a limited set of detectors to analyze your code
* in near-real time. Standard
scans have standard resource limits and use the full set of
* detectors to analyze your code.
*
*
* @param scanType
* The type of scan, either Standard
or Express
. Defaults to
* Standard
type if missing.
*
* Express
scans run on limited resources and use a limited set of detectors to analyze your
* code in near-real time. Standard
scans have standard resource limits and use the full set
* of detectors to analyze your code.
* @see ScanType
* @return Returns a reference to this object so that method calls can be chained together.
* @see ScanType
*/
Builder scanType(ScanType scanType);
/**
*
* An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:
*
*
*
*
* A tag key. For example, CostCenter
, Environment
, or Secret
. Tag keys
* are case sensitive.
*
*
*
*
* An optional tag value field. For example, 111122223333
, Production
, or a team name.
* Omitting the tag value is the same as using an empty string. Tag values are case sensitive.
*
*
*
*
* @param tags
* An array of key-value pairs used to tag a scan. A tag is a custom attribute label with two parts:
*
*
*
* A tag key. For example, CostCenter
, Environment
, or Secret
. Tag
* keys are case sensitive.
*
*
*
*
* An optional tag value field. For example, 111122223333
, Production
, or a
* team name. Omitting the tag value is the same as using an empty string. Tag values are case sensitive.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends CodeGuruSecurityRequest.BuilderImpl implements Builder {
private String analysisType;
private String clientToken;
private ResourceId resourceId;
private String scanName;
private String scanType;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private BuilderImpl() {
}
private BuilderImpl(CreateScanRequest model) {
super(model);
analysisType(model.analysisType);
clientToken(model.clientToken);
resourceId(model.resourceId);
scanName(model.scanName);
scanType(model.scanType);
tags(model.tags);
}
public final String getAnalysisType() {
return analysisType;
}
public final void setAnalysisType(String analysisType) {
this.analysisType = analysisType;
}
@Override
public final Builder analysisType(String analysisType) {
this.analysisType = analysisType;
return this;
}
@Override
public final Builder analysisType(AnalysisType analysisType) {
this.analysisType(analysisType == null ? null : analysisType.toString());
return this;
}
public final String getClientToken() {
return clientToken;
}
public final void setClientToken(String clientToken) {
this.clientToken = clientToken;
}
@Override
public final Builder clientToken(String clientToken) {
this.clientToken = clientToken;
return this;
}
public final ResourceId.Builder getResourceId() {
return resourceId != null ? resourceId.toBuilder() : null;
}
public final void setResourceId(ResourceId.BuilderImpl resourceId) {
this.resourceId = resourceId != null ? resourceId.build() : null;
}
@Override
public final Builder resourceId(ResourceId resourceId) {
this.resourceId = resourceId;
return this;
}
public final String getScanName() {
return scanName;
}
public final void setScanName(String scanName) {
this.scanName = scanName;
}
@Override
public final Builder scanName(String scanName) {
this.scanName = scanName;
return this;
}
public final String getScanType() {
return scanType;
}
public final void setScanType(String scanType) {
this.scanType = scanType;
}
@Override
public final Builder scanType(String scanType) {
this.scanType = scanType;
return this;
}
@Override
public final Builder scanType(ScanType scanType) {
this.scanType(scanType == null ? null : scanType.toString());
return this;
}
public final Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
return tags;
}
public final void setTags(Map tags) {
this.tags = TagMapCopier.copy(tags);
}
@Override
public final Builder tags(Map tags) {
this.tags = TagMapCopier.copy(tags);
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public CreateScanRequest build() {
return new CreateScanRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}