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

com.azure.resourcemanager.desktopvirtualization.models.AppAttachPackageProperties 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * Schema for App Attach Package properties.
 */
@Fluent
public final class AppAttachPackageProperties implements JsonSerializable {
    /*
     * The provisioning state of the App Attach Package.
     */
    private ProvisioningState provisioningState;

    /*
     * Detailed properties for App Attach Package
     */
    private AppAttachPackageInfoProperties image;

    /*
     * List of Hostpool resource Ids.
     */
    private List hostPoolReferences;

    /*
     * URL path to certificate name located in keyVault
     */
    private String keyVaultUrl;

    /*
     * Parameter indicating how the health check should behave if this package fails staging
     */
    private FailHealthCheckOnStagingFailure failHealthCheckOnStagingFailure;

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

    /**
     * Get the provisioningState property: The provisioning state of the App Attach Package.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the image property: Detailed properties for App Attach Package.
     * 
     * @return the image value.
     */
    public AppAttachPackageInfoProperties image() {
        return this.image;
    }

    /**
     * Set the image property: Detailed properties for App Attach Package.
     * 
     * @param image the image value to set.
     * @return the AppAttachPackageProperties object itself.
     */
    public AppAttachPackageProperties withImage(AppAttachPackageInfoProperties image) {
        this.image = image;
        return this;
    }

    /**
     * Get the hostPoolReferences property: List of Hostpool resource Ids.
     * 
     * @return the hostPoolReferences value.
     */
    public List hostPoolReferences() {
        return this.hostPoolReferences;
    }

    /**
     * Set the hostPoolReferences property: List of Hostpool resource Ids.
     * 
     * @param hostPoolReferences the hostPoolReferences value to set.
     * @return the AppAttachPackageProperties object itself.
     */
    public AppAttachPackageProperties withHostPoolReferences(List hostPoolReferences) {
        this.hostPoolReferences = hostPoolReferences;
        return this;
    }

    /**
     * Get the keyVaultUrl property: URL path to certificate name located in keyVault.
     * 
     * @return the keyVaultUrl value.
     */
    public String keyVaultUrl() {
        return this.keyVaultUrl;
    }

    /**
     * Set the keyVaultUrl property: URL path to certificate name located in keyVault.
     * 
     * @param keyVaultUrl the keyVaultUrl value to set.
     * @return the AppAttachPackageProperties object itself.
     */
    public AppAttachPackageProperties withKeyVaultUrl(String keyVaultUrl) {
        this.keyVaultUrl = keyVaultUrl;
        return this;
    }

    /**
     * Get the failHealthCheckOnStagingFailure property: Parameter indicating how the health check should behave if this
     * package fails staging.
     * 
     * @return the failHealthCheckOnStagingFailure value.
     */
    public FailHealthCheckOnStagingFailure failHealthCheckOnStagingFailure() {
        return this.failHealthCheckOnStagingFailure;
    }

    /**
     * Set the failHealthCheckOnStagingFailure property: Parameter indicating how the health check should behave if this
     * package fails staging.
     * 
     * @param failHealthCheckOnStagingFailure the failHealthCheckOnStagingFailure value to set.
     * @return the AppAttachPackageProperties object itself.
     */
    public AppAttachPackageProperties
        withFailHealthCheckOnStagingFailure(FailHealthCheckOnStagingFailure failHealthCheckOnStagingFailure) {
        this.failHealthCheckOnStagingFailure = failHealthCheckOnStagingFailure;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (image() != null) {
            image().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("image", this.image);
        jsonWriter.writeArrayField("hostPoolReferences", this.hostPoolReferences,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("keyVaultURL", this.keyVaultUrl);
        jsonWriter.writeStringField("failHealthCheckOnStagingFailure",
            this.failHealthCheckOnStagingFailure == null ? null : this.failHealthCheckOnStagingFailure.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("provisioningState".equals(fieldName)) {
                    deserializedAppAttachPackageProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("image".equals(fieldName)) {
                    deserializedAppAttachPackageProperties.image = AppAttachPackageInfoProperties.fromJson(reader);
                } else if ("hostPoolReferences".equals(fieldName)) {
                    List hostPoolReferences = reader.readArray(reader1 -> reader1.getString());
                    deserializedAppAttachPackageProperties.hostPoolReferences = hostPoolReferences;
                } else if ("keyVaultURL".equals(fieldName)) {
                    deserializedAppAttachPackageProperties.keyVaultUrl = reader.getString();
                } else if ("failHealthCheckOnStagingFailure".equals(fieldName)) {
                    deserializedAppAttachPackageProperties.failHealthCheckOnStagingFailure
                        = FailHealthCheckOnStagingFailure.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAppAttachPackageProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy