com.azure.resourcemanager.security.models.JFrogEnvironmentData 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.security.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The JFrog Artifactory connector environment data.
*/
@Fluent
public final class JFrogEnvironmentData extends EnvironmentData {
/*
* The type of the environment data.
*/
private EnvironmentType environmentType = EnvironmentType.JFROG_ARTIFACTORY;
/*
* Scan interval in hours (value should be between 1-hour to 24-hours)
*/
private Integer scanInterval;
/**
* Creates an instance of JFrogEnvironmentData class.
*/
public JFrogEnvironmentData() {
}
/**
* Get the environmentType property: The type of the environment data.
*
* @return the environmentType value.
*/
@Override
public EnvironmentType environmentType() {
return this.environmentType;
}
/**
* Get the scanInterval property: Scan interval in hours (value should be between 1-hour to 24-hours).
*
* @return the scanInterval value.
*/
public Integer scanInterval() {
return this.scanInterval;
}
/**
* Set the scanInterval property: Scan interval in hours (value should be between 1-hour to 24-hours).
*
* @param scanInterval the scanInterval value to set.
* @return the JFrogEnvironmentData object itself.
*/
public JFrogEnvironmentData withScanInterval(Integer scanInterval) {
this.scanInterval = scanInterval;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("environmentType",
this.environmentType == null ? null : this.environmentType.toString());
jsonWriter.writeNumberField("scanInterval", this.scanInterval);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of JFrogEnvironmentData from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of JFrogEnvironmentData 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 JFrogEnvironmentData.
*/
public static JFrogEnvironmentData fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
JFrogEnvironmentData deserializedJFrogEnvironmentData = new JFrogEnvironmentData();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("environmentType".equals(fieldName)) {
deserializedJFrogEnvironmentData.environmentType = EnvironmentType.fromString(reader.getString());
} else if ("scanInterval".equals(fieldName)) {
deserializedJFrogEnvironmentData.scanInterval = reader.getNullable(JsonReader::getInt);
} else {
reader.skipChildren();
}
}
return deserializedJFrogEnvironmentData;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy