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

com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner 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.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.RegistrationTokenOperation;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

/**
 * Represents a RegistrationInfo definition.
 */
@Fluent
public final class RegistrationInfoInner implements JsonSerializable {
    /*
     * Expiration time of registration token.
     */
    private OffsetDateTime expirationTime;

    /*
     * The registration token base64 encoded string.
     */
    private String token;

    /*
     * The type of resetting the token.
     */
    private RegistrationTokenOperation registrationTokenOperation;

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

    /**
     * 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 RegistrationInfoInner object itself.
     */
    public RegistrationInfoInner 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 RegistrationInfoInner object itself.
     */
    public RegistrationInfoInner withToken(String token) {
        this.token = token;
        return this;
    }

    /**
     * Get the registrationTokenOperation property: The type of resetting the token.
     * 
     * @return the registrationTokenOperation value.
     */
    public RegistrationTokenOperation registrationTokenOperation() {
        return this.registrationTokenOperation;
    }

    /**
     * Set the registrationTokenOperation property: The type of resetting the token.
     * 
     * @param registrationTokenOperation the registrationTokenOperation value to set.
     * @return the RegistrationInfoInner object itself.
     */
    public RegistrationInfoInner withRegistrationTokenOperation(RegistrationTokenOperation registrationTokenOperation) {
        this.registrationTokenOperation = registrationTokenOperation;
        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);
        jsonWriter.writeStringField("registrationTokenOperation",
            this.registrationTokenOperation == null ? null : this.registrationTokenOperation.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("expirationTime".equals(fieldName)) {
                    deserializedRegistrationInfoInner.expirationTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("token".equals(fieldName)) {
                    deserializedRegistrationInfoInner.token = reader.getString();
                } else if ("registrationTokenOperation".equals(fieldName)) {
                    deserializedRegistrationInfoInner.registrationTokenOperation
                        = RegistrationTokenOperation.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedRegistrationInfoInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy