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

com.azure.resourcemanager.sql.fluent.models.JobExecutionInner 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.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.sql.models.JobExecutionLifecycle;
import com.azure.resourcemanager.sql.models.JobExecutionTarget;
import com.azure.resourcemanager.sql.models.ProvisioningState;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.UUID;

/**
 * An execution of a job.
 */
@Fluent
public final class JobExecutionInner extends ProxyResource {
    /*
     * Resource properties.
     */
    private JobExecutionProperties innerProperties;

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

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

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

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

    /**
     * Get the innerProperties property: Resource properties.
     * 
     * @return the innerProperties value.
     */
    private JobExecutionProperties innerProperties() {
        return this.innerProperties;
    }

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

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

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

    /**
     * Get the jobVersion property: The job version number.
     * 
     * @return the jobVersion value.
     */
    public Integer jobVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().jobVersion();
    }

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

    /**
     * Get the stepId property: The job step id.
     * 
     * @return the stepId value.
     */
    public Integer stepId() {
        return this.innerProperties() == null ? null : this.innerProperties().stepId();
    }

    /**
     * Get the jobExecutionId property: The unique identifier of the job execution.
     * 
     * @return the jobExecutionId value.
     */
    public UUID jobExecutionId() {
        return this.innerProperties() == null ? null : this.innerProperties().jobExecutionId();
    }

    /**
     * Get the lifecycle property: The detailed state of the job execution.
     * 
     * @return the lifecycle value.
     */
    public JobExecutionLifecycle lifecycle() {
        return this.innerProperties() == null ? null : this.innerProperties().lifecycle();
    }

    /**
     * Get the provisioningState property: The ARM provisioning state of the job execution.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the createTime property: The time that the job execution was created.
     * 
     * @return the createTime value.
     */
    public OffsetDateTime createTime() {
        return this.innerProperties() == null ? null : this.innerProperties().createTime();
    }

    /**
     * Get the startTime property: The time that the job execution started.
     * 
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.innerProperties() == null ? null : this.innerProperties().startTime();
    }

    /**
     * Get the endTime property: The time that the job execution completed.
     * 
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.innerProperties() == null ? null : this.innerProperties().endTime();
    }

    /**
     * Get the currentAttempts property: Number of times the job execution has been attempted.
     * 
     * @return the currentAttempts value.
     */
    public Integer currentAttempts() {
        return this.innerProperties() == null ? null : this.innerProperties().currentAttempts();
    }

    /**
     * Set the currentAttempts property: Number of times the job execution has been attempted.
     * 
     * @param currentAttempts the currentAttempts value to set.
     * @return the JobExecutionInner object itself.
     */
    public JobExecutionInner withCurrentAttempts(Integer currentAttempts) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobExecutionProperties();
        }
        this.innerProperties().withCurrentAttempts(currentAttempts);
        return this;
    }

    /**
     * Get the currentAttemptStartTime property: Start time of the current attempt.
     * 
     * @return the currentAttemptStartTime value.
     */
    public OffsetDateTime currentAttemptStartTime() {
        return this.innerProperties() == null ? null : this.innerProperties().currentAttemptStartTime();
    }

    /**
     * Get the lastMessage property: The last status or error message.
     * 
     * @return the lastMessage value.
     */
    public String lastMessage() {
        return this.innerProperties() == null ? null : this.innerProperties().lastMessage();
    }

    /**
     * Get the target property: The target that this execution is executed on.
     * 
     * @return the target value.
     */
    public JobExecutionTarget target() {
        return this.innerProperties() == null ? null : this.innerProperties().target();
    }

    /**
     * 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.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedJobExecutionInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedJobExecutionInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedJobExecutionInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedJobExecutionInner.innerProperties = JobExecutionProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedJobExecutionInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy