com.azure.resourcemanager.netapp.models.FilePathAvailabilityRequest 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.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* File path availability request content - availability is based on the name and the subnetId.
*/
@Fluent
public final class FilePathAvailabilityRequest implements JsonSerializable {
/*
* File path to verify.
*/
private String name;
/*
* The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes
*/
private String subnetId;
/*
* The Azure Resource logical availability zone which is used within zone mapping lookup for the subscription and
* region. The lookup will retrieve the physical zone where volume is placed.
*/
private String availabilityZone;
/**
* Creates an instance of FilePathAvailabilityRequest class.
*/
public FilePathAvailabilityRequest() {
}
/**
* Get the name property: File path to verify.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: File path to verify.
*
* @param name the name value to set.
* @return the FilePathAvailabilityRequest object itself.
*/
public FilePathAvailabilityRequest withName(String name) {
this.name = name;
return this;
}
/**
* Get the subnetId property: The Azure Resource URI for a delegated subnet. Must have the delegation
* Microsoft.NetApp/volumes.
*
* @return the subnetId value.
*/
public String subnetId() {
return this.subnetId;
}
/**
* Set the subnetId property: The Azure Resource URI for a delegated subnet. Must have the delegation
* Microsoft.NetApp/volumes.
*
* @param subnetId the subnetId value to set.
* @return the FilePathAvailabilityRequest object itself.
*/
public FilePathAvailabilityRequest withSubnetId(String subnetId) {
this.subnetId = subnetId;
return this;
}
/**
* Get the availabilityZone property: The Azure Resource logical availability zone which is used within zone mapping
* lookup for the subscription and region. The lookup will retrieve the physical zone where volume is placed.
*
* @return the availabilityZone value.
*/
public String availabilityZone() {
return this.availabilityZone;
}
/**
* Set the availabilityZone property: The Azure Resource logical availability zone which is used within zone mapping
* lookup for the subscription and region. The lookup will retrieve the physical zone where volume is placed.
*
* @param availabilityZone the availabilityZone value to set.
* @return the FilePathAvailabilityRequest object itself.
*/
public FilePathAvailabilityRequest withAvailabilityZone(String availabilityZone) {
this.availabilityZone = availabilityZone;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (name() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property name in model FilePathAvailabilityRequest"));
}
if (subnetId() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property subnetId in model FilePathAvailabilityRequest"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(FilePathAvailabilityRequest.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeStringField("subnetId", this.subnetId);
jsonWriter.writeStringField("availabilityZone", this.availabilityZone);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of FilePathAvailabilityRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of FilePathAvailabilityRequest if the JsonReader was pointing to an instance of it, or null
* if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the FilePathAvailabilityRequest.
*/
public static FilePathAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
FilePathAvailabilityRequest deserializedFilePathAvailabilityRequest = new FilePathAvailabilityRequest();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedFilePathAvailabilityRequest.name = reader.getString();
} else if ("subnetId".equals(fieldName)) {
deserializedFilePathAvailabilityRequest.subnetId = reader.getString();
} else if ("availabilityZone".equals(fieldName)) {
deserializedFilePathAvailabilityRequest.availabilityZone = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedFilePathAvailabilityRequest;
});
}
}