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

com.azure.resourcemanager.monitor.models.DataSourcesSpec Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Monitor SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.monitor.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;
import java.util.List;

/**
 * Specification of data sources that will be collected.
 */
@Fluent
public class DataSourcesSpec implements JsonSerializable {
    /*
     * The list of performance counter data source configurations.
     */
    private List performanceCounters;

    /*
     * The list of Windows Event Log data source configurations.
     */
    private List windowsEventLogs;

    /*
     * The list of Syslog data source configurations.
     */
    private List syslog;

    /*
     * The list of Azure VM extension data source configurations.
     */
    private List extensions;

    /*
     * The list of Log files source configurations.
     */
    private List logFiles;

    /*
     * The list of IIS logs source configurations.
     */
    private List iisLogs;

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

    /**
     * Get the performanceCounters property: The list of performance counter data source configurations.
     * 
     * @return the performanceCounters value.
     */
    public List performanceCounters() {
        return this.performanceCounters;
    }

    /**
     * Set the performanceCounters property: The list of performance counter data source configurations.
     * 
     * @param performanceCounters the performanceCounters value to set.
     * @return the DataSourcesSpec object itself.
     */
    public DataSourcesSpec withPerformanceCounters(List performanceCounters) {
        this.performanceCounters = performanceCounters;
        return this;
    }

    /**
     * Get the windowsEventLogs property: The list of Windows Event Log data source configurations.
     * 
     * @return the windowsEventLogs value.
     */
    public List windowsEventLogs() {
        return this.windowsEventLogs;
    }

    /**
     * Set the windowsEventLogs property: The list of Windows Event Log data source configurations.
     * 
     * @param windowsEventLogs the windowsEventLogs value to set.
     * @return the DataSourcesSpec object itself.
     */
    public DataSourcesSpec withWindowsEventLogs(List windowsEventLogs) {
        this.windowsEventLogs = windowsEventLogs;
        return this;
    }

    /**
     * Get the syslog property: The list of Syslog data source configurations.
     * 
     * @return the syslog value.
     */
    public List syslog() {
        return this.syslog;
    }

    /**
     * Set the syslog property: The list of Syslog data source configurations.
     * 
     * @param syslog the syslog value to set.
     * @return the DataSourcesSpec object itself.
     */
    public DataSourcesSpec withSyslog(List syslog) {
        this.syslog = syslog;
        return this;
    }

    /**
     * Get the extensions property: The list of Azure VM extension data source configurations.
     * 
     * @return the extensions value.
     */
    public List extensions() {
        return this.extensions;
    }

    /**
     * Set the extensions property: The list of Azure VM extension data source configurations.
     * 
     * @param extensions the extensions value to set.
     * @return the DataSourcesSpec object itself.
     */
    public DataSourcesSpec withExtensions(List extensions) {
        this.extensions = extensions;
        return this;
    }

    /**
     * Get the logFiles property: The list of Log files source configurations.
     * 
     * @return the logFiles value.
     */
    public List logFiles() {
        return this.logFiles;
    }

    /**
     * Set the logFiles property: The list of Log files source configurations.
     * 
     * @param logFiles the logFiles value to set.
     * @return the DataSourcesSpec object itself.
     */
    public DataSourcesSpec withLogFiles(List logFiles) {
        this.logFiles = logFiles;
        return this;
    }

    /**
     * Get the iisLogs property: The list of IIS logs source configurations.
     * 
     * @return the iisLogs value.
     */
    public List iisLogs() {
        return this.iisLogs;
    }

    /**
     * Set the iisLogs property: The list of IIS logs source configurations.
     * 
     * @param iisLogs the iisLogs value to set.
     * @return the DataSourcesSpec object itself.
     */
    public DataSourcesSpec withIisLogs(List iisLogs) {
        this.iisLogs = iisLogs;
        return this;
    }

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

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

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

                if ("performanceCounters".equals(fieldName)) {
                    List performanceCounters
                        = reader.readArray(reader1 -> PerfCounterDataSource.fromJson(reader1));
                    deserializedDataSourcesSpec.performanceCounters = performanceCounters;
                } else if ("windowsEventLogs".equals(fieldName)) {
                    List windowsEventLogs
                        = reader.readArray(reader1 -> WindowsEventLogDataSource.fromJson(reader1));
                    deserializedDataSourcesSpec.windowsEventLogs = windowsEventLogs;
                } else if ("syslog".equals(fieldName)) {
                    List syslog = reader.readArray(reader1 -> SyslogDataSource.fromJson(reader1));
                    deserializedDataSourcesSpec.syslog = syslog;
                } else if ("extensions".equals(fieldName)) {
                    List extensions
                        = reader.readArray(reader1 -> ExtensionDataSource.fromJson(reader1));
                    deserializedDataSourcesSpec.extensions = extensions;
                } else if ("logFiles".equals(fieldName)) {
                    List logFiles
                        = reader.readArray(reader1 -> LogFilesDataSource.fromJson(reader1));
                    deserializedDataSourcesSpec.logFiles = logFiles;
                } else if ("iisLogs".equals(fieldName)) {
                    List iisLogs = reader.readArray(reader1 -> IisLogsDataSource.fromJson(reader1));
                    deserializedDataSourcesSpec.iisLogs = iisLogs;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDataSourcesSpec;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy