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

com.azure.resourcemanager.hybridcompute.models.ServiceStatuses Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.

There is a newer version: 1.1.0-beta.1
Show 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.hybridcompute.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;

/**
 * Reports the state and behavior of dependent services.
 */
@Fluent
public final class ServiceStatuses implements JsonSerializable {
    /*
     * The state of the extension service on the Arc-enabled machine.
     */
    private ServiceStatus extensionService;

    /*
     * The state of the guest configuration service on the Arc-enabled machine.
     */
    private ServiceStatus guestConfigurationService;

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

    /**
     * Get the extensionService property: The state of the extension service on the Arc-enabled machine.
     * 
     * @return the extensionService value.
     */
    public ServiceStatus extensionService() {
        return this.extensionService;
    }

    /**
     * Set the extensionService property: The state of the extension service on the Arc-enabled machine.
     * 
     * @param extensionService the extensionService value to set.
     * @return the ServiceStatuses object itself.
     */
    public ServiceStatuses withExtensionService(ServiceStatus extensionService) {
        this.extensionService = extensionService;
        return this;
    }

    /**
     * Get the guestConfigurationService property: The state of the guest configuration service on the Arc-enabled
     * machine.
     * 
     * @return the guestConfigurationService value.
     */
    public ServiceStatus guestConfigurationService() {
        return this.guestConfigurationService;
    }

    /**
     * Set the guestConfigurationService property: The state of the guest configuration service on the Arc-enabled
     * machine.
     * 
     * @param guestConfigurationService the guestConfigurationService value to set.
     * @return the ServiceStatuses object itself.
     */
    public ServiceStatuses withGuestConfigurationService(ServiceStatus guestConfigurationService) {
        this.guestConfigurationService = guestConfigurationService;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("extensionService", this.extensionService);
        jsonWriter.writeJsonField("guestConfigurationService", this.guestConfigurationService);
        return jsonWriter.writeEndObject();
    }

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

                if ("extensionService".equals(fieldName)) {
                    deserializedServiceStatuses.extensionService = ServiceStatus.fromJson(reader);
                } else if ("guestConfigurationService".equals(fieldName)) {
                    deserializedServiceStatuses.guestConfigurationService = ServiceStatus.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedServiceStatuses;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy