com.azure.resourcemanager.security.models.RecommendationConfigurationProperties 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.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The type of IoT Security recommendation.
*/
@Fluent
public final class RecommendationConfigurationProperties
implements JsonSerializable {
/*
* The type of IoT Security recommendation.
*/
private RecommendationType recommendationType;
/*
* The name property.
*/
private String name;
/*
* Recommendation status. When the recommendation status is disabled recommendations are not generated.
*/
private RecommendationConfigStatus status;
/**
* Creates an instance of RecommendationConfigurationProperties class.
*/
public RecommendationConfigurationProperties() {
}
/**
* Get the recommendationType property: The type of IoT Security recommendation.
*
* @return the recommendationType value.
*/
public RecommendationType recommendationType() {
return this.recommendationType;
}
/**
* Set the recommendationType property: The type of IoT Security recommendation.
*
* @param recommendationType the recommendationType value to set.
* @return the RecommendationConfigurationProperties object itself.
*/
public RecommendationConfigurationProperties withRecommendationType(RecommendationType recommendationType) {
this.recommendationType = recommendationType;
return this;
}
/**
* Get the name property: The name property.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Get the status property: Recommendation status. When the recommendation status is disabled recommendations are
* not generated.
*
* @return the status value.
*/
public RecommendationConfigStatus status() {
return this.status;
}
/**
* Set the status property: Recommendation status. When the recommendation status is disabled recommendations are
* not generated.
*
* @param status the status value to set.
* @return the RecommendationConfigurationProperties object itself.
*/
public RecommendationConfigurationProperties withStatus(RecommendationConfigStatus status) {
this.status = status;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (recommendationType() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property recommendationType in model RecommendationConfigurationProperties"));
}
if (status() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property status in model RecommendationConfigurationProperties"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(RecommendationConfigurationProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("recommendationType",
this.recommendationType == null ? null : this.recommendationType.toString());
jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of RecommendationConfigurationProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of RecommendationConfigurationProperties if the JsonReader was pointing to an instance of it,
* or null if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the RecommendationConfigurationProperties.
*/
public static RecommendationConfigurationProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
RecommendationConfigurationProperties deserializedRecommendationConfigurationProperties
= new RecommendationConfigurationProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("recommendationType".equals(fieldName)) {
deserializedRecommendationConfigurationProperties.recommendationType
= RecommendationType.fromString(reader.getString());
} else if ("status".equals(fieldName)) {
deserializedRecommendationConfigurationProperties.status
= RecommendationConfigStatus.fromString(reader.getString());
} else if ("name".equals(fieldName)) {
deserializedRecommendationConfigurationProperties.name = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedRecommendationConfigurationProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy