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

com.azure.resourcemanager.securityinsights.models.Availability Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2022-09.

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.securityinsights.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;

/**
 * Connector Availability Status.
 */
@Fluent
public final class Availability implements JsonSerializable {
    /*
     * The connector Availability Status
     */
    private AvailabilityStatus status;

    /*
     * Set connector as preview
     */
    private Boolean isPreview;

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

    /**
     * Get the status property: The connector Availability Status.
     * 
     * @return the status value.
     */
    public AvailabilityStatus status() {
        return this.status;
    }

    /**
     * Set the status property: The connector Availability Status.
     * 
     * @param status the status value to set.
     * @return the Availability object itself.
     */
    public Availability withStatus(AvailabilityStatus status) {
        this.status = status;
        return this;
    }

    /**
     * Get the isPreview property: Set connector as preview.
     * 
     * @return the isPreview value.
     */
    public Boolean isPreview() {
        return this.isPreview;
    }

    /**
     * Set the isPreview property: Set connector as preview.
     * 
     * @param isPreview the isPreview value to set.
     * @return the Availability object itself.
     */
    public Availability withIsPreview(Boolean isPreview) {
        this.isPreview = isPreview;
        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.writeNumberField("status", this.status == null ? null : this.status.toInt());
        jsonWriter.writeBooleanField("isPreview", this.isPreview);
        return jsonWriter.writeEndObject();
    }

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

                if ("status".equals(fieldName)) {
                    deserializedAvailability.status = AvailabilityStatus.fromInt(reader.getInt());
                } else if ("isPreview".equals(fieldName)) {
                    deserializedAvailability.isPreview = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAvailability;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy