com.azure.resourcemanager.dataprotection.models.JobSubTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-dataprotection Show documentation
Show all versions of azure-resourcemanager-dataprotection Show documentation
This package contains Microsoft Azure SDK for DataProtection Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Open API 2.0 Specs for Azure Data Protection 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.dataprotection.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
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.util.Map;
/**
* Details of Job's Sub Task.
*/
@Fluent
public final class JobSubTask implements JsonSerializable {
/*
* Additional details of Sub Tasks
*/
private Map additionalDetails;
/*
* Task Id of the Sub Task
*/
private int taskId;
/*
* Name of the Sub Task
*/
private String taskName;
/*
* Progress of the Sub Task
*/
private String taskProgress;
/*
* Status of the Sub Task
*/
private String taskStatus;
/**
* Creates an instance of JobSubTask class.
*/
public JobSubTask() {
}
/**
* Get the additionalDetails property: Additional details of Sub Tasks.
*
* @return the additionalDetails value.
*/
public Map additionalDetails() {
return this.additionalDetails;
}
/**
* Set the additionalDetails property: Additional details of Sub Tasks.
*
* @param additionalDetails the additionalDetails value to set.
* @return the JobSubTask object itself.
*/
public JobSubTask withAdditionalDetails(Map additionalDetails) {
this.additionalDetails = additionalDetails;
return this;
}
/**
* Get the taskId property: Task Id of the Sub Task.
*
* @return the taskId value.
*/
public int taskId() {
return this.taskId;
}
/**
* Set the taskId property: Task Id of the Sub Task.
*
* @param taskId the taskId value to set.
* @return the JobSubTask object itself.
*/
public JobSubTask withTaskId(int taskId) {
this.taskId = taskId;
return this;
}
/**
* Get the taskName property: Name of the Sub Task.
*
* @return the taskName value.
*/
public String taskName() {
return this.taskName;
}
/**
* Set the taskName property: Name of the Sub Task.
*
* @param taskName the taskName value to set.
* @return the JobSubTask object itself.
*/
public JobSubTask withTaskName(String taskName) {
this.taskName = taskName;
return this;
}
/**
* Get the taskProgress property: Progress of the Sub Task.
*
* @return the taskProgress value.
*/
public String taskProgress() {
return this.taskProgress;
}
/**
* Get the taskStatus property: Status of the Sub Task.
*
* @return the taskStatus value.
*/
public String taskStatus() {
return this.taskStatus;
}
/**
* Set the taskStatus property: Status of the Sub Task.
*
* @param taskStatus the taskStatus value to set.
* @return the JobSubTask object itself.
*/
public JobSubTask withTaskStatus(String taskStatus) {
this.taskStatus = taskStatus;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (taskName() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property taskName in model JobSubTask"));
}
if (taskStatus() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property taskStatus in model JobSubTask"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(JobSubTask.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeIntField("taskId", this.taskId);
jsonWriter.writeStringField("taskName", this.taskName);
jsonWriter.writeStringField("taskStatus", this.taskStatus);
jsonWriter.writeMapField("additionalDetails", this.additionalDetails,
(writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of JobSubTask from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of JobSubTask 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 JobSubTask.
*/
public static JobSubTask fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
JobSubTask deserializedJobSubTask = new JobSubTask();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("taskId".equals(fieldName)) {
deserializedJobSubTask.taskId = reader.getInt();
} else if ("taskName".equals(fieldName)) {
deserializedJobSubTask.taskName = reader.getString();
} else if ("taskStatus".equals(fieldName)) {
deserializedJobSubTask.taskStatus = reader.getString();
} else if ("additionalDetails".equals(fieldName)) {
Map additionalDetails = reader.readMap(reader1 -> reader1.getString());
deserializedJobSubTask.additionalDetails = additionalDetails;
} else if ("taskProgress".equals(fieldName)) {
deserializedJobSubTask.taskProgress = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedJobSubTask;
});
}
}