com.azure.resourcemanager.servicefabricmanagedclusters.fluent.models.LongRunningOperationResultInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-servicefabricmanagedclusters Show documentation
Show all versions of azure-resourcemanager-servicefabricmanagedclusters Show documentation
This package contains Microsoft Azure SDK for Service Fabric Managed Clusters Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Service Fabric Managed Clusters Management Client. Package tag package-2024-04.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.servicefabricmanagedclusters.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.exception.ManagementError;
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 java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* Long running operation result.
*/
@Fluent
public final class LongRunningOperationResultInner implements JsonSerializable {
/*
* The name of the operation.
*/
private String name;
/*
* The start time of the operation.
*/
private OffsetDateTime startTime;
/*
* The end time of the operation.
*/
private OffsetDateTime endTime;
/*
* The completion percentage of the operation.
*/
private Double percentComplete;
/*
* The status of the operation.
*/
private String status;
/*
* The operation error.
*/
private ManagementError error;
/**
* Creates an instance of LongRunningOperationResultInner class.
*/
public LongRunningOperationResultInner() {
}
/**
* Get the name property: The name of the operation.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: The name of the operation.
*
* @param name the name value to set.
* @return the LongRunningOperationResultInner object itself.
*/
public LongRunningOperationResultInner withName(String name) {
this.name = name;
return this;
}
/**
* Get the startTime property: The start time of the operation.
*
* @return the startTime value.
*/
public OffsetDateTime startTime() {
return this.startTime;
}
/**
* Set the startTime property: The start time of the operation.
*
* @param startTime the startTime value to set.
* @return the LongRunningOperationResultInner object itself.
*/
public LongRunningOperationResultInner withStartTime(OffsetDateTime startTime) {
this.startTime = startTime;
return this;
}
/**
* Get the endTime property: The end time of the operation.
*
* @return the endTime value.
*/
public OffsetDateTime endTime() {
return this.endTime;
}
/**
* Set the endTime property: The end time of the operation.
*
* @param endTime the endTime value to set.
* @return the LongRunningOperationResultInner object itself.
*/
public LongRunningOperationResultInner withEndTime(OffsetDateTime endTime) {
this.endTime = endTime;
return this;
}
/**
* Get the percentComplete property: The completion percentage of the operation.
*
* @return the percentComplete value.
*/
public Double percentComplete() {
return this.percentComplete;
}
/**
* Set the percentComplete property: The completion percentage of the operation.
*
* @param percentComplete the percentComplete value to set.
* @return the LongRunningOperationResultInner object itself.
*/
public LongRunningOperationResultInner withPercentComplete(Double percentComplete) {
this.percentComplete = percentComplete;
return this;
}
/**
* Get the status property: The status of the operation.
*
* @return the status value.
*/
public String status() {
return this.status;
}
/**
* Set the status property: The status of the operation.
*
* @param status the status value to set.
* @return the LongRunningOperationResultInner object itself.
*/
public LongRunningOperationResultInner withStatus(String status) {
this.status = status;
return this;
}
/**
* Get the error property: The operation error.
*
* @return the error value.
*/
public ManagementError error() {
return this.error;
}
/**
* Set the error property: The operation error.
*
* @param error the error value to set.
* @return the LongRunningOperationResultInner object itself.
*/
public LongRunningOperationResultInner withError(ManagementError error) {
this.error = error;
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("name", this.name);
jsonWriter.writeStringField("startTime",
this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime));
jsonWriter.writeStringField("endTime",
this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime));
jsonWriter.writeNumberField("percentComplete", this.percentComplete);
jsonWriter.writeStringField("status", this.status);
jsonWriter.writeJsonField("error", this.error);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of LongRunningOperationResultInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of LongRunningOperationResultInner 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 LongRunningOperationResultInner.
*/
public static LongRunningOperationResultInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
LongRunningOperationResultInner deserializedLongRunningOperationResultInner
= new LongRunningOperationResultInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedLongRunningOperationResultInner.name = reader.getString();
} else if ("startTime".equals(fieldName)) {
deserializedLongRunningOperationResultInner.startTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("endTime".equals(fieldName)) {
deserializedLongRunningOperationResultInner.endTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("percentComplete".equals(fieldName)) {
deserializedLongRunningOperationResultInner.percentComplete
= reader.getNullable(JsonReader::getDouble);
} else if ("status".equals(fieldName)) {
deserializedLongRunningOperationResultInner.status = reader.getString();
} else if ("error".equals(fieldName)) {
deserializedLongRunningOperationResultInner.error = ManagementError.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedLongRunningOperationResultInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy