com.azure.resourcemanager.servicelinker.fluent.models.DaprConfigurationResourceInner 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.fluent.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 com.azure.resourcemanager.servicelinker.models.AuthType;
import com.azure.resourcemanager.servicelinker.models.DaprProperties;
import java.io.IOException;
/**
* Represent one resource of the dapr configuration list.
*/
@Fluent
public final class DaprConfigurationResourceInner implements JsonSerializable {
/*
* The properties of the dapr configuration.
*/
private DaprConfigurationProperties innerProperties;
/**
* Creates an instance of DaprConfigurationResourceInner class.
*/
public DaprConfigurationResourceInner() {
}
/**
* Get the innerProperties property: The properties of the dapr configuration.
*
* @return the innerProperties value.
*/
private DaprConfigurationProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the targetType property: Supported target resource type, extract from resource id, uppercase.
*
* @return the targetType value.
*/
public String targetType() {
return this.innerProperties() == null ? null : this.innerProperties().targetType();
}
/**
* Set the targetType property: Supported target resource type, extract from resource id, uppercase.
*
* @param targetType the targetType value to set.
* @return the DaprConfigurationResourceInner object itself.
*/
public DaprConfigurationResourceInner withTargetType(String targetType) {
if (this.innerProperties() == null) {
this.innerProperties = new DaprConfigurationProperties();
}
this.innerProperties().withTargetType(targetType);
return this;
}
/**
* Get the authType property: The authentication type.
*
* @return the authType value.
*/
public AuthType authType() {
return this.innerProperties() == null ? null : this.innerProperties().authType();
}
/**
* Set the authType property: The authentication type.
*
* @param authType the authType value to set.
* @return the DaprConfigurationResourceInner object itself.
*/
public DaprConfigurationResourceInner withAuthType(AuthType authType) {
if (this.innerProperties() == null) {
this.innerProperties = new DaprConfigurationProperties();
}
this.innerProperties().withAuthType(authType);
return this;
}
/**
* Get the daprProperties property: Indicates some additional properties for dapr client type.
*
* @return the daprProperties value.
*/
public DaprProperties daprProperties() {
return this.innerProperties() == null ? null : this.innerProperties().daprProperties();
}
/**
* Set the daprProperties property: Indicates some additional properties for dapr client type.
*
* @param daprProperties the daprProperties value to set.
* @return the DaprConfigurationResourceInner object itself.
*/
public DaprConfigurationResourceInner withDaprProperties(DaprProperties daprProperties) {
if (this.innerProperties() == null) {
this.innerProperties = new DaprConfigurationProperties();
}
this.innerProperties().withDaprProperties(daprProperties);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DaprConfigurationResourceInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DaprConfigurationResourceInner 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 DaprConfigurationResourceInner.
*/
public static DaprConfigurationResourceInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DaprConfigurationResourceInner deserializedDaprConfigurationResourceInner
= new DaprConfigurationResourceInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("properties".equals(fieldName)) {
deserializedDaprConfigurationResourceInner.innerProperties
= DaprConfigurationProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedDaprConfigurationResourceInner;
});
}
}