com.azure.resourcemanager.sql.fluent.models.ServerOperationProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-sql Show documentation
Show all versions of azure-resourcemanager-sql Show documentation
This package contains Microsoft Azure Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
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.sql.fluent.models;
import com.azure.core.annotation.Immutable;
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.sql.models.ManagementOperationState;
import java.io.IOException;
import java.time.OffsetDateTime;
/**
* The properties of a server operation.
*/
@Immutable
public final class ServerOperationProperties implements JsonSerializable {
/*
* The name of operation.
*/
private String operation;
/*
* The friendly name of operation.
*/
private String operationFriendlyName;
/*
* The percentage of the operation completed.
*/
private Integer percentComplete;
/*
* The name of the server.
*/
private String serverName;
/*
* The operation start time.
*/
private OffsetDateTime startTime;
/*
* The operation state.
*/
private ManagementOperationState state;
/*
* The operation error code.
*/
private Integer errorCode;
/*
* The operation error description.
*/
private String errorDescription;
/*
* The operation error severity.
*/
private Integer errorSeverity;
/*
* Whether or not the error is a user error.
*/
private Boolean isUserError;
/*
* The estimated completion time of the operation.
*/
private OffsetDateTime estimatedCompletionTime;
/*
* The operation description.
*/
private String description;
/*
* Whether the operation can be cancelled.
*/
private Boolean isCancellable;
/**
* Creates an instance of ServerOperationProperties class.
*/
public ServerOperationProperties() {
}
/**
* Get the operation property: The name of operation.
*
* @return the operation value.
*/
public String operation() {
return this.operation;
}
/**
* Get the operationFriendlyName property: The friendly name of operation.
*
* @return the operationFriendlyName value.
*/
public String operationFriendlyName() {
return this.operationFriendlyName;
}
/**
* Get the percentComplete property: The percentage of the operation completed.
*
* @return the percentComplete value.
*/
public Integer percentComplete() {
return this.percentComplete;
}
/**
* Get the serverName property: The name of the server.
*
* @return the serverName value.
*/
public String serverName() {
return this.serverName;
}
/**
* Get the startTime property: The operation start time.
*
* @return the startTime value.
*/
public OffsetDateTime startTime() {
return this.startTime;
}
/**
* Get the state property: The operation state.
*
* @return the state value.
*/
public ManagementOperationState state() {
return this.state;
}
/**
* Get the errorCode property: The operation error code.
*
* @return the errorCode value.
*/
public Integer errorCode() {
return this.errorCode;
}
/**
* Get the errorDescription property: The operation error description.
*
* @return the errorDescription value.
*/
public String errorDescription() {
return this.errorDescription;
}
/**
* Get the errorSeverity property: The operation error severity.
*
* @return the errorSeverity value.
*/
public Integer errorSeverity() {
return this.errorSeverity;
}
/**
* Get the isUserError property: Whether or not the error is a user error.
*
* @return the isUserError value.
*/
public Boolean isUserError() {
return this.isUserError;
}
/**
* Get the estimatedCompletionTime property: The estimated completion time of the operation.
*
* @return the estimatedCompletionTime value.
*/
public OffsetDateTime estimatedCompletionTime() {
return this.estimatedCompletionTime;
}
/**
* Get the description property: The operation description.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Get the isCancellable property: Whether the operation can be cancelled.
*
* @return the isCancellable value.
*/
public Boolean isCancellable() {
return this.isCancellable;
}
/**
* 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();
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ServerOperationProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ServerOperationProperties 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 ServerOperationProperties.
*/
public static ServerOperationProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ServerOperationProperties deserializedServerOperationProperties = new ServerOperationProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("operation".equals(fieldName)) {
deserializedServerOperationProperties.operation = reader.getString();
} else if ("operationFriendlyName".equals(fieldName)) {
deserializedServerOperationProperties.operationFriendlyName = reader.getString();
} else if ("percentComplete".equals(fieldName)) {
deserializedServerOperationProperties.percentComplete = reader.getNullable(JsonReader::getInt);
} else if ("serverName".equals(fieldName)) {
deserializedServerOperationProperties.serverName = reader.getString();
} else if ("startTime".equals(fieldName)) {
deserializedServerOperationProperties.startTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("state".equals(fieldName)) {
deserializedServerOperationProperties.state
= ManagementOperationState.fromString(reader.getString());
} else if ("errorCode".equals(fieldName)) {
deserializedServerOperationProperties.errorCode = reader.getNullable(JsonReader::getInt);
} else if ("errorDescription".equals(fieldName)) {
deserializedServerOperationProperties.errorDescription = reader.getString();
} else if ("errorSeverity".equals(fieldName)) {
deserializedServerOperationProperties.errorSeverity = reader.getNullable(JsonReader::getInt);
} else if ("isUserError".equals(fieldName)) {
deserializedServerOperationProperties.isUserError = reader.getNullable(JsonReader::getBoolean);
} else if ("estimatedCompletionTime".equals(fieldName)) {
deserializedServerOperationProperties.estimatedCompletionTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("description".equals(fieldName)) {
deserializedServerOperationProperties.description = reader.getString();
} else if ("isCancellable".equals(fieldName)) {
deserializedServerOperationProperties.isCancellable = reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedServerOperationProperties;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy