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

com.azure.resourcemanager.desktopvirtualization.models.RegistrationInfoPatch 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.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 RegistrationInfo definition.
 */
@Fluent
public final class RegistrationInfoPatch implements JsonSerializable {
    /*
     * Expiration time of registration token.
     */
    private OffsetDateTime expirationTime;

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

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

    /**
     * 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 RegistrationInfoPatch object itself.
     */
    public RegistrationInfoPatch withExpirationTime(OffsetDateTime expirationTime) {
        this.expirationTime = expirationTime;
        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 RegistrationInfoPatch object itself.
     */
    public RegistrationInfoPatch 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("registrationTokenOperation",
            this.registrationTokenOperation == null ? null : this.registrationTokenOperation.toString());
        return jsonWriter.writeEndObject();
    }

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

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

            return deserializedRegistrationInfoPatch;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy