com.azure.resourcemanager.netapp.models.SubvolumePatchRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-netapp Show documentation
Show all versions of azure-resourcemanager-netapp Show documentation
This package contains Microsoft Azure SDK for NetAppFiles Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft NetApp Files Azure Resource Provider specification. Package tag package-2024-03.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.netapp.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 com.azure.resourcemanager.netapp.fluent.models.SubvolumePatchParams;
import java.io.IOException;
/**
* Subvolume Patch Request properties.
*/
@Fluent
public final class SubvolumePatchRequest implements JsonSerializable {
/*
* Subvolume Properties
*/
private SubvolumePatchParams innerProperties;
/**
* Creates an instance of SubvolumePatchRequest class.
*/
public SubvolumePatchRequest() {
}
/**
* Get the innerProperties property: Subvolume Properties.
*
* @return the innerProperties value.
*/
private SubvolumePatchParams innerProperties() {
return this.innerProperties;
}
/**
* Get the size property: Truncate subvolume to the provided size in bytes.
*
* @return the size value.
*/
public Long size() {
return this.innerProperties() == null ? null : this.innerProperties().size();
}
/**
* Set the size property: Truncate subvolume to the provided size in bytes.
*
* @param size the size value to set.
* @return the SubvolumePatchRequest object itself.
*/
public SubvolumePatchRequest withSize(Long size) {
if (this.innerProperties() == null) {
this.innerProperties = new SubvolumePatchParams();
}
this.innerProperties().withSize(size);
return this;
}
/**
* Get the path property: path to the subvolume.
*
* @return the path value.
*/
public String path() {
return this.innerProperties() == null ? null : this.innerProperties().path();
}
/**
* Set the path property: path to the subvolume.
*
* @param path the path value to set.
* @return the SubvolumePatchRequest object itself.
*/
public SubvolumePatchRequest withPath(String path) {
if (this.innerProperties() == null) {
this.innerProperties = new SubvolumePatchParams();
}
this.innerProperties().withPath(path);
return this;
}
/**
* 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 SubvolumePatchRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SubvolumePatchRequest 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 SubvolumePatchRequest.
*/
public static SubvolumePatchRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SubvolumePatchRequest deserializedSubvolumePatchRequest = new SubvolumePatchRequest();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("properties".equals(fieldName)) {
deserializedSubvolumePatchRequest.innerProperties = SubvolumePatchParams.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedSubvolumePatchRequest;
});
}
}