![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.desktopvirtualization.models.RegistrationTokenMinimal 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.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 java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* Represents a Minimal set of properties for RegistrationToken definition.
*/
@Fluent
public final class RegistrationTokenMinimal implements JsonSerializable {
/*
* Expiration time of registration token.
*/
private OffsetDateTime expirationTime;
/*
* The registration token base64 encoded string.
*/
private String token;
/**
* Creates an instance of RegistrationTokenMinimal class.
*/
public RegistrationTokenMinimal() {
}
/**
* Get the expirationTime property: Expiration time of registration token.
*
* @return the expirationTime value.
*/
public OffsetDateTime expirationTime() {
return this.expirationTime;
}
/**
* Set the expirationTime property: Expiration time of registration token.
*
* @param expirationTime the expirationTime value to set.
* @return the RegistrationTokenMinimal object itself.
*/
public RegistrationTokenMinimal withExpirationTime(OffsetDateTime expirationTime) {
this.expirationTime = expirationTime;
return this;
}
/**
* Get the token property: The registration token base64 encoded string.
*
* @return the token value.
*/
public String token() {
return this.token;
}
/**
* Set the token property: The registration token base64 encoded string.
*
* @param token the token value to set.
* @return the RegistrationTokenMinimal object itself.
*/
public RegistrationTokenMinimal withToken(String token) {
this.token = token;
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("expirationTime",
this.expirationTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.expirationTime));
jsonWriter.writeStringField("token", this.token);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of RegistrationTokenMinimal from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of RegistrationTokenMinimal 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 RegistrationTokenMinimal.
*/
public static RegistrationTokenMinimal fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
RegistrationTokenMinimal deserializedRegistrationTokenMinimal = new RegistrationTokenMinimal();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("expirationTime".equals(fieldName)) {
deserializedRegistrationTokenMinimal.expirationTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("token".equals(fieldName)) {
deserializedRegistrationTokenMinimal.token = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedRegistrationTokenMinimal;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy