com.azure.resourcemanager.servicelinker.models.VNetSolution 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.servicelinker.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 VNet solution for linker.
*/
@Fluent
public final class VNetSolution implements JsonSerializable {
/*
* Type of VNet solution.
*/
private VNetSolutionType type;
/*
* Indicates whether to clean up previous operation when Linker is updating or deleting
*/
private DeleteOrUpdateBehavior deleteOrUpdateBehavior;
/**
* Creates an instance of VNetSolution class.
*/
public VNetSolution() {
}
/**
* Get the type property: Type of VNet solution.
*
* @return the type value.
*/
public VNetSolutionType type() {
return this.type;
}
/**
* Set the type property: Type of VNet solution.
*
* @param type the type value to set.
* @return the VNetSolution object itself.
*/
public VNetSolution withType(VNetSolutionType type) {
this.type = type;
return this;
}
/**
* Get the deleteOrUpdateBehavior property: Indicates whether to clean up previous operation when Linker is updating
* or deleting.
*
* @return the deleteOrUpdateBehavior value.
*/
public DeleteOrUpdateBehavior deleteOrUpdateBehavior() {
return this.deleteOrUpdateBehavior;
}
/**
* Set the deleteOrUpdateBehavior property: Indicates whether to clean up previous operation when Linker is updating
* or deleting.
*
* @param deleteOrUpdateBehavior the deleteOrUpdateBehavior value to set.
* @return the VNetSolution object itself.
*/
public VNetSolution withDeleteOrUpdateBehavior(DeleteOrUpdateBehavior deleteOrUpdateBehavior) {
this.deleteOrUpdateBehavior = deleteOrUpdateBehavior;
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("type", this.type == null ? null : this.type.toString());
jsonWriter.writeStringField("deleteOrUpdateBehavior",
this.deleteOrUpdateBehavior == null ? null : this.deleteOrUpdateBehavior.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of VNetSolution from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of VNetSolution 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 VNetSolution.
*/
public static VNetSolution fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
VNetSolution deserializedVNetSolution = new VNetSolution();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedVNetSolution.type = VNetSolutionType.fromString(reader.getString());
} else if ("deleteOrUpdateBehavior".equals(fieldName)) {
deserializedVNetSolution.deleteOrUpdateBehavior
= DeleteOrUpdateBehavior.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedVNetSolution;
});
}
}