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

com.azure.ai.metricsadvisor.implementation.models.AzureCosmosDBDataFeed Maven / Gradle / Ivy

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.ai.metricsadvisor.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.UUID;

/**
 * The AzureCosmosDBDataFeed model.
 */
@Fluent
public final class AzureCosmosDBDataFeed extends DataFeedDetail {
    /*
     * The dataSourceParameter property.
     */
    private AzureCosmosDBParameter dataSourceParameter;

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

    /**
     * Get the dataSourceParameter property: The dataSourceParameter property.
     * 
     * @return the dataSourceParameter value.
     */
    public AzureCosmosDBParameter getDataSourceParameter() {
        return this.dataSourceParameter;
    }

    /**
     * Set the dataSourceParameter property: The dataSourceParameter property.
     * 
     * @param dataSourceParameter the dataSourceParameter value to set.
     * @return the AzureCosmosDBDataFeed object itself.
     */
    public AzureCosmosDBDataFeed setDataSourceParameter(AzureCosmosDBParameter dataSourceParameter) {
        this.dataSourceParameter = dataSourceParameter;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setDataFeedName(String dataFeedName) {
        super.setDataFeedName(dataFeedName);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setDataFeedDescription(String dataFeedDescription) {
        super.setDataFeedDescription(dataFeedDescription);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setGranularityName(Granularity granularityName) {
        super.setGranularityName(granularityName);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setGranularityAmount(Integer granularityAmount) {
        super.setGranularityAmount(granularityAmount);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setMetrics(List metrics) {
        super.setMetrics(metrics);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setDimension(List dimension) {
        super.setDimension(dimension);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setTimestampColumn(String timestampColumn) {
        super.setTimestampColumn(timestampColumn);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setDataStartFrom(OffsetDateTime dataStartFrom) {
        super.setDataStartFrom(dataStartFrom);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setStartOffsetInSeconds(Long startOffsetInSeconds) {
        super.setStartOffsetInSeconds(startOffsetInSeconds);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setMaxConcurrency(Integer maxConcurrency) {
        super.setMaxConcurrency(maxConcurrency);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setMinRetryIntervalInSeconds(Long minRetryIntervalInSeconds) {
        super.setMinRetryIntervalInSeconds(minRetryIntervalInSeconds);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setStopRetryAfterInSeconds(Long stopRetryAfterInSeconds) {
        super.setStopRetryAfterInSeconds(stopRetryAfterInSeconds);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setNeedRollup(NeedRollupEnum needRollup) {
        super.setNeedRollup(needRollup);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setRollUpMethod(RollUpMethod rollUpMethod) {
        super.setRollUpMethod(rollUpMethod);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setRollUpColumns(List rollUpColumns) {
        super.setRollUpColumns(rollUpColumns);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setAllUpIdentification(String allUpIdentification) {
        super.setAllUpIdentification(allUpIdentification);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setFillMissingPointType(FillMissingPointType fillMissingPointType) {
        super.setFillMissingPointType(fillMissingPointType);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setFillMissingPointValue(Double fillMissingPointValue) {
        super.setFillMissingPointValue(fillMissingPointValue);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setViewMode(ViewMode viewMode) {
        super.setViewMode(viewMode);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setAdmins(List admins) {
        super.setAdmins(admins);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setViewers(List viewers) {
        super.setViewers(viewers);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setActionLinkTemplate(String actionLinkTemplate) {
        super.setActionLinkTemplate(actionLinkTemplate);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setAuthenticationType(AuthenticationTypeEnum authenticationType) {
        super.setAuthenticationType(authenticationType);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AzureCosmosDBDataFeed setCredentialId(String credentialId) {
        super.setCredentialId(credentialId);
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("dataSourceType",
            DataSourceType.AZURE_COSMOS_DB == null ? null : DataSourceType.AZURE_COSMOS_DB.toString());
        jsonWriter.writeStringField("dataFeedName", getDataFeedName());
        jsonWriter.writeStringField("granularityName",
            getGranularityName() == null ? null : getGranularityName().toString());
        jsonWriter.writeArrayField("metrics", getMetrics(), (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("dataStartFrom",
            getDataStartFrom() == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(getDataStartFrom()));
        jsonWriter.writeStringField("dataFeedDescription", getDataFeedDescription());
        jsonWriter.writeNumberField("granularityAmount", getGranularityAmount());
        jsonWriter.writeArrayField("dimension", getDimension(), (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("timestampColumn", getTimestampColumn());
        jsonWriter.writeNumberField("startOffsetInSeconds", getStartOffsetInSeconds());
        jsonWriter.writeNumberField("maxConcurrency", getMaxConcurrency());
        jsonWriter.writeNumberField("minRetryIntervalInSeconds", getMinRetryIntervalInSeconds());
        jsonWriter.writeNumberField("stopRetryAfterInSeconds", getStopRetryAfterInSeconds());
        jsonWriter.writeStringField("needRollup", getNeedRollup() == null ? null : getNeedRollup().toString());
        jsonWriter.writeStringField("rollUpMethod", getRollUpMethod() == null ? null : getRollUpMethod().toString());
        jsonWriter.writeArrayField("rollUpColumns", getRollUpColumns(),
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("allUpIdentification", getAllUpIdentification());
        jsonWriter.writeStringField("fillMissingPointType",
            getFillMissingPointType() == null ? null : getFillMissingPointType().toString());
        jsonWriter.writeNumberField("fillMissingPointValue", getFillMissingPointValue());
        jsonWriter.writeStringField("viewMode", getViewMode() == null ? null : getViewMode().toString());
        jsonWriter.writeArrayField("admins", getAdmins(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("viewers", getViewers(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("actionLinkTemplate", getActionLinkTemplate());
        jsonWriter.writeStringField("authenticationType",
            getAuthenticationType() == null ? null : getAuthenticationType().toString());
        jsonWriter.writeStringField("credentialId", getCredentialId());
        jsonWriter.writeJsonField("dataSourceParameter", this.dataSourceParameter);
        return jsonWriter.writeEndObject();
    }

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

                if ("dataSourceType".equals(fieldName)) {
                    String dataSourceType = reader.getString();
                    if (!"AzureCosmosDB".equals(dataSourceType)) {
                        throw new IllegalStateException(
                            "'dataSourceType' was expected to be non-null and equal to 'AzureCosmosDB'. The found 'dataSourceType' was '"
                                + dataSourceType + "'.");
                    }
                } else if ("dataFeedName".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setDataFeedName(reader.getString());
                } else if ("granularityName".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setGranularityName(Granularity.fromString(reader.getString()));
                } else if ("metrics".equals(fieldName)) {
                    List metrics = reader.readArray(reader1 -> DataFeedMetric.fromJson(reader1));
                    deserializedAzureCosmosDBDataFeed.setMetrics(metrics);
                } else if ("dataStartFrom".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setDataStartFrom(
                        reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString())));
                } else if ("dataFeedId".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed
                        .setDataFeedId(reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())));
                } else if ("dataFeedDescription".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setDataFeedDescription(reader.getString());
                } else if ("granularityAmount".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setGranularityAmount(reader.getNullable(JsonReader::getInt));
                } else if ("dimension".equals(fieldName)) {
                    List dimension
                        = reader.readArray(reader1 -> DataFeedDimension.fromJson(reader1));
                    deserializedAzureCosmosDBDataFeed.setDimension(dimension);
                } else if ("timestampColumn".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setTimestampColumn(reader.getString());
                } else if ("startOffsetInSeconds".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setStartOffsetInSeconds(reader.getNullable(JsonReader::getLong));
                } else if ("maxConcurrency".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setMaxConcurrency(reader.getNullable(JsonReader::getInt));
                } else if ("minRetryIntervalInSeconds".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed
                        .setMinRetryIntervalInSeconds(reader.getNullable(JsonReader::getLong));
                } else if ("stopRetryAfterInSeconds".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed
                        .setStopRetryAfterInSeconds(reader.getNullable(JsonReader::getLong));
                } else if ("needRollup".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setNeedRollup(NeedRollupEnum.fromString(reader.getString()));
                } else if ("rollUpMethod".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setRollUpMethod(RollUpMethod.fromString(reader.getString()));
                } else if ("rollUpColumns".equals(fieldName)) {
                    List rollUpColumns = reader.readArray(reader1 -> reader1.getString());
                    deserializedAzureCosmosDBDataFeed.setRollUpColumns(rollUpColumns);
                } else if ("allUpIdentification".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setAllUpIdentification(reader.getString());
                } else if ("fillMissingPointType".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed
                        .setFillMissingPointType(FillMissingPointType.fromString(reader.getString()));
                } else if ("fillMissingPointValue".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed
                        .setFillMissingPointValue(reader.getNullable(JsonReader::getDouble));
                } else if ("viewMode".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setViewMode(ViewMode.fromString(reader.getString()));
                } else if ("admins".equals(fieldName)) {
                    List admins = reader.readArray(reader1 -> reader1.getString());
                    deserializedAzureCosmosDBDataFeed.setAdmins(admins);
                } else if ("viewers".equals(fieldName)) {
                    List viewers = reader.readArray(reader1 -> reader1.getString());
                    deserializedAzureCosmosDBDataFeed.setViewers(viewers);
                } else if ("isAdmin".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setIsAdmin(reader.getNullable(JsonReader::getBoolean));
                } else if ("creator".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setCreator(reader.getString());
                } else if ("status".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setStatus(EntityStatus.fromString(reader.getString()));
                } else if ("createdTime".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setCreatedTime(
                        reader.getNullable(nonNullReader -> OffsetDateTime.parse(nonNullReader.getString())));
                } else if ("actionLinkTemplate".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setActionLinkTemplate(reader.getString());
                } else if ("authenticationType".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed
                        .setAuthenticationType(AuthenticationTypeEnum.fromString(reader.getString()));
                } else if ("credentialId".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.setCredentialId(reader.getString());
                } else if ("dataSourceParameter".equals(fieldName)) {
                    deserializedAzureCosmosDBDataFeed.dataSourceParameter = AzureCosmosDBParameter.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAzureCosmosDBDataFeed;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy