com.azure.resourcemanager.elasticsan.fluent.models.VolumeGroupProperties 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.elasticsan.fluent.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.elasticsan.models.EncryptionProperties;
import com.azure.resourcemanager.elasticsan.models.EncryptionType;
import com.azure.resourcemanager.elasticsan.models.NetworkRuleSet;
import com.azure.resourcemanager.elasticsan.models.ProvisioningStates;
import com.azure.resourcemanager.elasticsan.models.StorageTargetType;
import java.io.IOException;
import java.util.List;
/**
* VolumeGroup response properties.
*/
@Fluent
public final class VolumeGroupProperties implements JsonSerializable {
/*
* State of the operation on the resource.
*/
private ProvisioningStates provisioningState;
/*
* Type of storage target
*/
private StorageTargetType protocolType;
/*
* Type of encryption
*/
private EncryptionType encryption;
/*
* Encryption Properties describing Key Vault and Identity information
*/
private EncryptionProperties encryptionProperties;
/*
* A collection of rules governing the accessibility from specific network locations.
*/
private NetworkRuleSet networkAcls;
/*
* The list of Private Endpoint Connections.
*/
private List privateEndpointConnections;
/*
* A boolean indicating whether or not Data Integrity Check is enabled
*/
private Boolean enforceDataIntegrityCheckForIscsi;
/**
* Creates an instance of VolumeGroupProperties class.
*/
public VolumeGroupProperties() {
}
/**
* Get the provisioningState property: State of the operation on the resource.
*
* @return the provisioningState value.
*/
public ProvisioningStates provisioningState() {
return this.provisioningState;
}
/**
* Get the protocolType property: Type of storage target.
*
* @return the protocolType value.
*/
public StorageTargetType protocolType() {
return this.protocolType;
}
/**
* Set the protocolType property: Type of storage target.
*
* @param protocolType the protocolType value to set.
* @return the VolumeGroupProperties object itself.
*/
public VolumeGroupProperties withProtocolType(StorageTargetType protocolType) {
this.protocolType = protocolType;
return this;
}
/**
* Get the encryption property: Type of encryption.
*
* @return the encryption value.
*/
public EncryptionType encryption() {
return this.encryption;
}
/**
* Set the encryption property: Type of encryption.
*
* @param encryption the encryption value to set.
* @return the VolumeGroupProperties object itself.
*/
public VolumeGroupProperties withEncryption(EncryptionType encryption) {
this.encryption = encryption;
return this;
}
/**
* Get the encryptionProperties property: Encryption Properties describing Key Vault and Identity information.
*
* @return the encryptionProperties value.
*/
public EncryptionProperties encryptionProperties() {
return this.encryptionProperties;
}
/**
* Set the encryptionProperties property: Encryption Properties describing Key Vault and Identity information.
*
* @param encryptionProperties the encryptionProperties value to set.
* @return the VolumeGroupProperties object itself.
*/
public VolumeGroupProperties withEncryptionProperties(EncryptionProperties encryptionProperties) {
this.encryptionProperties = encryptionProperties;
return this;
}
/**
* Get the networkAcls property: A collection of rules governing the accessibility from specific network locations.
*
* @return the networkAcls value.
*/
public NetworkRuleSet networkAcls() {
return this.networkAcls;
}
/**
* Set the networkAcls property: A collection of rules governing the accessibility from specific network locations.
*
* @param networkAcls the networkAcls value to set.
* @return the VolumeGroupProperties object itself.
*/
public VolumeGroupProperties withNetworkAcls(NetworkRuleSet networkAcls) {
this.networkAcls = networkAcls;
return this;
}
/**
* Get the privateEndpointConnections property: The list of Private Endpoint Connections.
*
* @return the privateEndpointConnections value.
*/
public List privateEndpointConnections() {
return this.privateEndpointConnections;
}
/**
* Get the enforceDataIntegrityCheckForIscsi property: A boolean indicating whether or not Data Integrity Check is
* enabled.
*
* @return the enforceDataIntegrityCheckForIscsi value.
*/
public Boolean enforceDataIntegrityCheckForIscsi() {
return this.enforceDataIntegrityCheckForIscsi;
}
/**
* Set the enforceDataIntegrityCheckForIscsi property: A boolean indicating whether or not Data Integrity Check is
* enabled.
*
* @param enforceDataIntegrityCheckForIscsi the enforceDataIntegrityCheckForIscsi value to set.
* @return the VolumeGroupProperties object itself.
*/
public VolumeGroupProperties withEnforceDataIntegrityCheckForIscsi(Boolean enforceDataIntegrityCheckForIscsi) {
this.enforceDataIntegrityCheckForIscsi = enforceDataIntegrityCheckForIscsi;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (encryptionProperties() != null) {
encryptionProperties().validate();
}
if (networkAcls() != null) {
networkAcls().validate();
}
if (privateEndpointConnections() != null) {
privateEndpointConnections().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("protocolType", this.protocolType == null ? null : this.protocolType.toString());
jsonWriter.writeStringField("encryption", this.encryption == null ? null : this.encryption.toString());
jsonWriter.writeJsonField("encryptionProperties", this.encryptionProperties);
jsonWriter.writeJsonField("networkAcls", this.networkAcls);
jsonWriter.writeBooleanField("enforceDataIntegrityCheckForIscsi", this.enforceDataIntegrityCheckForIscsi);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of VolumeGroupProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of VolumeGroupProperties 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 VolumeGroupProperties.
*/
public static VolumeGroupProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
VolumeGroupProperties deserializedVolumeGroupProperties = new VolumeGroupProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("provisioningState".equals(fieldName)) {
deserializedVolumeGroupProperties.provisioningState
= ProvisioningStates.fromString(reader.getString());
} else if ("protocolType".equals(fieldName)) {
deserializedVolumeGroupProperties.protocolType = StorageTargetType.fromString(reader.getString());
} else if ("encryption".equals(fieldName)) {
deserializedVolumeGroupProperties.encryption = EncryptionType.fromString(reader.getString());
} else if ("encryptionProperties".equals(fieldName)) {
deserializedVolumeGroupProperties.encryptionProperties = EncryptionProperties.fromJson(reader);
} else if ("networkAcls".equals(fieldName)) {
deserializedVolumeGroupProperties.networkAcls = NetworkRuleSet.fromJson(reader);
} else if ("privateEndpointConnections".equals(fieldName)) {
List privateEndpointConnections
= reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1));
deserializedVolumeGroupProperties.privateEndpointConnections = privateEndpointConnections;
} else if ("enforceDataIntegrityCheckForIscsi".equals(fieldName)) {
deserializedVolumeGroupProperties.enforceDataIntegrityCheckForIscsi
= reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedVolumeGroupProperties;
});
}
}