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

com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner 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.newrelicobservability.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource;
import com.azure.resourcemanager.newrelicobservability.models.LiftrResourceCategories;
import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity;
import com.azure.resourcemanager.newrelicobservability.models.MarketplaceSubscriptionStatus;
import com.azure.resourcemanager.newrelicobservability.models.MonitoringStatus;
import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties;
import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource;
import com.azure.resourcemanager.newrelicobservability.models.PlanData;
import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState;
import com.azure.resourcemanager.newrelicobservability.models.UserInfo;
import java.io.IOException;
import java.util.Map;

/**
 * A Monitor Resource by NewRelic.
 */
@Fluent
public final class NewRelicMonitorResourceInner extends Resource {
    /*
     * The resource-specific properties for this resource.
     */
    private MonitorProperties innerProperties = new MonitorProperties();

    /*
     * The managed service identities assigned to this resource.
     */
    private ManagedServiceIdentity identity;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    private SystemData systemData;

    /*
     * 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 NewRelicMonitorResourceInner class.
     */
    public NewRelicMonitorResourceInner() {
    }

    /**
     * Get the innerProperties property: The resource-specific properties for this resource.
     * 
     * @return the innerProperties value.
     */
    private MonitorProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the identity property: The managed service identities assigned to this resource.
     * 
     * @return the identity value.
     */
    public ManagedServiceIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The managed service identities assigned to this resource.
     * 
     * @param identity the identity value to set.
     * @return the NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     * 
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * 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 NewRelicMonitorResourceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

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

    /**
     * Get the provisioningState property: Provisioning State of the resource.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the monitoringStatus property: MonitoringStatus of the resource.
     * 
     * @return the monitoringStatus value.
     */
    public MonitoringStatus monitoringStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().monitoringStatus();
    }

    /**
     * Get the marketplaceSubscriptionStatus property: NewRelic Organization properties of the resource.
     * 
     * @return the marketplaceSubscriptionStatus value.
     */
    public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().marketplaceSubscriptionStatus();
    }

    /**
     * Get the marketplaceSubscriptionId property: Marketplace Subscription Id.
     * 
     * @return the marketplaceSubscriptionId value.
     */
    public String marketplaceSubscriptionId() {
        return this.innerProperties() == null ? null : this.innerProperties().marketplaceSubscriptionId();
    }

    /**
     * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource.
     * 
     * @return the newRelicAccountProperties value.
     */
    public NewRelicAccountProperties newRelicAccountProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().newRelicAccountProperties();
    }

    /**
     * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource.
     * 
     * @param newRelicAccountProperties the newRelicAccountProperties value to set.
     * @return the NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner
        withNewRelicAccountProperties(NewRelicAccountProperties newRelicAccountProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withNewRelicAccountProperties(newRelicAccountProperties);
        return this;
    }

    /**
     * Get the userInfo property: User Info.
     * 
     * @return the userInfo value.
     */
    public UserInfo userInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().userInfo();
    }

    /**
     * Set the userInfo property: User Info.
     * 
     * @param userInfo the userInfo value to set.
     * @return the NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withUserInfo(UserInfo userInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withUserInfo(userInfo);
        return this;
    }

    /**
     * Get the planData property: Plan details.
     * 
     * @return the planData value.
     */
    public PlanData planData() {
        return this.innerProperties() == null ? null : this.innerProperties().planData();
    }

    /**
     * Set the planData property: Plan details.
     * 
     * @param planData the planData value to set.
     * @return the NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withPlanData(PlanData planData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withPlanData(planData);
        return this;
    }

    /**
     * Get the liftrResourceCategory property: Liftr resource category.
     * 
     * @return the liftrResourceCategory value.
     */
    public LiftrResourceCategories liftrResourceCategory() {
        return this.innerProperties() == null ? null : this.innerProperties().liftrResourceCategory();
    }

    /**
     * Get the liftrResourcePreference property: Liftr resource preference. The priority of the resource.
     * 
     * @return the liftrResourcePreference value.
     */
    public Integer liftrResourcePreference() {
        return this.innerProperties() == null ? null : this.innerProperties().liftrResourcePreference();
    }

    /**
     * Get the orgCreationSource property: Source of org creation.
     * 
     * @return the orgCreationSource value.
     */
    public OrgCreationSource orgCreationSource() {
        return this.innerProperties() == null ? null : this.innerProperties().orgCreationSource();
    }

    /**
     * Set the orgCreationSource property: Source of org creation.
     * 
     * @param orgCreationSource the orgCreationSource value to set.
     * @return the NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withOrgCreationSource(OrgCreationSource orgCreationSource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withOrgCreationSource(orgCreationSource);
        return this;
    }

    /**
     * Get the accountCreationSource property: Source of account creation.
     * 
     * @return the accountCreationSource value.
     */
    public AccountCreationSource accountCreationSource() {
        return this.innerProperties() == null ? null : this.innerProperties().accountCreationSource();
    }

    /**
     * Set the accountCreationSource property: Source of account creation.
     * 
     * @param accountCreationSource the accountCreationSource value to set.
     * @return the NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withAccountCreationSource(AccountCreationSource accountCreationSource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withAccountCreationSource(accountCreationSource);
        return this;
    }

    /**
     * Get the subscriptionState property: State of the Azure Subscription containing the monitor resource.
     * 
     * @return the subscriptionState value.
     */
    public String subscriptionState() {
        return this.innerProperties() == null ? null : this.innerProperties().subscriptionState();
    }

    /**
     * Set the subscriptionState property: State of the Azure Subscription containing the monitor resource.
     * 
     * @param subscriptionState the subscriptionState value to set.
     * @return the NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withSubscriptionState(String subscriptionState) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withSubscriptionState(subscriptionState);
        return this;
    }

    /**
     * Get the saaSAzureSubscriptionStatus property: Status of Azure Subscription where Marketplace SaaS is located.
     * 
     * @return the saaSAzureSubscriptionStatus value.
     */
    public String saaSAzureSubscriptionStatus() {
        return this.innerProperties() == null ? null : this.innerProperties().saaSAzureSubscriptionStatus();
    }

    /**
     * Set the saaSAzureSubscriptionStatus property: Status of Azure Subscription where Marketplace SaaS is located.
     * 
     * @param saaSAzureSubscriptionStatus the saaSAzureSubscriptionStatus value to set.
     * @return the NewRelicMonitorResourceInner object itself.
     */
    public NewRelicMonitorResourceInner withSaaSAzureSubscriptionStatus(String saaSAzureSubscriptionStatus) {
        if (this.innerProperties() == null) {
            this.innerProperties = new MonitorProperties();
        }
        this.innerProperties().withSaaSAzureSubscriptionStatus(saaSAzureSubscriptionStatus);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property innerProperties in model NewRelicMonitorResourceInner"));
        } else {
            innerProperties().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(NewRelicMonitorResourceInner.class);

    /**
     * {@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);
        jsonWriter.writeJsonField("identity", this.identity);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedNewRelicMonitorResourceInner.withTags(tags);
                } else if ("properties".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceInner.innerProperties = MonitorProperties.fromJson(reader);
                } else if ("identity".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceInner.identity = ManagedServiceIdentity.fromJson(reader);
                } else if ("systemData".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceInner.systemData = SystemData.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedNewRelicMonitorResourceInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy