com.azure.resourcemanager.servicelinker.models.AzureAppConfigProperties 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.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The resource properties when type is Azure App Configuration.
*/
@Fluent
public final class AzureAppConfigProperties extends AzureResourcePropertiesBase {
/*
* The azure resource type.
*/
private AzureResourceType type = AzureResourceType.APP_CONFIG;
/*
* True if connection enables app configuration kubernetes extension.
*/
private Boolean connectWithKubernetesExtension;
/**
* Creates an instance of AzureAppConfigProperties class.
*/
public AzureAppConfigProperties() {
}
/**
* Get the type property: The azure resource type.
*
* @return the type value.
*/
@Override
public AzureResourceType type() {
return this.type;
}
/**
* Get the connectWithKubernetesExtension property: True if connection enables app configuration kubernetes
* extension.
*
* @return the connectWithKubernetesExtension value.
*/
public Boolean connectWithKubernetesExtension() {
return this.connectWithKubernetesExtension;
}
/**
* Set the connectWithKubernetesExtension property: True if connection enables app configuration kubernetes
* extension.
*
* @param connectWithKubernetesExtension the connectWithKubernetesExtension value to set.
* @return the AzureAppConfigProperties object itself.
*/
public AzureAppConfigProperties withConnectWithKubernetesExtension(Boolean connectWithKubernetesExtension) {
this.connectWithKubernetesExtension = connectWithKubernetesExtension;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
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.writeBooleanField("connectWithKubernetesExtension", this.connectWithKubernetesExtension);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of AzureAppConfigProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AzureAppConfigProperties 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 AzureAppConfigProperties.
*/
public static AzureAppConfigProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AzureAppConfigProperties deserializedAzureAppConfigProperties = new AzureAppConfigProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedAzureAppConfigProperties.type = AzureResourceType.fromString(reader.getString());
} else if ("connectWithKubernetesExtension".equals(fieldName)) {
deserializedAzureAppConfigProperties.connectWithKubernetesExtension
= reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedAzureAppConfigProperties;
});
}
}