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

com.azure.resourcemanager.desktopvirtualization.fluent.models.SessionHostPatchProperties 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.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 java.io.IOException;

/**
 * SessionHost properties that can be patched.
 */
@Fluent
public final class SessionHostPatchProperties implements JsonSerializable {
    /*
     * Allow a new session.
     */
    private Boolean allowNewSession;

    /*
     * User assigned to SessionHost.
     */
    private String assignedUser;

    /*
     * Friendly name of SessionHost
     */
    private String friendlyName;

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

    /**
     * Get the allowNewSession property: Allow a new session.
     * 
     * @return the allowNewSession value.
     */
    public Boolean allowNewSession() {
        return this.allowNewSession;
    }

    /**
     * Set the allowNewSession property: Allow a new session.
     * 
     * @param allowNewSession the allowNewSession value to set.
     * @return the SessionHostPatchProperties object itself.
     */
    public SessionHostPatchProperties withAllowNewSession(Boolean allowNewSession) {
        this.allowNewSession = allowNewSession;
        return this;
    }

    /**
     * Get the assignedUser property: User assigned to SessionHost.
     * 
     * @return the assignedUser value.
     */
    public String assignedUser() {
        return this.assignedUser;
    }

    /**
     * Set the assignedUser property: User assigned to SessionHost.
     * 
     * @param assignedUser the assignedUser value to set.
     * @return the SessionHostPatchProperties object itself.
     */
    public SessionHostPatchProperties withAssignedUser(String assignedUser) {
        this.assignedUser = assignedUser;
        return this;
    }

    /**
     * Get the friendlyName property: Friendly name of SessionHost.
     * 
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.friendlyName;
    }

    /**
     * Set the friendlyName property: Friendly name of SessionHost.
     * 
     * @param friendlyName the friendlyName value to set.
     * @return the SessionHostPatchProperties object itself.
     */
    public SessionHostPatchProperties withFriendlyName(String friendlyName) {
        this.friendlyName = friendlyName;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeBooleanField("allowNewSession", this.allowNewSession);
        jsonWriter.writeStringField("assignedUser", this.assignedUser);
        jsonWriter.writeStringField("friendlyName", this.friendlyName);
        return jsonWriter.writeEndObject();
    }

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

                if ("allowNewSession".equals(fieldName)) {
                    deserializedSessionHostPatchProperties.allowNewSession = reader.getNullable(JsonReader::getBoolean);
                } else if ("assignedUser".equals(fieldName)) {
                    deserializedSessionHostPatchProperties.assignedUser = reader.getString();
                } else if ("friendlyName".equals(fieldName)) {
                    deserializedSessionHostPatchProperties.friendlyName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSessionHostPatchProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy