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

com.azure.resourcemanager.desktopvirtualization.models.WorkspacePatch Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for DesktopVirtualization Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-04.

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.desktopvirtualization.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.desktopvirtualization.fluent.models.WorkspacePatchProperties;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Workspace properties that can be patched.
 */
@Fluent
public final class WorkspacePatch implements JsonSerializable {
    /*
     * tags to be updated
     */
    private Map tags;

    /*
     * Detailed properties for Workspace
     */
    private WorkspacePatchProperties innerProperties;

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

    /**
     * Get the tags property: tags to be updated.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: tags to be updated.
     * 
     * @param tags the tags value to set.
     * @return the WorkspacePatch object itself.
     */
    public WorkspacePatch withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the innerProperties property: Detailed properties for Workspace.
     * 
     * @return the innerProperties value.
     */
    private WorkspacePatchProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the description property: Description of Workspace.
     * 
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Description of Workspace.
     * 
     * @param description the description value to set.
     * @return the WorkspacePatch object itself.
     */
    public WorkspacePatch withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspacePatchProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the friendlyName property: Friendly name of Workspace.
     * 
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.innerProperties() == null ? null : this.innerProperties().friendlyName();
    }

    /**
     * Set the friendlyName property: Friendly name of Workspace.
     * 
     * @param friendlyName the friendlyName value to set.
     * @return the WorkspacePatch object itself.
     */
    public WorkspacePatch withFriendlyName(String friendlyName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspacePatchProperties();
        }
        this.innerProperties().withFriendlyName(friendlyName);
        return this;
    }

    /**
     * Get the applicationGroupReferences property: List of applicationGroup links.
     * 
     * @return the applicationGroupReferences value.
     */
    public List applicationGroupReferences() {
        return this.innerProperties() == null ? null : this.innerProperties().applicationGroupReferences();
    }

    /**
     * Set the applicationGroupReferences property: List of applicationGroup links.
     * 
     * @param applicationGroupReferences the applicationGroupReferences value to set.
     * @return the WorkspacePatch object itself.
     */
    public WorkspacePatch withApplicationGroupReferences(List applicationGroupReferences) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspacePatchProperties();
        }
        this.innerProperties().withApplicationGroupReferences(applicationGroupReferences);
        return this;
    }

    /**
     * Get the publicNetworkAccess property: Enabled to allow this resource to be access from the public network.
     * 
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
    }

    /**
     * Set the publicNetworkAccess property: Enabled to allow this resource to be access from the public network.
     * 
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the WorkspacePatch object itself.
     */
    public WorkspacePatch withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspacePatchProperties();
        }
        this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
        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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

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

            return deserializedWorkspacePatch;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy