com.azure.resourcemanager.keyvault.models.VirtualNetworkRule Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-keyvault Show documentation
Show all versions of azure-resourcemanager-keyvault Show documentation
This package contains Microsoft Azure Key Vault Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
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.keyvault.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;
/**
* A rule governing the accessibility of a vault from a specific virtual network.
*/
@Fluent
public final class VirtualNetworkRule implements JsonSerializable {
/*
* Full resource id of a vnet subnet, such as
* '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.
*/
private String id;
/*
* Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured.
*/
private Boolean ignoreMissingVnetServiceEndpoint;
/**
* Creates an instance of VirtualNetworkRule class.
*/
public VirtualNetworkRule() {
}
/**
* Get the id property: Full resource id of a vnet subnet, such as
* '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Set the id property: Full resource id of a vnet subnet, such as
* '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'.
*
* @param id the id value to set.
* @return the VirtualNetworkRule object itself.
*/
public VirtualNetworkRule withId(String id) {
this.id = id;
return this;
}
/**
* Get the ignoreMissingVnetServiceEndpoint property: Property to specify whether NRP will ignore the check if
* parent subnet has serviceEndpoints configured.
*
* @return the ignoreMissingVnetServiceEndpoint value.
*/
public Boolean ignoreMissingVnetServiceEndpoint() {
return this.ignoreMissingVnetServiceEndpoint;
}
/**
* Set the ignoreMissingVnetServiceEndpoint property: Property to specify whether NRP will ignore the check if
* parent subnet has serviceEndpoints configured.
*
* @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set.
* @return the VirtualNetworkRule object itself.
*/
public VirtualNetworkRule withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) {
this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (id() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property id in model VirtualNetworkRule"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRule.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("id", this.id);
jsonWriter.writeBooleanField("ignoreMissingVnetServiceEndpoint", this.ignoreMissingVnetServiceEndpoint);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of VirtualNetworkRule from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of VirtualNetworkRule 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 VirtualNetworkRule.
*/
public static VirtualNetworkRule fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
VirtualNetworkRule deserializedVirtualNetworkRule = new VirtualNetworkRule();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedVirtualNetworkRule.id = reader.getString();
} else if ("ignoreMissingVnetServiceEndpoint".equals(fieldName)) {
deserializedVirtualNetworkRule.ignoreMissingVnetServiceEndpoint
= reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedVirtualNetworkRule;
});
}
}