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

com.azure.resourcemanager.applicationinsights.fluent.models.ApplicationInsightsComponentAnalyticsItemInner 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.applicationinsights.fluent.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.applicationinsights.models.ApplicationInsightsComponentAnalyticsItemProperties;
import com.azure.resourcemanager.applicationinsights.models.ItemScope;
import com.azure.resourcemanager.applicationinsights.models.ItemType;
import java.io.IOException;

/**
 * Properties that define an Analytics item that is associated to an Application Insights component.
 */
@Fluent
public final class ApplicationInsightsComponentAnalyticsItemInner
    implements JsonSerializable {
    /*
     * Internally assigned unique id of the item definition.
     */
    private String id;

    /*
     * The user-defined name of the item.
     */
    private String name;

    /*
     * The content of this item
     */
    private String content;

    /*
     * This instance's version of the data model. This can change as new features are added.
     */
    private String version;

    /*
     * Enum indicating if this item definition is owned by a specific user or is shared between all users with access to
     * the Application Insights component.
     */
    private ItemScope scope;

    /*
     * Enum indicating the type of the Analytics item.
     */
    private ItemType type;

    /*
     * Date and time in UTC when this item was created.
     */
    private String timeCreated;

    /*
     * Date and time in UTC of the last modification that was made to this item.
     */
    private String timeModified;

    /*
     * A set of properties that can be defined in the context of a specific item type. Each type may have its own
     * properties.
     */
    private ApplicationInsightsComponentAnalyticsItemProperties properties;

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

    /**
     * Get the id property: Internally assigned unique id of the item definition.
     * 
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: Internally assigned unique id of the item definition.
     * 
     * @param id the id value to set.
     * @return the ApplicationInsightsComponentAnalyticsItemInner object itself.
     */
    public ApplicationInsightsComponentAnalyticsItemInner withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * Get the name property: The user-defined name of the item.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: The user-defined name of the item.
     * 
     * @param name the name value to set.
     * @return the ApplicationInsightsComponentAnalyticsItemInner object itself.
     */
    public ApplicationInsightsComponentAnalyticsItemInner withName(String name) {
        this.name = name;
        return this;
    }

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

    /**
     * Set the content property: The content of this item.
     * 
     * @param content the content value to set.
     * @return the ApplicationInsightsComponentAnalyticsItemInner object itself.
     */
    public ApplicationInsightsComponentAnalyticsItemInner withContent(String content) {
        this.content = content;
        return this;
    }

    /**
     * Get the version property: This instance's version of the data model. This can change as new features are added.
     * 
     * @return the version value.
     */
    public String version() {
        return this.version;
    }

    /**
     * Get the scope property: Enum indicating if this item definition is owned by a specific user or is shared between
     * all users with access to the Application Insights component.
     * 
     * @return the scope value.
     */
    public ItemScope scope() {
        return this.scope;
    }

    /**
     * Set the scope property: Enum indicating if this item definition is owned by a specific user or is shared between
     * all users with access to the Application Insights component.
     * 
     * @param scope the scope value to set.
     * @return the ApplicationInsightsComponentAnalyticsItemInner object itself.
     */
    public ApplicationInsightsComponentAnalyticsItemInner withScope(ItemScope scope) {
        this.scope = scope;
        return this;
    }

    /**
     * Get the type property: Enum indicating the type of the Analytics item.
     * 
     * @return the type value.
     */
    public ItemType type() {
        return this.type;
    }

    /**
     * Set the type property: Enum indicating the type of the Analytics item.
     * 
     * @param type the type value to set.
     * @return the ApplicationInsightsComponentAnalyticsItemInner object itself.
     */
    public ApplicationInsightsComponentAnalyticsItemInner withType(ItemType type) {
        this.type = type;
        return this;
    }

    /**
     * Get the timeCreated property: Date and time in UTC when this item was created.
     * 
     * @return the timeCreated value.
     */
    public String timeCreated() {
        return this.timeCreated;
    }

    /**
     * Get the timeModified property: Date and time in UTC of the last modification that was made to this item.
     * 
     * @return the timeModified value.
     */
    public String timeModified() {
        return this.timeModified;
    }

    /**
     * Get the properties property: A set of properties that can be defined in the context of a specific item type. Each
     * type may have its own properties.
     * 
     * @return the properties value.
     */
    public ApplicationInsightsComponentAnalyticsItemProperties properties() {
        return this.properties;
    }

    /**
     * Set the properties property: A set of properties that can be defined in the context of a specific item type. Each
     * type may have its own properties.
     * 
     * @param properties the properties value to set.
     * @return the ApplicationInsightsComponentAnalyticsItemInner object itself.
     */
    public ApplicationInsightsComponentAnalyticsItemInner
        withProperties(ApplicationInsightsComponentAnalyticsItemProperties properties) {
        this.properties = properties;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("Id", this.id);
        jsonWriter.writeStringField("Name", this.name);
        jsonWriter.writeStringField("Content", this.content);
        jsonWriter.writeStringField("Scope", this.scope == null ? null : this.scope.toString());
        jsonWriter.writeStringField("Type", this.type == null ? null : this.type.toString());
        jsonWriter.writeJsonField("Properties", this.properties);
        return jsonWriter.writeEndObject();
    }

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

                if ("Id".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.id = reader.getString();
                } else if ("Name".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.name = reader.getString();
                } else if ("Content".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.content = reader.getString();
                } else if ("Version".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.version = reader.getString();
                } else if ("Scope".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.scope
                        = ItemScope.fromString(reader.getString());
                } else if ("Type".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.type
                        = ItemType.fromString(reader.getString());
                } else if ("TimeCreated".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.timeCreated = reader.getString();
                } else if ("TimeModified".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.timeModified = reader.getString();
                } else if ("Properties".equals(fieldName)) {
                    deserializedApplicationInsightsComponentAnalyticsItemInner.properties
                        = ApplicationInsightsComponentAnalyticsItemProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedApplicationInsightsComponentAnalyticsItemInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy