software.amazon.awssdk.services.codegurusecurity.model.CreateScanResponse 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.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.Consumer;
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 CreateScanResponse extends CodeGuruSecurityResponse implements
ToCopyableBuilder {
private static final SdkField RESOURCE_ID_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("resourceId").getter(getter(CreateScanResponse::resourceId)).setter(setter(Builder::resourceId))
.constructor(ResourceId::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceId").build()).build();
private static final SdkField RUN_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("runId")
.getter(getter(CreateScanResponse::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(CreateScanResponse::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(CreateScanResponse::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(CreateScanResponse::scanStateAsString)).setter(setter(Builder::scanState))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scanState").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESOURCE_ID_FIELD,
RUN_ID_FIELD, SCAN_NAME_FIELD, SCAN_NAME_ARN_FIELD, SCAN_STATE_FIELD));
private final ResourceId resourceId;
private final String runId;
private final String scanName;
private final String scanNameArn;
private final String scanState;
private CreateScanResponse(BuilderImpl builder) {
super(builder);
this.resourceId = builder.resourceId;
this.runId = builder.runId;
this.scanName = builder.scanName;
this.scanNameArn = builder.scanNameArn;
this.scanState = builder.scanState;
}
/**
*
* The identifier for the resource object that contains resources that were scanned.
*
*
* @return The identifier for the resource object that contains resources that were scanned.
*/
public final ResourceId resourceId() {
return resourceId;
}
/**
*
* 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;
}
@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(resourceId());
hashCode = 31 * hashCode + Objects.hashCode(runId());
hashCode = 31 * hashCode + Objects.hashCode(scanName());
hashCode = 31 * hashCode + Objects.hashCode(scanNameArn());
hashCode = 31 * hashCode + Objects.hashCode(scanStateAsString());
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 CreateScanResponse)) {
return false;
}
CreateScanResponse other = (CreateScanResponse) obj;
return Objects.equals(resourceId(), other.resourceId()) && Objects.equals(runId(), other.runId())
&& Objects.equals(scanName(), other.scanName()) && Objects.equals(scanNameArn(), other.scanNameArn())
&& Objects.equals(scanStateAsString(), other.scanStateAsString());
}
/**
* 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("CreateScanResponse").add("ResourceId", resourceId()).add("RunId", runId())
.add("ScanName", scanName()).add("ScanNameArn", scanNameArn()).add("ScanState", scanStateAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "resourceId":
return Optional.ofNullable(clazz.cast(resourceId()));
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()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function