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

com.azure.resourcemanager.hybridcompute.models.GatewayUpdate Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.

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.hybridcompute.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.hybridcompute.fluent.models.GatewayUpdateProperties;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Describes a License Update.
 */
@Fluent
public final class GatewayUpdate extends ResourceUpdate {
    /*
     * Gateway Update properties
     */
    private GatewayUpdateProperties innerProperties;

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

    /**
     * Get the innerProperties property: Gateway Update properties.
     * 
     * @return the innerProperties value.
     */
    private GatewayUpdateProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public GatewayUpdate withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the allowedFeatures property: Specifies the list of features that are enabled for this Gateway.
     * 
     * @return the allowedFeatures value.
     */
    public List allowedFeatures() {
        return this.innerProperties() == null ? null : this.innerProperties().allowedFeatures();
    }

    /**
     * Set the allowedFeatures property: Specifies the list of features that are enabled for this Gateway.
     * 
     * @param allowedFeatures the allowedFeatures value to set.
     * @return the GatewayUpdate object itself.
     */
    public GatewayUpdate withAllowedFeatures(List allowedFeatures) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GatewayUpdateProperties();
        }
        this.innerProperties().withAllowedFeatures(allowedFeatures);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of GatewayUpdate from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of GatewayUpdate 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 GatewayUpdate.
     */
    public static GatewayUpdate fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            GatewayUpdate deserializedGatewayUpdate = new GatewayUpdate();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedGatewayUpdate.withTags(tags);
                } else if ("properties".equals(fieldName)) {
                    deserializedGatewayUpdate.innerProperties = GatewayUpdateProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedGatewayUpdate;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy