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

com.azure.resourcemanager.azurestackhci.fluent.models.UpdateRunInner 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.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.azurestackhci.models.ProvisioningState;
import com.azure.resourcemanager.azurestackhci.models.UpdateRunPropertiesState;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * Details of an Update run.
 */
@Fluent
public final class UpdateRunInner extends ProxyResource {
    /*
     * The geo-location where the resource lives
     */
    private String location;

    /*
     * Describes Update Run Properties.
     */
    private UpdateRunProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    private SystemData systemData;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * The type of the resource.
     */
    private String type;

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

    /**
     * Get the location property: The geo-location where the resource lives.
     * 
     * @return the location value.
     */
    public String location() {
        return this.location;
    }

    /**
     * Set the location property: The geo-location where the resource lives.
     * 
     * @param location the location value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withLocation(String location) {
        this.location = location;
        return this;
    }

    /**
     * Get the innerProperties property: Describes Update Run Properties.
     * 
     * @return the innerProperties value.
     */
    private UpdateRunProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     * 
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

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

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

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

    /**
     * Get the timeStarted property: Timestamp of the update run was started.
     * 
     * @return the timeStarted value.
     */
    public OffsetDateTime timeStarted() {
        return this.innerProperties() == null ? null : this.innerProperties().timeStarted();
    }

    /**
     * Set the timeStarted property: Timestamp of the update run was started.
     * 
     * @param timeStarted the timeStarted value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withTimeStarted(OffsetDateTime timeStarted) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withTimeStarted(timeStarted);
        return this;
    }

    /**
     * Get the lastUpdatedTime property: Timestamp of the most recently completed step in the update run.
     * 
     * @return the lastUpdatedTime value.
     */
    public OffsetDateTime lastUpdatedTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTime();
    }

    /**
     * Set the lastUpdatedTime property: Timestamp of the most recently completed step in the update run.
     * 
     * @param lastUpdatedTime the lastUpdatedTime value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withLastUpdatedTime(OffsetDateTime lastUpdatedTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withLastUpdatedTime(lastUpdatedTime);
        return this;
    }

    /**
     * Get the duration property: Duration of the update run.
     * 
     * @return the duration value.
     */
    public String duration() {
        return this.innerProperties() == null ? null : this.innerProperties().duration();
    }

    /**
     * Set the duration property: Duration of the update run.
     * 
     * @param duration the duration value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withDuration(String duration) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withDuration(duration);
        return this;
    }

    /**
     * Get the state property: State of the update run.
     * 
     * @return the state value.
     */
    public UpdateRunPropertiesState state() {
        return this.innerProperties() == null ? null : this.innerProperties().state();
    }

    /**
     * Set the state property: State of the update run.
     * 
     * @param state the state value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withState(UpdateRunPropertiesState state) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withState(state);
        return this;
    }

    /**
     * Get the name property: Name of the step.
     * 
     * @return the name value.
     */
    public String namePropertiesName() {
        return this.innerProperties() == null ? null : this.innerProperties().name();
    }

    /**
     * Set the name property: Name of the step.
     * 
     * @param name the name value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withNamePropertiesName(String name) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withName(name);
        return this;
    }

    /**
     * Get the description property: More detailed description of the step.
     * 
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: More detailed description of the step.
     * 
     * @param description the description value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the errorMessage property: Error message, specified if the step is in a failed state.
     * 
     * @return the errorMessage value.
     */
    public String errorMessage() {
        return this.innerProperties() == null ? null : this.innerProperties().errorMessage();
    }

    /**
     * Set the errorMessage property: Error message, specified if the step is in a failed state.
     * 
     * @param errorMessage the errorMessage value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withErrorMessage(String errorMessage) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withErrorMessage(errorMessage);
        return this;
    }

    /**
     * Get the status property: Status of the step, bubbled up from the ECE action plan for installation attempts.
     * Values are: 'Success', 'Error', 'InProgress', and 'Unknown status'.
     * 
     * @return the status value.
     */
    public String status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Set the status property: Status of the step, bubbled up from the ECE action plan for installation attempts.
     * Values are: 'Success', 'Error', 'InProgress', and 'Unknown status'.
     * 
     * @param status the status value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withStatus(String status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

    /**
     * Get the startTimeUtc property: When the step started, or empty if it has not started executing.
     * 
     * @return the startTimeUtc value.
     */
    public OffsetDateTime startTimeUtc() {
        return this.innerProperties() == null ? null : this.innerProperties().startTimeUtc();
    }

    /**
     * Set the startTimeUtc property: When the step started, or empty if it has not started executing.
     * 
     * @param startTimeUtc the startTimeUtc value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withStartTimeUtc(OffsetDateTime startTimeUtc) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withStartTimeUtc(startTimeUtc);
        return this;
    }

    /**
     * Get the endTimeUtc property: When the step reached a terminal state.
     * 
     * @return the endTimeUtc value.
     */
    public OffsetDateTime endTimeUtc() {
        return this.innerProperties() == null ? null : this.innerProperties().endTimeUtc();
    }

    /**
     * Set the endTimeUtc property: When the step reached a terminal state.
     * 
     * @param endTimeUtc the endTimeUtc value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withEndTimeUtc(OffsetDateTime endTimeUtc) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withEndTimeUtc(endTimeUtc);
        return this;
    }

    /**
     * Get the lastUpdatedTimeUtc property: Completion time of this step or the last completed sub-step.
     * 
     * @return the lastUpdatedTimeUtc value.
     */
    public OffsetDateTime lastUpdatedTimeUtc() {
        return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTimeUtc();
    }

    /**
     * Set the lastUpdatedTimeUtc property: Completion time of this step or the last completed sub-step.
     * 
     * @param lastUpdatedTimeUtc the lastUpdatedTimeUtc value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withLastUpdatedTimeUtc(OffsetDateTime lastUpdatedTimeUtc) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withLastUpdatedTimeUtc(lastUpdatedTimeUtc);
        return this;
    }

    /**
     * Get the expectedExecutionTime property: Expected execution time of a given step. This is optionally authored in
     * the update action plan and can be empty.
     * 
     * @return the expectedExecutionTime value.
     */
    public String expectedExecutionTime() {
        return this.innerProperties() == null ? null : this.innerProperties().expectedExecutionTime();
    }

    /**
     * Set the expectedExecutionTime property: Expected execution time of a given step. This is optionally authored in
     * the update action plan and can be empty.
     * 
     * @param expectedExecutionTime the expectedExecutionTime value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withExpectedExecutionTime(String expectedExecutionTime) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withExpectedExecutionTime(expectedExecutionTime);
        return this;
    }

    /**
     * Get the steps property: Recursive model for child steps of this step.
     * 
     * @return the steps value.
     */
    public List steps() {
        return this.innerProperties() == null ? null : this.innerProperties().steps();
    }

    /**
     * Set the steps property: Recursive model for child steps of this step.
     * 
     * @param steps the steps value to set.
     * @return the UpdateRunInner object itself.
     */
    public UpdateRunInner withSteps(List steps) {
        if (this.innerProperties() == null) {
            this.innerProperties = new UpdateRunProperties();
        }
        this.innerProperties().withSteps(steps);
        return this;
    }

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

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

    /**
     * Reads an instance of UpdateRunInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of UpdateRunInner if the JsonReader was pointing to an instance of it, or null if it was
     * pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the UpdateRunInner.
     */
    public static UpdateRunInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            UpdateRunInner deserializedUpdateRunInner = new UpdateRunInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedUpdateRunInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedUpdateRunInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedUpdateRunInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedUpdateRunInner.location = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedUpdateRunInner.innerProperties = UpdateRunProperties.fromJson(reader);
                } else if ("systemData".equals(fieldName)) {
                    deserializedUpdateRunInner.systemData = SystemData.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedUpdateRunInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy