com.azure.resourcemanager.security.models.CategoryConfiguration Maven / Gradle / Ivy
// 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Severity level per category configuration for PR Annotations.
*/
@Fluent
public final class CategoryConfiguration implements JsonSerializable {
/*
* Gets or sets minimum severity level for a given category.
*/
private String minimumSeverityLevel;
/*
* Rule categories.
* Code - code scanning results.
* Artifact scanning results.
* Dependencies scanning results.
* IaC results.
* Secrets scanning results.
* Container scanning results.
*/
private RuleCategory category;
/**
* Creates an instance of CategoryConfiguration class.
*/
public CategoryConfiguration() {
}
/**
* Get the minimumSeverityLevel property: Gets or sets minimum severity level for a given category.
*
* @return the minimumSeverityLevel value.
*/
public String minimumSeverityLevel() {
return this.minimumSeverityLevel;
}
/**
* Set the minimumSeverityLevel property: Gets or sets minimum severity level for a given category.
*
* @param minimumSeverityLevel the minimumSeverityLevel value to set.
* @return the CategoryConfiguration object itself.
*/
public CategoryConfiguration withMinimumSeverityLevel(String minimumSeverityLevel) {
this.minimumSeverityLevel = minimumSeverityLevel;
return this;
}
/**
* Get the category property: Rule categories.
* Code - code scanning results.
* Artifact scanning results.
* Dependencies scanning results.
* IaC results.
* Secrets scanning results.
* Container scanning results.
*
* @return the category value.
*/
public RuleCategory category() {
return this.category;
}
/**
* Set the category property: Rule categories.
* Code - code scanning results.
* Artifact scanning results.
* Dependencies scanning results.
* IaC results.
* Secrets scanning results.
* Container scanning results.
*
* @param category the category value to set.
* @return the CategoryConfiguration object itself.
*/
public CategoryConfiguration withCategory(RuleCategory category) {
this.category = category;
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("minimumSeverityLevel", this.minimumSeverityLevel);
jsonWriter.writeStringField("category", this.category == null ? null : this.category.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of CategoryConfiguration from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CategoryConfiguration 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 CategoryConfiguration.
*/
public static CategoryConfiguration fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
CategoryConfiguration deserializedCategoryConfiguration = new CategoryConfiguration();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("minimumSeverityLevel".equals(fieldName)) {
deserializedCategoryConfiguration.minimumSeverityLevel = reader.getString();
} else if ("category".equals(fieldName)) {
deserializedCategoryConfiguration.category = RuleCategory.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedCategoryConfiguration;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy