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

com.azure.resourcemanager.logz.models.MonitorProperties 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.logz.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;

/**
 * Properties specific to the monitor resource.
 */
@Fluent
public final class MonitorProperties implements JsonSerializable {
    /*
     * Flag specifying if the resource provisioning state as tracked by ARM.
     */
    private ProvisioningState provisioningState;

    /*
     * Flag specifying if the resource monitoring is enabled or disabled.
     */
    private MonitoringStatus monitoringStatus;

    /*
     * Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource
     * will go in Suspended state.
     */
    private MarketplaceSubscriptionStatus marketplaceSubscriptionStatus;

    /*
     * The logzOrganizationProperties property.
     */
    private LogzOrganizationProperties logzOrganizationProperties;

    /*
     * The userInfo property.
     */
    private UserInfo userInfo;

    /*
     * The planData property.
     */
    private PlanData planData;

    /*
     * The liftrResourceCategory property.
     */
    private LiftrResourceCategories liftrResourceCategory;

    /*
     * The priority of the resource.
     */
    private Integer liftrResourcePreference;

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

    /**
     * Get the provisioningState property: Flag specifying if the resource provisioning state as tracked by ARM.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the monitoringStatus property: Flag specifying if the resource monitoring is enabled or disabled.
     * 
     * @return the monitoringStatus value.
     */
    public MonitoringStatus monitoringStatus() {
        return this.monitoringStatus;
    }

    /**
     * Set the monitoringStatus property: Flag specifying if the resource monitoring is enabled or disabled.
     * 
     * @param monitoringStatus the monitoringStatus value to set.
     * @return the MonitorProperties object itself.
     */
    public MonitorProperties withMonitoringStatus(MonitoringStatus monitoringStatus) {
        this.monitoringStatus = monitoringStatus;
        return this;
    }

    /**
     * Get the marketplaceSubscriptionStatus property: Flag specifying the Marketplace Subscription Status of the
     * resource. If payment is not made in time, the resource will go in Suspended state.
     * 
     * @return the marketplaceSubscriptionStatus value.
     */
    public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() {
        return this.marketplaceSubscriptionStatus;
    }

    /**
     * Set the marketplaceSubscriptionStatus property: Flag specifying the Marketplace Subscription Status of the
     * resource. If payment is not made in time, the resource will go in Suspended state.
     * 
     * @param marketplaceSubscriptionStatus the marketplaceSubscriptionStatus value to set.
     * @return the MonitorProperties object itself.
     */
    public MonitorProperties
        withMarketplaceSubscriptionStatus(MarketplaceSubscriptionStatus marketplaceSubscriptionStatus) {
        this.marketplaceSubscriptionStatus = marketplaceSubscriptionStatus;
        return this;
    }

    /**
     * Get the logzOrganizationProperties property: The logzOrganizationProperties property.
     * 
     * @return the logzOrganizationProperties value.
     */
    public LogzOrganizationProperties logzOrganizationProperties() {
        return this.logzOrganizationProperties;
    }

    /**
     * Set the logzOrganizationProperties property: The logzOrganizationProperties property.
     * 
     * @param logzOrganizationProperties the logzOrganizationProperties value to set.
     * @return the MonitorProperties object itself.
     */
    public MonitorProperties withLogzOrganizationProperties(LogzOrganizationProperties logzOrganizationProperties) {
        this.logzOrganizationProperties = logzOrganizationProperties;
        return this;
    }

    /**
     * Get the userInfo property: The userInfo property.
     * 
     * @return the userInfo value.
     */
    public UserInfo userInfo() {
        return this.userInfo;
    }

    /**
     * Set the userInfo property: The userInfo property.
     * 
     * @param userInfo the userInfo value to set.
     * @return the MonitorProperties object itself.
     */
    public MonitorProperties withUserInfo(UserInfo userInfo) {
        this.userInfo = userInfo;
        return this;
    }

    /**
     * Get the planData property: The planData property.
     * 
     * @return the planData value.
     */
    public PlanData planData() {
        return this.planData;
    }

    /**
     * Set the planData property: The planData property.
     * 
     * @param planData the planData value to set.
     * @return the MonitorProperties object itself.
     */
    public MonitorProperties withPlanData(PlanData planData) {
        this.planData = planData;
        return this;
    }

    /**
     * Get the liftrResourceCategory property: The liftrResourceCategory property.
     * 
     * @return the liftrResourceCategory value.
     */
    public LiftrResourceCategories liftrResourceCategory() {
        return this.liftrResourceCategory;
    }

    /**
     * Get the liftrResourcePreference property: The priority of the resource.
     * 
     * @return the liftrResourcePreference value.
     */
    public Integer liftrResourcePreference() {
        return this.liftrResourcePreference;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (logzOrganizationProperties() != null) {
            logzOrganizationProperties().validate();
        }
        if (userInfo() != null) {
            userInfo().validate();
        }
        if (planData() != null) {
            planData().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("monitoringStatus",
            this.monitoringStatus == null ? null : this.monitoringStatus.toString());
        jsonWriter.writeStringField("marketplaceSubscriptionStatus",
            this.marketplaceSubscriptionStatus == null ? null : this.marketplaceSubscriptionStatus.toString());
        jsonWriter.writeJsonField("logzOrganizationProperties", this.logzOrganizationProperties);
        jsonWriter.writeJsonField("userInfo", this.userInfo);
        jsonWriter.writeJsonField("planData", this.planData);
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningState".equals(fieldName)) {
                    deserializedMonitorProperties.provisioningState = ProvisioningState.fromString(reader.getString());
                } else if ("monitoringStatus".equals(fieldName)) {
                    deserializedMonitorProperties.monitoringStatus = MonitoringStatus.fromString(reader.getString());
                } else if ("marketplaceSubscriptionStatus".equals(fieldName)) {
                    deserializedMonitorProperties.marketplaceSubscriptionStatus
                        = MarketplaceSubscriptionStatus.fromString(reader.getString());
                } else if ("logzOrganizationProperties".equals(fieldName)) {
                    deserializedMonitorProperties.logzOrganizationProperties
                        = LogzOrganizationProperties.fromJson(reader);
                } else if ("userInfo".equals(fieldName)) {
                    deserializedMonitorProperties.userInfo = UserInfo.fromJson(reader);
                } else if ("planData".equals(fieldName)) {
                    deserializedMonitorProperties.planData = PlanData.fromJson(reader);
                } else if ("liftrResourceCategory".equals(fieldName)) {
                    deserializedMonitorProperties.liftrResourceCategory
                        = LiftrResourceCategories.fromString(reader.getString());
                } else if ("liftrResourcePreference".equals(fieldName)) {
                    deserializedMonitorProperties.liftrResourcePreference = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMonitorProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy