software.amazon.awssdk.services.codegurusecurity.model.GetScanResponse Maven / Gradle / Ivy
Show all versions of codegurusecurity Show documentation
/*
* Copyright 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.codegurusecurity.model;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetScanResponse extends CodeGuruSecurityResponse implements
ToCopyableBuilder {
private static final SdkField ANALYSIS_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("analysisType").getter(getter(GetScanResponse::analysisTypeAsString))
.setter(setter(Builder::analysisType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("analysisType").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("createdAt").getter(getter(GetScanResponse::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("createdAt").build()).build();
private static final SdkField ERROR_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("errorMessage").getter(getter(GetScanResponse::errorMessage)).setter(setter(Builder::errorMessage))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("errorMessage").build()).build();
private static final SdkField NUMBER_OF_REVISIONS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("numberOfRevisions").getter(getter(GetScanResponse::numberOfRevisions))
.setter(setter(Builder::numberOfRevisions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("numberOfRevisions").build()).build();
private static final SdkField RUN_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("runId")
.getter(getter(GetScanResponse::runId)).setter(setter(Builder::runId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("runId").build()).build();
private static final SdkField SCAN_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("scanName").getter(getter(GetScanResponse::scanName)).setter(setter(Builder::scanName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scanName").build()).build();
private static final SdkField SCAN_NAME_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("scanNameArn").getter(getter(GetScanResponse::scanNameArn)).setter(setter(Builder::scanNameArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scanNameArn").build()).build();
private static final SdkField SCAN_STATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("scanState").getter(getter(GetScanResponse::scanStateAsString)).setter(setter(Builder::scanState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scanState").build()).build();
private static final SdkField UPDATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("updatedAt").getter(getter(GetScanResponse::updatedAt)).setter(setter(Builder::updatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("updatedAt").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ANALYSIS_TYPE_FIELD,
CREATED_AT_FIELD, ERROR_MESSAGE_FIELD, NUMBER_OF_REVISIONS_FIELD, RUN_ID_FIELD, SCAN_NAME_FIELD, SCAN_NAME_ARN_FIELD,
SCAN_STATE_FIELD, UPDATED_AT_FIELD));
private final String analysisType;
private final Instant createdAt;
private final String errorMessage;
private final Long numberOfRevisions;
private final String runId;
private final String scanName;
private final String scanNameArn;
private final String scanState;
private final Instant updatedAt;
private GetScanResponse(BuilderImpl builder) {
super(builder);
this.analysisType = builder.analysisType;
this.createdAt = builder.createdAt;
this.errorMessage = builder.errorMessage;
this.numberOfRevisions = builder.numberOfRevisions;
this.runId = builder.runId;
this.scanName = builder.scanName;
this.scanNameArn = builder.scanNameArn;
this.scanState = builder.scanState;
this.updatedAt = builder.updatedAt;
}
/**
*
* The type of analysis CodeGuru Security performed 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.
*
*
* 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 CodeGuru Security performed 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.
* @see AnalysisType
*/
public final AnalysisType analysisType() {
return AnalysisType.fromValue(analysisType);
}
/**
*
* The type of analysis CodeGuru Security performed 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.
*
*
* 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 CodeGuru Security performed 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.
* @see AnalysisType
*/
public final String analysisTypeAsString() {
return analysisType;
}
/**
*
* The time the scan was created.
*
*
* @return The time the scan was created.
*/
public final Instant createdAt() {
return createdAt;
}
/**
*
* Details about the error that causes a scan to fail to be retrieved.
*
*
* @return Details about the error that causes a scan to fail to be retrieved.
*/
public final String errorMessage() {
return errorMessage;
}
/**
*
* The number of times a scan has been re-run on a revised resource.
*
*
* @return The number of times a scan has been re-run on a revised resource.
*/
public final Long numberOfRevisions() {
return numberOfRevisions;
}
/**
*
* UUID that identifies the individual scan run.
*
*
* @return UUID that identifies the individual scan run.
*/
public final String runId() {
return runId;
}
/**
*
* The name of the scan.
*
*
* @return The name of the scan.
*/
public final String scanName() {
return scanName;
}
/**
*
* The ARN for the scan name.
*
*
* @return The ARN for the scan name.
*/
public final String scanNameArn() {
return scanNameArn;
}
/**
*
* The current state of the scan. Returns either InProgress
, Successful
, or
* Failed
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #scanState} will
* return {@link ScanState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #scanStateAsString}.
*
*
* @return The current state of the scan. Returns either InProgress
, Successful
, or
* Failed
.
* @see ScanState
*/
public final ScanState scanState() {
return ScanState.fromValue(scanState);
}
/**
*
* The current state of the scan. Returns either InProgress
, Successful
, or
* Failed
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #scanState} will
* return {@link ScanState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #scanStateAsString}.
*
*
* @return The current state of the scan. Returns either InProgress
, Successful
, or
* Failed
.
* @see ScanState
*/
public final String scanStateAsString() {
return scanState;
}
/**
*
* The time when the scan was last updated. Only available for STANDARD
scan types.
*
*
* @return The time when the scan was last updated. Only available for STANDARD
scan types.
*/
public final Instant updatedAt() {
return updatedAt;
}
@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(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(errorMessage());
hashCode = 31 * hashCode + Objects.hashCode(numberOfRevisions());
hashCode = 31 * hashCode + Objects.hashCode(runId());
hashCode = 31 * hashCode + Objects.hashCode(scanName());
hashCode = 31 * hashCode + Objects.hashCode(scanNameArn());
hashCode = 31 * hashCode + Objects.hashCode(scanStateAsString());
hashCode = 31 * hashCode + Objects.hashCode(updatedAt());
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 GetScanResponse)) {
return false;
}
GetScanResponse other = (GetScanResponse) obj;
return Objects.equals(analysisTypeAsString(), other.analysisTypeAsString())
&& Objects.equals(createdAt(), other.createdAt()) && Objects.equals(errorMessage(), other.errorMessage())
&& Objects.equals(numberOfRevisions(), other.numberOfRevisions()) && Objects.equals(runId(), other.runId())
&& Objects.equals(scanName(), other.scanName()) && Objects.equals(scanNameArn(), other.scanNameArn())
&& Objects.equals(scanStateAsString(), other.scanStateAsString())
&& Objects.equals(updatedAt(), other.updatedAt());
}
/**
* 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("GetScanResponse").add("AnalysisType", analysisTypeAsString()).add("CreatedAt", createdAt())
.add("ErrorMessage", errorMessage()).add("NumberOfRevisions", numberOfRevisions()).add("RunId", runId())
.add("ScanName", scanName()).add("ScanNameArn", scanNameArn()).add("ScanState", scanStateAsString())
.add("UpdatedAt", updatedAt()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "analysisType":
return Optional.ofNullable(clazz.cast(analysisTypeAsString()));
case "createdAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "errorMessage":
return Optional.ofNullable(clazz.cast(errorMessage()));
case "numberOfRevisions":
return Optional.ofNullable(clazz.cast(numberOfRevisions()));
case "runId":
return Optional.ofNullable(clazz.cast(runId()));
case "scanName":
return Optional.ofNullable(clazz.cast(scanName()));
case "scanNameArn":
return Optional.ofNullable(clazz.cast(scanNameArn()));
case "scanState":
return Optional.ofNullable(clazz.cast(scanStateAsString()));
case "updatedAt":
return Optional.ofNullable(clazz.cast(updatedAt()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function