com.azure.resourcemanager.security.models.SecureScoreControlDefinitionSource 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;
/**
* The type of the security control (For example, BuiltIn).
*/
@Fluent
public final class SecureScoreControlDefinitionSource implements JsonSerializable {
/*
* The type of security control (for example, BuiltIn)
*/
private ControlType sourceType;
/**
* Creates an instance of SecureScoreControlDefinitionSource class.
*/
public SecureScoreControlDefinitionSource() {
}
/**
* Get the sourceType property: The type of security control (for example, BuiltIn).
*
* @return the sourceType value.
*/
public ControlType sourceType() {
return this.sourceType;
}
/**
* Set the sourceType property: The type of security control (for example, BuiltIn).
*
* @param sourceType the sourceType value to set.
* @return the SecureScoreControlDefinitionSource object itself.
*/
public SecureScoreControlDefinitionSource withSourceType(ControlType sourceType) {
this.sourceType = sourceType;
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("sourceType", this.sourceType == null ? null : this.sourceType.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SecureScoreControlDefinitionSource from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SecureScoreControlDefinitionSource 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 SecureScoreControlDefinitionSource.
*/
public static SecureScoreControlDefinitionSource fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SecureScoreControlDefinitionSource deserializedSecureScoreControlDefinitionSource
= new SecureScoreControlDefinitionSource();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("sourceType".equals(fieldName)) {
deserializedSecureScoreControlDefinitionSource.sourceType
= ControlType.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedSecureScoreControlDefinitionSource;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy