com.azure.resourcemanager.security.models.ScanProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-security Show documentation
Show all versions of azure-resourcemanager-security Show documentation
This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.security.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* A vulnerability assessment scan record properties.
*/
@Fluent
public final class ScanProperties implements JsonSerializable {
/*
* The scan trigger type.
*/
private ScanTriggerType triggerType;
/*
* The scan status.
*/
private ScanState state;
/*
* The server name.
*/
private String server;
/*
* The database name.
*/
private String database;
/*
* The SQL version.
*/
private String sqlVersion;
/*
* The scan start time (UTC).
*/
private OffsetDateTime startTime;
/*
* Scan results are valid until end time (UTC).
*/
private OffsetDateTime endTime;
/*
* The number of failed rules with high severity.
*/
private Integer highSeverityFailedRulesCount;
/*
* The number of failed rules with medium severity.
*/
private Integer mediumSeverityFailedRulesCount;
/*
* The number of failed rules with low severity.
*/
private Integer lowSeverityFailedRulesCount;
/*
* The number of total passed rules.
*/
private Integer totalPassedRulesCount;
/*
* The number of total failed rules.
*/
private Integer totalFailedRulesCount;
/*
* The number of total rules assessed.
*/
private Integer totalRulesCount;
/*
* Baseline created for this database, and has one or more rules.
*/
private Boolean isBaselineApplied;
/*
* Last scan time.
*/
private OffsetDateTime lastScanTime;
/**
* Creates an instance of ScanProperties class.
*/
public ScanProperties() {
}
/**
* Get the triggerType property: The scan trigger type.
*
* @return the triggerType value.
*/
public ScanTriggerType triggerType() {
return this.triggerType;
}
/**
* Set the triggerType property: The scan trigger type.
*
* @param triggerType the triggerType value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withTriggerType(ScanTriggerType triggerType) {
this.triggerType = triggerType;
return this;
}
/**
* Get the state property: The scan status.
*
* @return the state value.
*/
public ScanState state() {
return this.state;
}
/**
* Set the state property: The scan status.
*
* @param state the state value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withState(ScanState state) {
this.state = state;
return this;
}
/**
* Get the server property: The server name.
*
* @return the server value.
*/
public String server() {
return this.server;
}
/**
* Set the server property: The server name.
*
* @param server the server value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withServer(String server) {
this.server = server;
return this;
}
/**
* Get the database property: The database name.
*
* @return the database value.
*/
public String database() {
return this.database;
}
/**
* Set the database property: The database name.
*
* @param database the database value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withDatabase(String database) {
this.database = database;
return this;
}
/**
* Get the sqlVersion property: The SQL version.
*
* @return the sqlVersion value.
*/
public String sqlVersion() {
return this.sqlVersion;
}
/**
* Set the sqlVersion property: The SQL version.
*
* @param sqlVersion the sqlVersion value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withSqlVersion(String sqlVersion) {
this.sqlVersion = sqlVersion;
return this;
}
/**
* Get the startTime property: The scan start time (UTC).
*
* @return the startTime value.
*/
public OffsetDateTime startTime() {
return this.startTime;
}
/**
* Set the startTime property: The scan start time (UTC).
*
* @param startTime the startTime value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withStartTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
/**
* Get the endTime property: Scan results are valid until end time (UTC).
*
* @return the endTime value.
*/
public OffsetDateTime endTime() {
return this.endTime;
}
/**
* Set the endTime property: Scan results are valid until end time (UTC).
*
* @param endTime the endTime value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withEndTime(OffsetDateTime endTime) {
this.endTime = endTime;
return this;
}
/**
* Get the highSeverityFailedRulesCount property: The number of failed rules with high severity.
*
* @return the highSeverityFailedRulesCount value.
*/
public Integer highSeverityFailedRulesCount() {
return this.highSeverityFailedRulesCount;
}
/**
* Set the highSeverityFailedRulesCount property: The number of failed rules with high severity.
*
* @param highSeverityFailedRulesCount the highSeverityFailedRulesCount value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withHighSeverityFailedRulesCount(Integer highSeverityFailedRulesCount) {
this.highSeverityFailedRulesCount = highSeverityFailedRulesCount;
return this;
}
/**
* Get the mediumSeverityFailedRulesCount property: The number of failed rules with medium severity.
*
* @return the mediumSeverityFailedRulesCount value.
*/
public Integer mediumSeverityFailedRulesCount() {
return this.mediumSeverityFailedRulesCount;
}
/**
* Set the mediumSeverityFailedRulesCount property: The number of failed rules with medium severity.
*
* @param mediumSeverityFailedRulesCount the mediumSeverityFailedRulesCount value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withMediumSeverityFailedRulesCount(Integer mediumSeverityFailedRulesCount) {
this.mediumSeverityFailedRulesCount = mediumSeverityFailedRulesCount;
return this;
}
/**
* Get the lowSeverityFailedRulesCount property: The number of failed rules with low severity.
*
* @return the lowSeverityFailedRulesCount value.
*/
public Integer lowSeverityFailedRulesCount() {
return this.lowSeverityFailedRulesCount;
}
/**
* Set the lowSeverityFailedRulesCount property: The number of failed rules with low severity.
*
* @param lowSeverityFailedRulesCount the lowSeverityFailedRulesCount value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withLowSeverityFailedRulesCount(Integer lowSeverityFailedRulesCount) {
this.lowSeverityFailedRulesCount = lowSeverityFailedRulesCount;
return this;
}
/**
* Get the totalPassedRulesCount property: The number of total passed rules.
*
* @return the totalPassedRulesCount value.
*/
public Integer totalPassedRulesCount() {
return this.totalPassedRulesCount;
}
/**
* Set the totalPassedRulesCount property: The number of total passed rules.
*
* @param totalPassedRulesCount the totalPassedRulesCount value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withTotalPassedRulesCount(Integer totalPassedRulesCount) {
this.totalPassedRulesCount = totalPassedRulesCount;
return this;
}
/**
* Get the totalFailedRulesCount property: The number of total failed rules.
*
* @return the totalFailedRulesCount value.
*/
public Integer totalFailedRulesCount() {
return this.totalFailedRulesCount;
}
/**
* Set the totalFailedRulesCount property: The number of total failed rules.
*
* @param totalFailedRulesCount the totalFailedRulesCount value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withTotalFailedRulesCount(Integer totalFailedRulesCount) {
this.totalFailedRulesCount = totalFailedRulesCount;
return this;
}
/**
* Get the totalRulesCount property: The number of total rules assessed.
*
* @return the totalRulesCount value.
*/
public Integer totalRulesCount() {
return this.totalRulesCount;
}
/**
* Set the totalRulesCount property: The number of total rules assessed.
*
* @param totalRulesCount the totalRulesCount value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withTotalRulesCount(Integer totalRulesCount) {
this.totalRulesCount = totalRulesCount;
return this;
}
/**
* Get the isBaselineApplied property: Baseline created for this database, and has one or more rules.
*
* @return the isBaselineApplied value.
*/
public Boolean isBaselineApplied() {
return this.isBaselineApplied;
}
/**
* Set the isBaselineApplied property: Baseline created for this database, and has one or more rules.
*
* @param isBaselineApplied the isBaselineApplied value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withIsBaselineApplied(Boolean isBaselineApplied) {
this.isBaselineApplied = isBaselineApplied;
return this;
}
/**
* Get the lastScanTime property: Last scan time.
*
* @return the lastScanTime value.
*/
public OffsetDateTime lastScanTime() {
return this.lastScanTime;
}
/**
* Set the lastScanTime property: Last scan time.
*
* @param lastScanTime the lastScanTime value to set.
* @return the ScanProperties object itself.
*/
public ScanProperties withLastScanTime(OffsetDateTime lastScanTime) {
this.lastScanTime = lastScanTime;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("triggerType", this.triggerType == null ? null : this.triggerType.toString());
jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString());
jsonWriter.writeStringField("server", this.server);
jsonWriter.writeStringField("database", this.database);
jsonWriter.writeStringField("sqlVersion", this.sqlVersion);
jsonWriter.writeStringField("startTime",
this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime));
jsonWriter.writeStringField("endTime",
this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime));
jsonWriter.writeNumberField("highSeverityFailedRulesCount", this.highSeverityFailedRulesCount);
jsonWriter.writeNumberField("mediumSeverityFailedRulesCount", this.mediumSeverityFailedRulesCount);
jsonWriter.writeNumberField("lowSeverityFailedRulesCount", this.lowSeverityFailedRulesCount);
jsonWriter.writeNumberField("totalPassedRulesCount", this.totalPassedRulesCount);
jsonWriter.writeNumberField("totalFailedRulesCount", this.totalFailedRulesCount);
jsonWriter.writeNumberField("totalRulesCount", this.totalRulesCount);
jsonWriter.writeBooleanField("isBaselineApplied", this.isBaselineApplied);
jsonWriter.writeStringField("lastScanTime",
this.lastScanTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastScanTime));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ScanProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ScanProperties if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IOException If an error occurs while reading the ScanProperties.
*/
public static ScanProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ScanProperties deserializedScanProperties = new ScanProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("triggerType".equals(fieldName)) {
deserializedScanProperties.triggerType = ScanTriggerType.fromString(reader.getString());
} else if ("state".equals(fieldName)) {
deserializedScanProperties.state = ScanState.fromString(reader.getString());
} else if ("server".equals(fieldName)) {
deserializedScanProperties.server = reader.getString();
} else if ("database".equals(fieldName)) {
deserializedScanProperties.database = reader.getString();
} else if ("sqlVersion".equals(fieldName)) {
deserializedScanProperties.sqlVersion = reader.getString();
} else if ("startTime".equals(fieldName)) {
deserializedScanProperties.startTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("endTime".equals(fieldName)) {
deserializedScanProperties.endTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("highSeverityFailedRulesCount".equals(fieldName)) {
deserializedScanProperties.highSeverityFailedRulesCount = reader.getNullable(JsonReader::getInt);
} else if ("mediumSeverityFailedRulesCount".equals(fieldName)) {
deserializedScanProperties.mediumSeverityFailedRulesCount = reader.getNullable(JsonReader::getInt);
} else if ("lowSeverityFailedRulesCount".equals(fieldName)) {
deserializedScanProperties.lowSeverityFailedRulesCount = reader.getNullable(JsonReader::getInt);
} else if ("totalPassedRulesCount".equals(fieldName)) {
deserializedScanProperties.totalPassedRulesCount = reader.getNullable(JsonReader::getInt);
} else if ("totalFailedRulesCount".equals(fieldName)) {
deserializedScanProperties.totalFailedRulesCount = reader.getNullable(JsonReader::getInt);
} else if ("totalRulesCount".equals(fieldName)) {
deserializedScanProperties.totalRulesCount = reader.getNullable(JsonReader::getInt);
} else if ("isBaselineApplied".equals(fieldName)) {
deserializedScanProperties.isBaselineApplied = reader.getNullable(JsonReader::getBoolean);
} else if ("lastScanTime".equals(fieldName)) {
deserializedScanProperties.lastScanTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else {
reader.skipChildren();
}
}
return deserializedScanProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy