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

com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceUpdate 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.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 com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceUpdateProperties;
import java.io.IOException;
import java.util.Map;

/**
 * The type used for update operations of the NewRelicMonitorResource.
 */
@Fluent
public final class NewRelicMonitorResourceUpdate implements JsonSerializable {
    /*
     * The managed service identities assigned to this resource.
     */
    private ManagedServiceIdentity identity;

    /*
     * Resource tags.
     */
    private Map tags;

    /*
     * The updatable properties of the NewRelicMonitorResource.
     */
    private NewRelicMonitorResourceUpdateProperties innerProperties;

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

    /**
     * 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 NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withIdentity(ManagedServiceIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the tags property: Resource tags.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Resource tags.
     * 
     * @param tags the tags value to set.
     * @return the NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the innerProperties property: The updatable properties of the NewRelicMonitorResource.
     * 
     * @return the innerProperties value.
     */
    private NewRelicMonitorResourceUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * 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 NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate
        withNewRelicAccountProperties(NewRelicAccountProperties newRelicAccountProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        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 NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withUserInfo(UserInfo userInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        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 NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withPlanData(PlanData planData) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        this.innerProperties().withPlanData(planData);
        return this;
    }

    /**
     * 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 NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withOrgCreationSource(OrgCreationSource orgCreationSource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        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 NewRelicMonitorResourceUpdate object itself.
     */
    public NewRelicMonitorResourceUpdate withAccountCreationSource(AccountCreationSource accountCreationSource) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NewRelicMonitorResourceUpdateProperties();
        }
        this.innerProperties().withAccountCreationSource(accountCreationSource);
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("identity", this.identity);
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("identity".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceUpdate.identity = ManagedServiceIdentity.fromJson(reader);
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedNewRelicMonitorResourceUpdate.tags = tags;
                } else if ("properties".equals(fieldName)) {
                    deserializedNewRelicMonitorResourceUpdate.innerProperties
                        = NewRelicMonitorResourceUpdateProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedNewRelicMonitorResourceUpdate;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy