![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.automation.fluent.models.SourceControlProperties Maven / Gradle / Ivy
// 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.SourceType;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* Definition of the source control properties.
*/
@Fluent
public final class SourceControlProperties implements JsonSerializable {
/*
* The repo url of the source control.
*/
private String repoUrl;
/*
* The repo branch of the source control. Include branch as empty string for VsoTfvc.
*/
private String branch;
/*
* The folder path of the source control.
*/
private String folderPath;
/*
* The auto sync of the source control. Default is false.
*/
private Boolean autoSync;
/*
* The auto publish of the source control. Default is true.
*/
private Boolean publishRunbook;
/*
* The source type. Must be one of VsoGit, VsoTfvc, GitHub.
*/
private SourceType sourceType;
/*
* The description.
*/
private String description;
/*
* The creation time.
*/
private OffsetDateTime creationTime;
/*
* The last modified time.
*/
private OffsetDateTime lastModifiedTime;
/**
* Creates an instance of SourceControlProperties class.
*/
public SourceControlProperties() {
}
/**
* Get the repoUrl property: The repo url of the source control.
*
* @return the repoUrl value.
*/
public String repoUrl() {
return this.repoUrl;
}
/**
* Set the repoUrl property: The repo url of the source control.
*
* @param repoUrl the repoUrl value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withRepoUrl(String repoUrl) {
this.repoUrl = repoUrl;
return this;
}
/**
* Get the branch property: The repo branch of the source control. Include branch as empty string for VsoTfvc.
*
* @return the branch value.
*/
public String branch() {
return this.branch;
}
/**
* Set the branch property: The repo branch of the source control. Include branch as empty string for VsoTfvc.
*
* @param branch the branch value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withBranch(String branch) {
this.branch = branch;
return this;
}
/**
* Get the folderPath property: The folder path of the source control.
*
* @return the folderPath value.
*/
public String folderPath() {
return this.folderPath;
}
/**
* Set the folderPath property: The folder path of the source control.
*
* @param folderPath the folderPath value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withFolderPath(String folderPath) {
this.folderPath = folderPath;
return this;
}
/**
* Get the autoSync property: The auto sync of the source control. Default is false.
*
* @return the autoSync value.
*/
public Boolean autoSync() {
return this.autoSync;
}
/**
* Set the autoSync property: The auto sync of the source control. Default is false.
*
* @param autoSync the autoSync value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withAutoSync(Boolean autoSync) {
this.autoSync = autoSync;
return this;
}
/**
* Get the publishRunbook property: The auto publish of the source control. Default is true.
*
* @return the publishRunbook value.
*/
public Boolean publishRunbook() {
return this.publishRunbook;
}
/**
* Set the publishRunbook property: The auto publish of the source control. Default is true.
*
* @param publishRunbook the publishRunbook value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withPublishRunbook(Boolean publishRunbook) {
this.publishRunbook = publishRunbook;
return this;
}
/**
* Get the sourceType property: The source type. Must be one of VsoGit, VsoTfvc, GitHub.
*
* @return the sourceType value.
*/
public SourceType sourceType() {
return this.sourceType;
}
/**
* Set the sourceType property: The source type. Must be one of VsoGit, VsoTfvc, GitHub.
*
* @param sourceType the sourceType value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withSourceType(SourceType sourceType) {
this.sourceType = sourceType;
return this;
}
/**
* Get the description property: The description.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: The description.
*
* @param description the description value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withDescription(String description) {
this.description = description;
return this;
}
/**
* Get the creationTime property: The creation time.
*
* @return the creationTime value.
*/
public OffsetDateTime creationTime() {
return this.creationTime;
}
/**
* Set the creationTime property: The creation time.
*
* @param creationTime the creationTime value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withCreationTime(OffsetDateTime creationTime) {
this.creationTime = creationTime;
return this;
}
/**
* Get the lastModifiedTime property: The last modified time.
*
* @return the lastModifiedTime value.
*/
public OffsetDateTime lastModifiedTime() {
return this.lastModifiedTime;
}
/**
* Set the lastModifiedTime property: The last modified time.
*
* @param lastModifiedTime the lastModifiedTime value to set.
* @return the SourceControlProperties object itself.
*/
public SourceControlProperties withLastModifiedTime(OffsetDateTime lastModifiedTime) {
this.lastModifiedTime = lastModifiedTime;
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("repoUrl", this.repoUrl);
jsonWriter.writeStringField("branch", this.branch);
jsonWriter.writeStringField("folderPath", this.folderPath);
jsonWriter.writeBooleanField("autoSync", this.autoSync);
jsonWriter.writeBooleanField("publishRunbook", this.publishRunbook);
jsonWriter.writeStringField("sourceType", this.sourceType == null ? null : this.sourceType.toString());
jsonWriter.writeStringField("description", this.description);
jsonWriter.writeStringField("creationTime",
this.creationTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.creationTime));
jsonWriter.writeStringField("lastModifiedTime",
this.lastModifiedTime == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedTime));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SourceControlProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SourceControlProperties 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 SourceControlProperties.
*/
public static SourceControlProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SourceControlProperties deserializedSourceControlProperties = new SourceControlProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("repoUrl".equals(fieldName)) {
deserializedSourceControlProperties.repoUrl = reader.getString();
} else if ("branch".equals(fieldName)) {
deserializedSourceControlProperties.branch = reader.getString();
} else if ("folderPath".equals(fieldName)) {
deserializedSourceControlProperties.folderPath = reader.getString();
} else if ("autoSync".equals(fieldName)) {
deserializedSourceControlProperties.autoSync = reader.getNullable(JsonReader::getBoolean);
} else if ("publishRunbook".equals(fieldName)) {
deserializedSourceControlProperties.publishRunbook = reader.getNullable(JsonReader::getBoolean);
} else if ("sourceType".equals(fieldName)) {
deserializedSourceControlProperties.sourceType = SourceType.fromString(reader.getString());
} else if ("description".equals(fieldName)) {
deserializedSourceControlProperties.description = reader.getString();
} else if ("creationTime".equals(fieldName)) {
deserializedSourceControlProperties.creationTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastModifiedTime".equals(fieldName)) {
deserializedSourceControlProperties.lastModifiedTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else {
reader.skipChildren();
}
}
return deserializedSourceControlProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy