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

com.azure.resourcemanager.frontdoor.fluent.models.TimeseriesInner 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.frontdoor.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.frontdoor.models.AggregationInterval;
import com.azure.resourcemanager.frontdoor.models.TimeseriesDataPoint;
import com.azure.resourcemanager.frontdoor.models.TimeseriesType;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Defines the Timeseries.
 */
@Fluent
public final class TimeseriesInner extends Resource {
    /*
     * The properties of a Timeseries
     */
    private TimeseriesProperties innerProperties;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the innerProperties property: The properties of a Timeseries.
     * 
     * @return the innerProperties value.
     */
    private TimeseriesProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public TimeseriesInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public TimeseriesInner withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the endpoint property: The endpoint associated with the Timeseries data point.
     * 
     * @return the endpoint value.
     */
    public String endpoint() {
        return this.innerProperties() == null ? null : this.innerProperties().endpoint();
    }

    /**
     * Set the endpoint property: The endpoint associated with the Timeseries data point.
     * 
     * @param endpoint the endpoint value to set.
     * @return the TimeseriesInner object itself.
     */
    public TimeseriesInner withEndpoint(String endpoint) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TimeseriesProperties();
        }
        this.innerProperties().withEndpoint(endpoint);
        return this;
    }

    /**
     * Get the startDateTimeUtc property: The start DateTime of the Timeseries in UTC.
     * 
     * @return the startDateTimeUtc value.
     */
    public String startDateTimeUtc() {
        return this.innerProperties() == null ? null : this.innerProperties().startDateTimeUtc();
    }

    /**
     * Set the startDateTimeUtc property: The start DateTime of the Timeseries in UTC.
     * 
     * @param startDateTimeUtc the startDateTimeUtc value to set.
     * @return the TimeseriesInner object itself.
     */
    public TimeseriesInner withStartDateTimeUtc(String startDateTimeUtc) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TimeseriesProperties();
        }
        this.innerProperties().withStartDateTimeUtc(startDateTimeUtc);
        return this;
    }

    /**
     * Get the endDateTimeUtc property: The end DateTime of the Timeseries in UTC.
     * 
     * @return the endDateTimeUtc value.
     */
    public String endDateTimeUtc() {
        return this.innerProperties() == null ? null : this.innerProperties().endDateTimeUtc();
    }

    /**
     * Set the endDateTimeUtc property: The end DateTime of the Timeseries in UTC.
     * 
     * @param endDateTimeUtc the endDateTimeUtc value to set.
     * @return the TimeseriesInner object itself.
     */
    public TimeseriesInner withEndDateTimeUtc(String endDateTimeUtc) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TimeseriesProperties();
        }
        this.innerProperties().withEndDateTimeUtc(endDateTimeUtc);
        return this;
    }

    /**
     * Get the aggregationInterval property: The aggregation interval of the Timeseries.
     * 
     * @return the aggregationInterval value.
     */
    public AggregationInterval aggregationInterval() {
        return this.innerProperties() == null ? null : this.innerProperties().aggregationInterval();
    }

    /**
     * Set the aggregationInterval property: The aggregation interval of the Timeseries.
     * 
     * @param aggregationInterval the aggregationInterval value to set.
     * @return the TimeseriesInner object itself.
     */
    public TimeseriesInner withAggregationInterval(AggregationInterval aggregationInterval) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TimeseriesProperties();
        }
        this.innerProperties().withAggregationInterval(aggregationInterval);
        return this;
    }

    /**
     * Get the timeseriesType property: The type of Timeseries.
     * 
     * @return the timeseriesType value.
     */
    public TimeseriesType timeseriesType() {
        return this.innerProperties() == null ? null : this.innerProperties().timeseriesType();
    }

    /**
     * Set the timeseriesType property: The type of Timeseries.
     * 
     * @param timeseriesType the timeseriesType value to set.
     * @return the TimeseriesInner object itself.
     */
    public TimeseriesInner withTimeseriesType(TimeseriesType timeseriesType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TimeseriesProperties();
        }
        this.innerProperties().withTimeseriesType(timeseriesType);
        return this;
    }

    /**
     * Get the country property: The country associated with the Timeseries. Values are country ISO codes as specified
     * here- https://www.iso.org/iso-3166-country-codes.html.
     * 
     * @return the country value.
     */
    public String country() {
        return this.innerProperties() == null ? null : this.innerProperties().country();
    }

    /**
     * Set the country property: The country associated with the Timeseries. Values are country ISO codes as specified
     * here- https://www.iso.org/iso-3166-country-codes.html.
     * 
     * @param country the country value to set.
     * @return the TimeseriesInner object itself.
     */
    public TimeseriesInner withCountry(String country) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TimeseriesProperties();
        }
        this.innerProperties().withCountry(country);
        return this;
    }

    /**
     * Get the timeseriesData property: The set of data points for the timeseries.
     * 
     * @return the timeseriesData value.
     */
    public List timeseriesData() {
        return this.innerProperties() == null ? null : this.innerProperties().timeseriesData();
    }

    /**
     * Set the timeseriesData property: The set of data points for the timeseries.
     * 
     * @param timeseriesData the timeseriesData value to set.
     * @return the TimeseriesInner object itself.
     */
    public TimeseriesInner withTimeseriesData(List timeseriesData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TimeseriesProperties();
        }
        this.innerProperties().withTimeseriesData(timeseriesData);
        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.writeStringField("location", location());
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of TimeseriesInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of TimeseriesInner if the JsonReader was pointing to an instance of it, or null if it was
     * pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the TimeseriesInner.
     */
    public static TimeseriesInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            TimeseriesInner deserializedTimeseriesInner = new TimeseriesInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedTimeseriesInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedTimeseriesInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedTimeseriesInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedTimeseriesInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedTimeseriesInner.withTags(tags);
                } else if ("properties".equals(fieldName)) {
                    deserializedTimeseriesInner.innerProperties = TimeseriesProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTimeseriesInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy