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

com.azure.resourcemanager.automation.fluent.models.SourceControlSyncJobByIdProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Automation Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Automation Client. Package tag package-2022-02-22.

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.automation.fluent.models;

import com.azure.core.annotation.Fluent;
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.automation.models.ProvisioningState;
import com.azure.resourcemanager.automation.models.SyncType;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * Definition of source control sync job properties.
 */
@Fluent
public final class SourceControlSyncJobByIdProperties implements JsonSerializable {
    /*
     * The source control sync job id.
     */
    private String sourceControlSyncJobId;

    /*
     * The creation time of the job.
     */
    private OffsetDateTime creationTime;

    /*
     * The provisioning state of the job.
     */
    private ProvisioningState provisioningState;

    /*
     * The start time of the job.
     */
    private OffsetDateTime startTime;

    /*
     * The end time of the job.
     */
    private OffsetDateTime endTime;

    /*
     * The sync type.
     */
    private SyncType syncType;

    /*
     * The exceptions that occurred while running the sync job.
     */
    private String exception;

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

    /**
     * Get the sourceControlSyncJobId property: The source control sync job id.
     * 
     * @return the sourceControlSyncJobId value.
     */
    public String sourceControlSyncJobId() {
        return this.sourceControlSyncJobId;
    }

    /**
     * Set the sourceControlSyncJobId property: The source control sync job id.
     * 
     * @param sourceControlSyncJobId the sourceControlSyncJobId value to set.
     * @return the SourceControlSyncJobByIdProperties object itself.
     */
    public SourceControlSyncJobByIdProperties withSourceControlSyncJobId(String sourceControlSyncJobId) {
        this.sourceControlSyncJobId = sourceControlSyncJobId;
        return this;
    }

    /**
     * Get the creationTime property: The creation time of the job.
     * 
     * @return the creationTime value.
     */
    public OffsetDateTime creationTime() {
        return this.creationTime;
    }

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

    /**
     * Set the provisioningState property: The provisioning state of the job.
     * 
     * @param provisioningState the provisioningState value to set.
     * @return the SourceControlSyncJobByIdProperties object itself.
     */
    public SourceControlSyncJobByIdProperties withProvisioningState(ProvisioningState provisioningState) {
        this.provisioningState = provisioningState;
        return this;
    }

    /**
     * Get the startTime property: The start time of the job.
     * 
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Get the endTime property: The end time of the job.
     * 
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Get the syncType property: The sync type.
     * 
     * @return the syncType value.
     */
    public SyncType syncType() {
        return this.syncType;
    }

    /**
     * Set the syncType property: The sync type.
     * 
     * @param syncType the syncType value to set.
     * @return the SourceControlSyncJobByIdProperties object itself.
     */
    public SourceControlSyncJobByIdProperties withSyncType(SyncType syncType) {
        this.syncType = syncType;
        return this;
    }

    /**
     * Get the exception property: The exceptions that occurred while running the sync job.
     * 
     * @return the exception value.
     */
    public String exception() {
        return this.exception;
    }

    /**
     * Set the exception property: The exceptions that occurred while running the sync job.
     * 
     * @param exception the exception value to set.
     * @return the SourceControlSyncJobByIdProperties object itself.
     */
    public SourceControlSyncJobByIdProperties withException(String exception) {
        this.exception = exception;
        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("sourceControlSyncJobId", this.sourceControlSyncJobId);
        jsonWriter.writeStringField("provisioningState",
            this.provisioningState == null ? null : this.provisioningState.toString());
        jsonWriter.writeStringField("syncType", this.syncType == null ? null : this.syncType.toString());
        jsonWriter.writeStringField("exception", this.exception);
        return jsonWriter.writeEndObject();
    }

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

                if ("sourceControlSyncJobId".equals(fieldName)) {
                    deserializedSourceControlSyncJobByIdProperties.sourceControlSyncJobId = reader.getString();
                } else if ("creationTime".equals(fieldName)) {
                    deserializedSourceControlSyncJobByIdProperties.creationTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedSourceControlSyncJobByIdProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("startTime".equals(fieldName)) {
                    deserializedSourceControlSyncJobByIdProperties.startTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("endTime".equals(fieldName)) {
                    deserializedSourceControlSyncJobByIdProperties.endTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("syncType".equals(fieldName)) {
                    deserializedSourceControlSyncJobByIdProperties.syncType = SyncType.fromString(reader.getString());
                } else if ("exception".equals(fieldName)) {
                    deserializedSourceControlSyncJobByIdProperties.exception = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSourceControlSyncJobByIdProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy