![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.desktopvirtualization.fluent.models.UserSessionProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-desktopvirtualization Show documentation
Show all versions of azure-resourcemanager-desktopvirtualization Show documentation
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.util.CoreUtils;
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.models.ApplicationType;
import com.azure.resourcemanager.desktopvirtualization.models.SessionState;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* Schema for UserSession properties.
*/
@Fluent
public final class UserSessionProperties implements JsonSerializable {
/*
* ObjectId of user session. (internal use)
*/
private String objectId;
/*
* The user principal name.
*/
private String userPrincipalName;
/*
* Application type of application.
*/
private ApplicationType applicationType;
/*
* State of user session.
*/
private SessionState sessionState;
/*
* The active directory user name.
*/
private String activeDirectoryUsername;
/*
* The timestamp of the user session create.
*/
private OffsetDateTime createTime;
/**
* Creates an instance of UserSessionProperties class.
*/
public UserSessionProperties() {
}
/**
* Get the objectId property: ObjectId of user session. (internal use).
*
* @return the objectId value.
*/
public String objectId() {
return this.objectId;
}
/**
* Get the userPrincipalName property: The user principal name.
*
* @return the userPrincipalName value.
*/
public String userPrincipalName() {
return this.userPrincipalName;
}
/**
* Set the userPrincipalName property: The user principal name.
*
* @param userPrincipalName the userPrincipalName value to set.
* @return the UserSessionProperties object itself.
*/
public UserSessionProperties withUserPrincipalName(String userPrincipalName) {
this.userPrincipalName = userPrincipalName;
return this;
}
/**
* Get the applicationType property: Application type of application.
*
* @return the applicationType value.
*/
public ApplicationType applicationType() {
return this.applicationType;
}
/**
* Set the applicationType property: Application type of application.
*
* @param applicationType the applicationType value to set.
* @return the UserSessionProperties object itself.
*/
public UserSessionProperties withApplicationType(ApplicationType applicationType) {
this.applicationType = applicationType;
return this;
}
/**
* Get the sessionState property: State of user session.
*
* @return the sessionState value.
*/
public SessionState sessionState() {
return this.sessionState;
}
/**
* Set the sessionState property: State of user session.
*
* @param sessionState the sessionState value to set.
* @return the UserSessionProperties object itself.
*/
public UserSessionProperties withSessionState(SessionState sessionState) {
this.sessionState = sessionState;
return this;
}
/**
* Get the activeDirectoryUsername property: The active directory user name.
*
* @return the activeDirectoryUsername value.
*/
public String activeDirectoryUsername() {
return this.activeDirectoryUsername;
}
/**
* Set the activeDirectoryUsername property: The active directory user name.
*
* @param activeDirectoryUsername the activeDirectoryUsername value to set.
* @return the UserSessionProperties object itself.
*/
public UserSessionProperties withActiveDirectoryUsername(String activeDirectoryUsername) {
this.activeDirectoryUsername = activeDirectoryUsername;
return this;
}
/**
* Get the createTime property: The timestamp of the user session create.
*
* @return the createTime value.
*/
public OffsetDateTime createTime() {
return this.createTime;
}
/**
* Set the createTime property: The timestamp of the user session create.
*
* @param createTime the createTime value to set.
* @return the UserSessionProperties object itself.
*/
public UserSessionProperties withCreateTime(OffsetDateTime createTime) {
this.createTime = createTime;
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.writeStringField("userPrincipalName", this.userPrincipalName);
jsonWriter.writeStringField("applicationType",
this.applicationType == null ? null : this.applicationType.toString());
jsonWriter.writeStringField("sessionState", this.sessionState == null ? null : this.sessionState.toString());
jsonWriter.writeStringField("activeDirectoryUserName", this.activeDirectoryUsername);
jsonWriter.writeStringField("createTime",
this.createTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createTime));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of UserSessionProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of UserSessionProperties 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 UserSessionProperties.
*/
public static UserSessionProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
UserSessionProperties deserializedUserSessionProperties = new UserSessionProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("objectId".equals(fieldName)) {
deserializedUserSessionProperties.objectId = reader.getString();
} else if ("userPrincipalName".equals(fieldName)) {
deserializedUserSessionProperties.userPrincipalName = reader.getString();
} else if ("applicationType".equals(fieldName)) {
deserializedUserSessionProperties.applicationType = ApplicationType.fromString(reader.getString());
} else if ("sessionState".equals(fieldName)) {
deserializedUserSessionProperties.sessionState = SessionState.fromString(reader.getString());
} else if ("activeDirectoryUserName".equals(fieldName)) {
deserializedUserSessionProperties.activeDirectoryUsername = reader.getString();
} else if ("createTime".equals(fieldName)) {
deserializedUserSessionProperties.createTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else {
reader.skipChildren();
}
}
return deserializedUserSessionProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy