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

com.azure.resourcemanager.desktopvirtualization.fluent.models.WorkspaceInner 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.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.desktopvirtualization.models.PrivateEndpointConnection;
import com.azure.resourcemanager.desktopvirtualization.models.PublicNetworkAccess;
import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySet;
import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity;
import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan;
import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Represents a Workspace definition.
 */
@Fluent
public final class WorkspaceInner extends ResourceModelWithAllowedPropertySet {
    /*
     * Detailed properties for Workspace
     */
    private WorkspaceProperties innerProperties;

    /*
     * Azure Resource Manager metadata containing createdBy and modifiedBy information.
     */
    private SystemData systemData;

    /*
     * The etag field is *not* required. If it is provided in the response body, it must also be provided as a header
     * per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested
     * resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section
     * 14.26), and If-Range (section 14.27) header fields.
     */
    private String etag;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the innerProperties property: Detailed properties for Workspace.
     * 
     * @return the innerProperties value.
     */
    private WorkspaceProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
     * 
     * @return the systemData value.
     */
    @Override
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the etag property: The etag field is *not* required. If it is provided in the response body, it must also be
     * provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from
     * the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24),
     * If-None-Match (section 14.26), and If-Range (section 14.27) header fields.
     * 
     * @return the etag value.
     */
    @Override
    public String etag() {
        return this.etag;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public WorkspaceInner withManagedBy(String managedBy) {
        super.withManagedBy(managedBy);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public WorkspaceInner withKind(String kind) {
        super.withKind(kind);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public WorkspaceInner withIdentity(ResourceModelWithAllowedPropertySetIdentity identity) {
        super.withIdentity(identity);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public WorkspaceInner withSku(ResourceModelWithAllowedPropertySetSku sku) {
        super.withSku(sku);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public WorkspaceInner withPlan(ResourceModelWithAllowedPropertySetPlan plan) {
        super.withPlan(plan);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public WorkspaceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public WorkspaceInner withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the objectId property: ObjectId of Workspace. (internal use).
     * 
     * @return the objectId value.
     */
    public String objectId() {
        return this.innerProperties() == null ? null : this.innerProperties().objectId();
    }

    /**
     * Get the description property: Description of Workspace.
     * 
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Description of Workspace.
     * 
     * @param description the description value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the friendlyName property: Friendly name of Workspace.
     * 
     * @return the friendlyName value.
     */
    public String friendlyName() {
        return this.innerProperties() == null ? null : this.innerProperties().friendlyName();
    }

    /**
     * Set the friendlyName property: Friendly name of Workspace.
     * 
     * @param friendlyName the friendlyName value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withFriendlyName(String friendlyName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withFriendlyName(friendlyName);
        return this;
    }

    /**
     * Get the applicationGroupReferences property: List of applicationGroup resource Ids.
     * 
     * @return the applicationGroupReferences value.
     */
    public List applicationGroupReferences() {
        return this.innerProperties() == null ? null : this.innerProperties().applicationGroupReferences();
    }

    /**
     * Set the applicationGroupReferences property: List of applicationGroup resource Ids.
     * 
     * @param applicationGroupReferences the applicationGroupReferences value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withApplicationGroupReferences(List applicationGroupReferences) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withApplicationGroupReferences(applicationGroupReferences);
        return this;
    }

    /**
     * Get the cloudPcResource property: Is cloud pc resource.
     * 
     * @return the cloudPcResource value.
     */
    public Boolean cloudPcResource() {
        return this.innerProperties() == null ? null : this.innerProperties().cloudPcResource();
    }

    /**
     * Get the publicNetworkAccess property: Enabled allows this resource to be accessed from both public and private
     * networks, Disabled allows this resource to only be accessed via private endpoints.
     * 
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
    }

    /**
     * Set the publicNetworkAccess property: Enabled allows this resource to be accessed from both public and private
     * networks, Disabled allows this resource to only be accessed via private endpoints.
     * 
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the WorkspaceInner object itself.
     */
    public WorkspaceInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new WorkspaceProperties();
        }
        this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
        return this;
    }

    /**
     * Get the privateEndpointConnections property: List of private endpoint connection associated with the specified
     * resource.
     * 
     * @return the privateEndpointConnections value.
     */
    public List privateEndpointConnections() {
        return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections();
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("location", location());
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("managedBy", managedBy());
        jsonWriter.writeStringField("kind", kind());
        jsonWriter.writeJsonField("identity", identity());
        jsonWriter.writeJsonField("sku", sku());
        jsonWriter.writeJsonField("plan", plan());
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of WorkspaceInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of WorkspaceInner if the JsonReader was pointing to an instance of it, or null if it was
     * pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the WorkspaceInner.
     */
    public static WorkspaceInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            WorkspaceInner deserializedWorkspaceInner = new WorkspaceInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedWorkspaceInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedWorkspaceInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedWorkspaceInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedWorkspaceInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedWorkspaceInner.withTags(tags);
                } else if ("managedBy".equals(fieldName)) {
                    deserializedWorkspaceInner.withManagedBy(reader.getString());
                } else if ("kind".equals(fieldName)) {
                    deserializedWorkspaceInner.withKind(reader.getString());
                } else if ("etag".equals(fieldName)) {
                    deserializedWorkspaceInner.etag = reader.getString();
                } else if ("identity".equals(fieldName)) {
                    deserializedWorkspaceInner
                        .withIdentity(ResourceModelWithAllowedPropertySetIdentity.fromJson(reader));
                } else if ("sku".equals(fieldName)) {
                    deserializedWorkspaceInner.withSku(ResourceModelWithAllowedPropertySetSku.fromJson(reader));
                } else if ("plan".equals(fieldName)) {
                    deserializedWorkspaceInner.withPlan(ResourceModelWithAllowedPropertySetPlan.fromJson(reader));
                } else if ("systemData".equals(fieldName)) {
                    deserializedWorkspaceInner.systemData = SystemData.fromJson(reader);
                } else if ("properties".equals(fieldName)) {
                    deserializedWorkspaceInner.innerProperties = WorkspaceProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedWorkspaceInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy