com.azure.resourcemanager.security.fluent.models.AutoProvisioningSettingProperties 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.fluent.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 com.azure.resourcemanager.security.models.AutoProvision;
import java.io.IOException;
/**
* describes properties of an auto provisioning setting.
*/
@Fluent
public final class AutoProvisioningSettingProperties implements JsonSerializable {
/*
* Describes what kind of security agent provisioning action to take
*/
private AutoProvision autoProvision;
/**
* Creates an instance of AutoProvisioningSettingProperties class.
*/
public AutoProvisioningSettingProperties() {
}
/**
* Get the autoProvision property: Describes what kind of security agent provisioning action to take.
*
* @return the autoProvision value.
*/
public AutoProvision autoProvision() {
return this.autoProvision;
}
/**
* Set the autoProvision property: Describes what kind of security agent provisioning action to take.
*
* @param autoProvision the autoProvision value to set.
* @return the AutoProvisioningSettingProperties object itself.
*/
public AutoProvisioningSettingProperties withAutoProvision(AutoProvision autoProvision) {
this.autoProvision = autoProvision;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (autoProvision() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property autoProvision in model AutoProvisioningSettingProperties"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(AutoProvisioningSettingProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("autoProvision", this.autoProvision == null ? null : this.autoProvision.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AutoProvisioningSettingProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AutoProvisioningSettingProperties 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 AutoProvisioningSettingProperties.
*/
public static AutoProvisioningSettingProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AutoProvisioningSettingProperties deserializedAutoProvisioningSettingProperties
= new AutoProvisioningSettingProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("autoProvision".equals(fieldName)) {
deserializedAutoProvisioningSettingProperties.autoProvision
= AutoProvision.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedAutoProvisioningSettingProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy