All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.servicelinker.fluent.models.DaprConfigurationProperties 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;

/**
 * The DaprConfigurationProperties model.
 */
@Fluent
public final class DaprConfigurationProperties implements JsonSerializable {
    /*
     * Supported target resource type, extract from resource id, uppercase
     */
    private String targetType;

    /*
     * The authentication type.
     */
    private AuthType authType;

    /*
     * Indicates some additional properties for dapr client type
     */
    private DaprProperties daprProperties;

    /**
     * Creates an instance of DaprConfigurationProperties class.
     */
    public DaprConfigurationProperties() {
    }

    /**
     * Get the targetType property: Supported target resource type, extract from resource id, uppercase.
     * 
     * @return the targetType value.
     */
    public String targetType() {
        return this.targetType;
    }

    /**
     * Set the targetType property: Supported target resource type, extract from resource id, uppercase.
     * 
     * @param targetType the targetType value to set.
     * @return the DaprConfigurationProperties object itself.
     */
    public DaprConfigurationProperties withTargetType(String targetType) {
        this.targetType = targetType;
        return this;
    }

    /**
     * Get the authType property: The authentication type.
     * 
     * @return the authType value.
     */
    public AuthType authType() {
        return this.authType;
    }

    /**
     * Set the authType property: The authentication type.
     * 
     * @param authType the authType value to set.
     * @return the DaprConfigurationProperties object itself.
     */
    public DaprConfigurationProperties withAuthType(AuthType authType) {
        this.authType = authType;
        return this;
    }

    /**
     * Get the daprProperties property: Indicates some additional properties for dapr client type.
     * 
     * @return the daprProperties value.
     */
    public DaprProperties daprProperties() {
        return this.daprProperties;
    }

    /**
     * Set the daprProperties property: Indicates some additional properties for dapr client type.
     * 
     * @param daprProperties the daprProperties value to set.
     * @return the DaprConfigurationProperties object itself.
     */
    public DaprConfigurationProperties withDaprProperties(DaprProperties daprProperties) {
        this.daprProperties = daprProperties;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (daprProperties() != null) {
            daprProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("targetType", this.targetType);
        jsonWriter.writeStringField("authType", this.authType == null ? null : this.authType.toString());
        jsonWriter.writeJsonField("daprProperties", this.daprProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of DaprConfigurationProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of DaprConfigurationProperties 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 DaprConfigurationProperties.
     */
    public static DaprConfigurationProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            DaprConfigurationProperties deserializedDaprConfigurationProperties = new DaprConfigurationProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("targetType".equals(fieldName)) {
                    deserializedDaprConfigurationProperties.targetType = reader.getString();
                } else if ("authType".equals(fieldName)) {
                    deserializedDaprConfigurationProperties.authType = AuthType.fromString(reader.getString());
                } else if ("daprProperties".equals(fieldName)) {
                    deserializedDaprConfigurationProperties.daprProperties = DaprProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDaprConfigurationProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy