All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.dnsresolver.models.VirtualNetworkLinkPatch Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for DnsResolver Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The DNS Resolver Management Client. Package tag package-2022-07.

There is a newer version: 1.0.0-beta.3
Show 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.dnsresolver.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.dnsresolver.fluent.models.VirtualNetworkLinkPatchProperties;
import java.io.IOException;
import java.util.Map;

/**
 * Describes a virtual network link for PATCH operation.
 */
@Fluent
public final class VirtualNetworkLinkPatch implements JsonSerializable {
    /*
     * Updatable properties of the virtual network link.
     */
    private VirtualNetworkLinkPatchProperties innerProperties;

    /**
     * Creates an instance of VirtualNetworkLinkPatch class.
     */
    public VirtualNetworkLinkPatch() {
    }

    /**
     * Get the innerProperties property: Updatable properties of the virtual network link.
     * 
     * @return the innerProperties value.
     */
    private VirtualNetworkLinkPatchProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the metadata property: Metadata attached to the virtual network link.
     * 
     * @return the metadata value.
     */
    public Map metadata() {
        return this.innerProperties() == null ? null : this.innerProperties().metadata();
    }

    /**
     * Set the metadata property: Metadata attached to the virtual network link.
     * 
     * @param metadata the metadata value to set.
     * @return the VirtualNetworkLinkPatch object itself.
     */
    public VirtualNetworkLinkPatch withMetadata(Map metadata) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkLinkPatchProperties();
        }
        this.innerProperties().withMetadata(metadata);
        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 VirtualNetworkLinkPatch from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of VirtualNetworkLinkPatch 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 VirtualNetworkLinkPatch.
     */
    public static VirtualNetworkLinkPatch fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            VirtualNetworkLinkPatch deserializedVirtualNetworkLinkPatch = new VirtualNetworkLinkPatch();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("properties".equals(fieldName)) {
                    deserializedVirtualNetworkLinkPatch.innerProperties
                        = VirtualNetworkLinkPatchProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVirtualNetworkLinkPatch;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy