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

com.azure.resourcemanager.newrelicobservability.models.AccountInfo Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for NewRelicObservability Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-01-01.

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.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 java.io.IOException;

/**
 * Account Info of the NewRelic account.
 */
@Fluent
public final class AccountInfo implements JsonSerializable {
    /*
     * Account id
     */
    private String accountId;

    /*
     * ingestion key of account
     */
    private String ingestionKey;

    /*
     * Region where New Relic account is present
     */
    private String region;

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

    /**
     * Get the accountId property: Account id.
     * 
     * @return the accountId value.
     */
    public String accountId() {
        return this.accountId;
    }

    /**
     * Set the accountId property: Account id.
     * 
     * @param accountId the accountId value to set.
     * @return the AccountInfo object itself.
     */
    public AccountInfo withAccountId(String accountId) {
        this.accountId = accountId;
        return this;
    }

    /**
     * Get the ingestionKey property: ingestion key of account.
     * 
     * @return the ingestionKey value.
     */
    public String ingestionKey() {
        return this.ingestionKey;
    }

    /**
     * Set the ingestionKey property: ingestion key of account.
     * 
     * @param ingestionKey the ingestionKey value to set.
     * @return the AccountInfo object itself.
     */
    public AccountInfo withIngestionKey(String ingestionKey) {
        this.ingestionKey = ingestionKey;
        return this;
    }

    /**
     * Get the region property: Region where New Relic account is present.
     * 
     * @return the region value.
     */
    public String region() {
        return this.region;
    }

    /**
     * Set the region property: Region where New Relic account is present.
     * 
     * @param region the region value to set.
     * @return the AccountInfo object itself.
     */
    public AccountInfo withRegion(String region) {
        this.region = region;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("accountId", this.accountId);
        jsonWriter.writeStringField("ingestionKey", this.ingestionKey);
        jsonWriter.writeStringField("region", this.region);
        return jsonWriter.writeEndObject();
    }

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

                if ("accountId".equals(fieldName)) {
                    deserializedAccountInfo.accountId = reader.getString();
                } else if ("ingestionKey".equals(fieldName)) {
                    deserializedAccountInfo.ingestionKey = reader.getString();
                } else if ("region".equals(fieldName)) {
                    deserializedAccountInfo.region = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAccountInfo;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy