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

com.azure.resourcemanager.servicelinker.fluent.models.ConfigurationResultInner 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.SourceConfiguration;
import java.io.IOException;
import java.util.List;

/**
 * Configurations for source resource, include appSettings, connectionString and serviceBindings.
 */
@Fluent
public final class ConfigurationResultInner implements JsonSerializable {
    /*
     * The configuration properties for source resource.
     */
    private List configurations;

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

    /**
     * Get the configurations property: The configuration properties for source resource.
     * 
     * @return the configurations value.
     */
    public List configurations() {
        return this.configurations;
    }

    /**
     * Set the configurations property: The configuration properties for source resource.
     * 
     * @param configurations the configurations value to set.
     * @return the ConfigurationResultInner object itself.
     */
    public ConfigurationResultInner withConfigurations(List configurations) {
        this.configurations = configurations;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("configurations", this.configurations,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("configurations".equals(fieldName)) {
                    List configurations
                        = reader.readArray(reader1 -> SourceConfiguration.fromJson(reader1));
                    deserializedConfigurationResultInner.configurations = configurations;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedConfigurationResultInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy