
com.azure.resourcemanager.devcenter.models.StopOnDisconnectConfiguration 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.devcenter.models;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Stop on disconnect configuration settings for Dev Boxes created in this pool.
*/
@Fluent
public final class StopOnDisconnectConfiguration implements JsonSerializable {
/*
* Whether the feature to stop the Dev Box on disconnect once the grace period has lapsed is enabled.
*/
private StopOnDisconnectEnableStatus status;
/*
* The specified time in minutes to wait before stopping a Dev Box once disconnect is detected.
*/
private Integer gracePeriodMinutes;
/**
* Creates an instance of StopOnDisconnectConfiguration class.
*/
public StopOnDisconnectConfiguration() {
}
/**
* Get the status property: Whether the feature to stop the Dev Box on disconnect once the grace period has lapsed
* is enabled.
*
* @return the status value.
*/
public StopOnDisconnectEnableStatus status() {
return this.status;
}
/**
* Set the status property: Whether the feature to stop the Dev Box on disconnect once the grace period has lapsed
* is enabled.
*
* @param status the status value to set.
* @return the StopOnDisconnectConfiguration object itself.
*/
public StopOnDisconnectConfiguration withStatus(StopOnDisconnectEnableStatus status) {
this.status = status;
return this;
}
/**
* Get the gracePeriodMinutes property: The specified time in minutes to wait before stopping a Dev Box once
* disconnect is detected.
*
* @return the gracePeriodMinutes value.
*/
public Integer gracePeriodMinutes() {
return this.gracePeriodMinutes;
}
/**
* Set the gracePeriodMinutes property: The specified time in minutes to wait before stopping a Dev Box once
* disconnect is detected.
*
* @param gracePeriodMinutes the gracePeriodMinutes value to set.
* @return the StopOnDisconnectConfiguration object itself.
*/
public StopOnDisconnectConfiguration withGracePeriodMinutes(Integer gracePeriodMinutes) {
this.gracePeriodMinutes = gracePeriodMinutes;
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("status", this.status == null ? null : this.status.toString());
jsonWriter.writeNumberField("gracePeriodMinutes", this.gracePeriodMinutes);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of StopOnDisconnectConfiguration from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of StopOnDisconnectConfiguration 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 StopOnDisconnectConfiguration.
*/
public static StopOnDisconnectConfiguration fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
StopOnDisconnectConfiguration deserializedStopOnDisconnectConfiguration
= new StopOnDisconnectConfiguration();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("status".equals(fieldName)) {
deserializedStopOnDisconnectConfiguration.status
= StopOnDisconnectEnableStatus.fromString(reader.getString());
} else if ("gracePeriodMinutes".equals(fieldName)) {
deserializedStopOnDisconnectConfiguration.gracePeriodMinutes
= reader.getNullable(JsonReader::getInt);
} else {
reader.skipChildren();
}
}
return deserializedStopOnDisconnectConfiguration;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy