com.azure.resourcemanager.storagecache.models.NfsAccessPolicy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-storagecache Show documentation
Show all versions of azure-resourcemanager-storagecache Show documentation
This package contains Microsoft Azure SDK for StorageCache Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Managed Lustre provides a fully managed Lustre® file system, integrated with Blob storage, for use on demand. These operations create and manage Azure Managed Lustre file systems. Package tag package-2024-03.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.storagecache.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;
import java.util.List;
/**
* A set of rules describing access policies applied to NFSv3 clients of the cache.
*/
@Fluent
public final class NfsAccessPolicy implements JsonSerializable {
/*
* Name identifying this policy. Access Policy names are not case sensitive.
*/
private String name;
/*
* The set of rules describing client accesses allowed under this policy.
*/
private List accessRules;
/**
* Creates an instance of NfsAccessPolicy class.
*/
public NfsAccessPolicy() {
}
/**
* Get the name property: Name identifying this policy. Access Policy names are not case sensitive.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Name identifying this policy. Access Policy names are not case sensitive.
*
* @param name the name value to set.
* @return the NfsAccessPolicy object itself.
*/
public NfsAccessPolicy withName(String name) {
this.name = name;
return this;
}
/**
* Get the accessRules property: The set of rules describing client accesses allowed under this policy.
*
* @return the accessRules value.
*/
public List accessRules() {
return this.accessRules;
}
/**
* Set the accessRules property: The set of rules describing client accesses allowed under this policy.
*
* @param accessRules the accessRules value to set.
* @return the NfsAccessPolicy object itself.
*/
public NfsAccessPolicy withAccessRules(List accessRules) {
this.accessRules = accessRules;
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 NfsAccessPolicy"));
}
if (accessRules() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property accessRules in model NfsAccessPolicy"));
} else {
accessRules().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(NfsAccessPolicy.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeArrayField("accessRules", this.accessRules, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of NfsAccessPolicy from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of NfsAccessPolicy 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 NfsAccessPolicy.
*/
public static NfsAccessPolicy fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
NfsAccessPolicy deserializedNfsAccessPolicy = new NfsAccessPolicy();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedNfsAccessPolicy.name = reader.getString();
} else if ("accessRules".equals(fieldName)) {
List accessRules = reader.readArray(reader1 -> NfsAccessRule.fromJson(reader1));
deserializedNfsAccessPolicy.accessRules = accessRules;
} else {
reader.skipChildren();
}
}
return deserializedNfsAccessPolicy;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy