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

com.azure.resourcemanager.sql.fluent.models.DatabaseOperationProperties Maven / Gradle / Ivy

Go to download

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 database operation.
 */
@Immutable
public final class DatabaseOperationProperties implements JsonSerializable {
    /*
     * The name of the database the operation is being performed on.
     */
    private String databaseName;

    /*
     * 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 DatabaseOperationProperties class.
     */
    public DatabaseOperationProperties() {
    }

    /**
     * Get the databaseName property: The name of the database the operation is being performed on.
     * 
     * @return the databaseName value.
     */
    public String databaseName() {
        return this.databaseName;
    }

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

                if ("databaseName".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.databaseName = reader.getString();
                } else if ("operation".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.operation = reader.getString();
                } else if ("operationFriendlyName".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.operationFriendlyName = reader.getString();
                } else if ("percentComplete".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.percentComplete = reader.getNullable(JsonReader::getInt);
                } else if ("serverName".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.serverName = reader.getString();
                } else if ("startTime".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.startTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("state".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.state
                        = ManagementOperationState.fromString(reader.getString());
                } else if ("errorCode".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.errorCode = reader.getNullable(JsonReader::getInt);
                } else if ("errorDescription".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.errorDescription = reader.getString();
                } else if ("errorSeverity".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.errorSeverity = reader.getNullable(JsonReader::getInt);
                } else if ("isUserError".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.isUserError = reader.getNullable(JsonReader::getBoolean);
                } else if ("estimatedCompletionTime".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.estimatedCompletionTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("description".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.description = reader.getString();
                } else if ("isCancellable".equals(fieldName)) {
                    deserializedDatabaseOperationProperties.isCancellable = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDatabaseOperationProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy