com.azure.resourcemanager.monitor.models.PerfCounterDataSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-monitor Show documentation
Show all versions of azure-resourcemanager-monitor Show documentation
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;
/**
* Definition of which performance counters will be collected and how they will be collected by this data collection
* rule.
* Collected from both Windows and Linux machines where the counter is present.
*/
@Fluent
public final class PerfCounterDataSource implements JsonSerializable {
/*
* List of streams that this data source will be sent to.
* A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will
* be sent to.
*/
private List streams;
/*
* The number of seconds between consecutive counter measurements (samples).
*/
private Integer samplingFrequencyInSeconds;
/*
* A list of specifier names of the performance counters you want to collect.
* Use a wildcard (*) to collect a counter for all instances.
* To get a list of performance counters on Windows, run the command 'typeperf'.
*/
private List counterSpecifiers;
/*
* A friendly name for the data source.
* This name should be unique across all data sources (regardless of type) within the data collection rule.
*/
private String name;
/**
* Creates an instance of PerfCounterDataSource class.
*/
public PerfCounterDataSource() {
}
/**
* Get the streams property: List of streams that this data source will be sent to.
* A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will
* be sent to.
*
* @return the streams value.
*/
public List streams() {
return this.streams;
}
/**
* Set the streams property: List of streams that this data source will be sent to.
* A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will
* be sent to.
*
* @param streams the streams value to set.
* @return the PerfCounterDataSource object itself.
*/
public PerfCounterDataSource withStreams(List streams) {
this.streams = streams;
return this;
}
/**
* Get the samplingFrequencyInSeconds property: The number of seconds between consecutive counter measurements
* (samples).
*
* @return the samplingFrequencyInSeconds value.
*/
public Integer samplingFrequencyInSeconds() {
return this.samplingFrequencyInSeconds;
}
/**
* Set the samplingFrequencyInSeconds property: The number of seconds between consecutive counter measurements
* (samples).
*
* @param samplingFrequencyInSeconds the samplingFrequencyInSeconds value to set.
* @return the PerfCounterDataSource object itself.
*/
public PerfCounterDataSource withSamplingFrequencyInSeconds(Integer samplingFrequencyInSeconds) {
this.samplingFrequencyInSeconds = samplingFrequencyInSeconds;
return this;
}
/**
* Get the counterSpecifiers property: A list of specifier names of the performance counters you want to collect.
* Use a wildcard (*) to collect a counter for all instances.
* To get a list of performance counters on Windows, run the command 'typeperf'.
*
* @return the counterSpecifiers value.
*/
public List counterSpecifiers() {
return this.counterSpecifiers;
}
/**
* Set the counterSpecifiers property: A list of specifier names of the performance counters you want to collect.
* Use a wildcard (*) to collect a counter for all instances.
* To get a list of performance counters on Windows, run the command 'typeperf'.
*
* @param counterSpecifiers the counterSpecifiers value to set.
* @return the PerfCounterDataSource object itself.
*/
public PerfCounterDataSource withCounterSpecifiers(List counterSpecifiers) {
this.counterSpecifiers = counterSpecifiers;
return this;
}
/**
* Get the name property: A friendly name for the data source.
* This name should be unique across all data sources (regardless of type) within the data collection rule.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: A friendly name for the data source.
* This name should be unique across all data sources (regardless of type) within the data collection rule.
*
* @param name the name value to set.
* @return the PerfCounterDataSource object itself.
*/
public PerfCounterDataSource withName(String name) {
this.name = name;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("streams", this.streams,
(writer, element) -> writer.writeString(element == null ? null : element.toString()));
jsonWriter.writeNumberField("samplingFrequencyInSeconds", this.samplingFrequencyInSeconds);
jsonWriter.writeArrayField("counterSpecifiers", this.counterSpecifiers,
(writer, element) -> writer.writeString(element));
jsonWriter.writeStringField("name", this.name);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of PerfCounterDataSource from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of PerfCounterDataSource 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 PerfCounterDataSource.
*/
public static PerfCounterDataSource fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
PerfCounterDataSource deserializedPerfCounterDataSource = new PerfCounterDataSource();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("streams".equals(fieldName)) {
List streams = reader
.readArray(reader1 -> KnownPerfCounterDataSourceStreams.fromString(reader1.getString()));
deserializedPerfCounterDataSource.streams = streams;
} else if ("samplingFrequencyInSeconds".equals(fieldName)) {
deserializedPerfCounterDataSource.samplingFrequencyInSeconds
= reader.getNullable(JsonReader::getInt);
} else if ("counterSpecifiers".equals(fieldName)) {
List counterSpecifiers = reader.readArray(reader1 -> reader1.getString());
deserializedPerfCounterDataSource.counterSpecifiers = counterSpecifiers;
} else if ("name".equals(fieldName)) {
deserializedPerfCounterDataSource.name = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedPerfCounterDataSource;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy