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

com.azure.resourcemanager.desktopvirtualization.fluent.models.SessionHostInner 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.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.desktopvirtualization.models.SessionHostHealthCheckReport;
import com.azure.resourcemanager.desktopvirtualization.models.Status;
import com.azure.resourcemanager.desktopvirtualization.models.UpdateState;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * Represents a SessionHost definition.
 */
@Fluent
public final class SessionHostInner extends ProxyResource {
    /*
     * Detailed properties for SessionHost
     */
    private SessionHostProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    private SystemData systemData;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

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

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     * 
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the objectId property: ObjectId of SessionHost. (internal use).
     * 
     * @return the objectId value.
     */
    public String objectId() {
        return this.innerProperties() == null ? null : this.innerProperties().objectId();
    }

    /**
     * Get the lastHeartBeat property: Last heart beat from SessionHost.
     * 
     * @return the lastHeartBeat value.
     */
    public OffsetDateTime lastHeartBeat() {
        return this.innerProperties() == null ? null : this.innerProperties().lastHeartBeat();
    }

    /**
     * Set the lastHeartBeat property: Last heart beat from SessionHost.
     * 
     * @param lastHeartBeat the lastHeartBeat value to set.
     * @return the SessionHostInner object itself.
     */
    public SessionHostInner withLastHeartBeat(OffsetDateTime lastHeartBeat) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SessionHostProperties();
        }
        this.innerProperties().withLastHeartBeat(lastHeartBeat);
        return this;
    }

    /**
     * Get the sessions property: Number of sessions on SessionHost.
     * 
     * @return the sessions value.
     */
    public Integer sessions() {
        return this.innerProperties() == null ? null : this.innerProperties().sessions();
    }

    /**
     * Set the sessions property: Number of sessions on SessionHost.
     * 
     * @param sessions the sessions value to set.
     * @return the SessionHostInner object itself.
     */
    public SessionHostInner withSessions(Integer sessions) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SessionHostProperties();
        }
        this.innerProperties().withSessions(sessions);
        return this;
    }

    /**
     * Get the agentVersion property: Version of agent on SessionHost.
     * 
     * @return the agentVersion value.
     */
    public String agentVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().agentVersion();
    }

    /**
     * Set the agentVersion property: Version of agent on SessionHost.
     * 
     * @param agentVersion the agentVersion value to set.
     * @return the SessionHostInner object itself.
     */
    public SessionHostInner withAgentVersion(String agentVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SessionHostProperties();
        }
        this.innerProperties().withAgentVersion(agentVersion);
        return this;
    }

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

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

    /**
     * Get the virtualMachineId property: Virtual Machine Id of SessionHost's underlying virtual machine.
     * 
     * @return the virtualMachineId value.
     */
    public String virtualMachineId() {
        return this.innerProperties() == null ? null : this.innerProperties().virtualMachineId();
    }

    /**
     * Get the resourceId property: Resource Id of SessionHost's underlying virtual machine.
     * 
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().resourceId();
    }

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

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

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

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

    /**
     * Get the status property: Status for a SessionHost.
     * 
     * @return the status value.
     */
    public Status status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Set the status property: Status for a SessionHost.
     * 
     * @param status the status value to set.
     * @return the SessionHostInner object itself.
     */
    public SessionHostInner withStatus(Status status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SessionHostProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

    /**
     * Get the statusTimestamp property: The timestamp of the status.
     * 
     * @return the statusTimestamp value.
     */
    public OffsetDateTime statusTimestamp() {
        return this.innerProperties() == null ? null : this.innerProperties().statusTimestamp();
    }

    /**
     * Get the osVersion property: The version of the OS on the session host.
     * 
     * @return the osVersion value.
     */
    public String osVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().osVersion();
    }

    /**
     * Set the osVersion property: The version of the OS on the session host.
     * 
     * @param osVersion the osVersion value to set.
     * @return the SessionHostInner object itself.
     */
    public SessionHostInner withOsVersion(String osVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SessionHostProperties();
        }
        this.innerProperties().withOsVersion(osVersion);
        return this;
    }

    /**
     * Get the sxSStackVersion property: The version of the side by side stack on the session host.
     * 
     * @return the sxSStackVersion value.
     */
    public String sxSStackVersion() {
        return this.innerProperties() == null ? null : this.innerProperties().sxSStackVersion();
    }

    /**
     * Set the sxSStackVersion property: The version of the side by side stack on the session host.
     * 
     * @param sxSStackVersion the sxSStackVersion value to set.
     * @return the SessionHostInner object itself.
     */
    public SessionHostInner withSxSStackVersion(String sxSStackVersion) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SessionHostProperties();
        }
        this.innerProperties().withSxSStackVersion(sxSStackVersion);
        return this;
    }

    /**
     * Get the updateState property: Update state of a SessionHost.
     * 
     * @return the updateState value.
     */
    public UpdateState updateState() {
        return this.innerProperties() == null ? null : this.innerProperties().updateState();
    }

    /**
     * Set the updateState property: Update state of a SessionHost.
     * 
     * @param updateState the updateState value to set.
     * @return the SessionHostInner object itself.
     */
    public SessionHostInner withUpdateState(UpdateState updateState) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SessionHostProperties();
        }
        this.innerProperties().withUpdateState(updateState);
        return this;
    }

    /**
     * Get the lastUpdateTime property: The timestamp of the last update.
     * 
     * @return the lastUpdateTime value.
     */
    public OffsetDateTime lastUpdateTime() {
        return this.innerProperties() == null ? null : this.innerProperties().lastUpdateTime();
    }

    /**
     * Get the updateErrorMessage property: The error message.
     * 
     * @return the updateErrorMessage value.
     */
    public String updateErrorMessage() {
        return this.innerProperties() == null ? null : this.innerProperties().updateErrorMessage();
    }

    /**
     * Set the updateErrorMessage property: The error message.
     * 
     * @param updateErrorMessage the updateErrorMessage value to set.
     * @return the SessionHostInner object itself.
     */
    public SessionHostInner withUpdateErrorMessage(String updateErrorMessage) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SessionHostProperties();
        }
        this.innerProperties().withUpdateErrorMessage(updateErrorMessage);
        return this;
    }

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

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

                if ("id".equals(fieldName)) {
                    deserializedSessionHostInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedSessionHostInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedSessionHostInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedSessionHostInner.innerProperties = SessionHostProperties.fromJson(reader);
                } else if ("systemData".equals(fieldName)) {
                    deserializedSessionHostInner.systemData = SystemData.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSessionHostInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy