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

com.azure.resourcemanager.azurestackhci.fluent.models.UpdateSummariesProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. Package tag package-2024-04.

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.azurestackhci.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.azurestackhci.models.HealthState;
import com.azure.resourcemanager.azurestackhci.models.PackageVersionInfo;
import com.azure.resourcemanager.azurestackhci.models.PrecheckResult;
import com.azure.resourcemanager.azurestackhci.models.ProvisioningState;
import com.azure.resourcemanager.azurestackhci.models.UpdateSummariesPropertiesState;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * Properties of Update summaries.
 */
@Fluent
public final class UpdateSummariesProperties implements JsonSerializable {
    /*
     * Provisioning state of the UpdateSummaries proxy resource.
     */
    private ProvisioningState provisioningState;

    /*
     * OEM family name.
     */
    private String oemFamily;

    /*
     * Current OEM Version.
     */
    private String currentOemVersion;

    /*
     * Name of the hardware model.
     */
    private String hardwareModel;

    /*
     * Current version of each updatable component.
     */
    private List packageVersions;

    /*
     * Current Solution Bundle version of the stamp.
     */
    private String currentVersion;

    /*
     * Current Sbe version of the stamp.
     */
    private String currentSbeVersion;

    /*
     * Last time an update installation completed successfully.
     */
    private OffsetDateTime lastUpdated;

    /*
     * Last time the update service successfully checked for updates
     */
    private OffsetDateTime lastChecked;

    /*
     * Overall health state for update-specific health checks.
     */
    private HealthState healthState;

    /*
     * An array of pre-check result objects.
     */
    private List healthCheckResult;

    /*
     * Last time the package-specific checks were run.
     */
    private OffsetDateTime healthCheckDate;

    /*
     * Overall update state of the stamp.
     */
    private UpdateSummariesPropertiesState state;

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

    /**
     * Get the provisioningState property: Provisioning state of the UpdateSummaries proxy resource.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the oemFamily property: OEM family name.
     * 
     * @return the oemFamily value.
     */
    public String oemFamily() {
        return this.oemFamily;
    }

    /**
     * Set the oemFamily property: OEM family name.
     * 
     * @param oemFamily the oemFamily value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withOemFamily(String oemFamily) {
        this.oemFamily = oemFamily;
        return this;
    }

    /**
     * Get the currentOemVersion property: Current OEM Version.
     * 
     * @return the currentOemVersion value.
     */
    public String currentOemVersion() {
        return this.currentOemVersion;
    }

    /**
     * Set the currentOemVersion property: Current OEM Version.
     * 
     * @param currentOemVersion the currentOemVersion value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withCurrentOemVersion(String currentOemVersion) {
        this.currentOemVersion = currentOemVersion;
        return this;
    }

    /**
     * Get the hardwareModel property: Name of the hardware model.
     * 
     * @return the hardwareModel value.
     */
    public String hardwareModel() {
        return this.hardwareModel;
    }

    /**
     * Set the hardwareModel property: Name of the hardware model.
     * 
     * @param hardwareModel the hardwareModel value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withHardwareModel(String hardwareModel) {
        this.hardwareModel = hardwareModel;
        return this;
    }

    /**
     * Get the packageVersions property: Current version of each updatable component.
     * 
     * @return the packageVersions value.
     */
    public List packageVersions() {
        return this.packageVersions;
    }

    /**
     * Set the packageVersions property: Current version of each updatable component.
     * 
     * @param packageVersions the packageVersions value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withPackageVersions(List packageVersions) {
        this.packageVersions = packageVersions;
        return this;
    }

    /**
     * Get the currentVersion property: Current Solution Bundle version of the stamp.
     * 
     * @return the currentVersion value.
     */
    public String currentVersion() {
        return this.currentVersion;
    }

    /**
     * Set the currentVersion property: Current Solution Bundle version of the stamp.
     * 
     * @param currentVersion the currentVersion value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withCurrentVersion(String currentVersion) {
        this.currentVersion = currentVersion;
        return this;
    }

    /**
     * Get the currentSbeVersion property: Current Sbe version of the stamp.
     * 
     * @return the currentSbeVersion value.
     */
    public String currentSbeVersion() {
        return this.currentSbeVersion;
    }

    /**
     * Set the currentSbeVersion property: Current Sbe version of the stamp.
     * 
     * @param currentSbeVersion the currentSbeVersion value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withCurrentSbeVersion(String currentSbeVersion) {
        this.currentSbeVersion = currentSbeVersion;
        return this;
    }

    /**
     * Get the lastUpdated property: Last time an update installation completed successfully.
     * 
     * @return the lastUpdated value.
     */
    public OffsetDateTime lastUpdated() {
        return this.lastUpdated;
    }

    /**
     * Set the lastUpdated property: Last time an update installation completed successfully.
     * 
     * @param lastUpdated the lastUpdated value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withLastUpdated(OffsetDateTime lastUpdated) {
        this.lastUpdated = lastUpdated;
        return this;
    }

    /**
     * Get the lastChecked property: Last time the update service successfully checked for updates.
     * 
     * @return the lastChecked value.
     */
    public OffsetDateTime lastChecked() {
        return this.lastChecked;
    }

    /**
     * Set the lastChecked property: Last time the update service successfully checked for updates.
     * 
     * @param lastChecked the lastChecked value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withLastChecked(OffsetDateTime lastChecked) {
        this.lastChecked = lastChecked;
        return this;
    }

    /**
     * Get the healthState property: Overall health state for update-specific health checks.
     * 
     * @return the healthState value.
     */
    public HealthState healthState() {
        return this.healthState;
    }

    /**
     * Set the healthState property: Overall health state for update-specific health checks.
     * 
     * @param healthState the healthState value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withHealthState(HealthState healthState) {
        this.healthState = healthState;
        return this;
    }

    /**
     * Get the healthCheckResult property: An array of pre-check result objects.
     * 
     * @return the healthCheckResult value.
     */
    public List healthCheckResult() {
        return this.healthCheckResult;
    }

    /**
     * Set the healthCheckResult property: An array of pre-check result objects.
     * 
     * @param healthCheckResult the healthCheckResult value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withHealthCheckResult(List healthCheckResult) {
        this.healthCheckResult = healthCheckResult;
        return this;
    }

    /**
     * Get the healthCheckDate property: Last time the package-specific checks were run.
     * 
     * @return the healthCheckDate value.
     */
    public OffsetDateTime healthCheckDate() {
        return this.healthCheckDate;
    }

    /**
     * Set the healthCheckDate property: Last time the package-specific checks were run.
     * 
     * @param healthCheckDate the healthCheckDate value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withHealthCheckDate(OffsetDateTime healthCheckDate) {
        this.healthCheckDate = healthCheckDate;
        return this;
    }

    /**
     * Get the state property: Overall update state of the stamp.
     * 
     * @return the state value.
     */
    public UpdateSummariesPropertiesState state() {
        return this.state;
    }

    /**
     * Set the state property: Overall update state of the stamp.
     * 
     * @param state the state value to set.
     * @return the UpdateSummariesProperties object itself.
     */
    public UpdateSummariesProperties withState(UpdateSummariesPropertiesState state) {
        this.state = state;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (packageVersions() != null) {
            packageVersions().forEach(e -> e.validate());
        }
        if (healthCheckResult() != null) {
            healthCheckResult().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("oemFamily", this.oemFamily);
        jsonWriter.writeStringField("currentOemVersion", this.currentOemVersion);
        jsonWriter.writeStringField("hardwareModel", this.hardwareModel);
        jsonWriter.writeArrayField("packageVersions", this.packageVersions,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("currentVersion", this.currentVersion);
        jsonWriter.writeStringField("currentSbeVersion", this.currentSbeVersion);
        jsonWriter.writeStringField("lastUpdated",
            this.lastUpdated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdated));
        jsonWriter.writeStringField("lastChecked",
            this.lastChecked == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastChecked));
        jsonWriter.writeStringField("healthState", this.healthState == null ? null : this.healthState.toString());
        jsonWriter.writeArrayField("healthCheckResult", this.healthCheckResult,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("healthCheckDate",
            this.healthCheckDate == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.healthCheckDate));
        jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningState".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("oemFamily".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.oemFamily = reader.getString();
                } else if ("currentOemVersion".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.currentOemVersion = reader.getString();
                } else if ("hardwareModel".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.hardwareModel = reader.getString();
                } else if ("packageVersions".equals(fieldName)) {
                    List packageVersions
                        = reader.readArray(reader1 -> PackageVersionInfo.fromJson(reader1));
                    deserializedUpdateSummariesProperties.packageVersions = packageVersions;
                } else if ("currentVersion".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.currentVersion = reader.getString();
                } else if ("currentSbeVersion".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.currentSbeVersion = reader.getString();
                } else if ("lastUpdated".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.lastUpdated = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("lastChecked".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.lastChecked = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("healthState".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.healthState = HealthState.fromString(reader.getString());
                } else if ("healthCheckResult".equals(fieldName)) {
                    List healthCheckResult
                        = reader.readArray(reader1 -> PrecheckResult.fromJson(reader1));
                    deserializedUpdateSummariesProperties.healthCheckResult = healthCheckResult;
                } else if ("healthCheckDate".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.healthCheckDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("state".equals(fieldName)) {
                    deserializedUpdateSummariesProperties.state
                        = UpdateSummariesPropertiesState.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedUpdateSummariesProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy