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

com.azure.resourcemanager.desktopvirtualization.implementation.HostPoolImpl 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.implementation;

import com.azure.core.http.rest.Response;
import com.azure.core.management.Region;
import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.desktopvirtualization.fluent.models.HostPoolInner;
import com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner;
import com.azure.resourcemanager.desktopvirtualization.models.AgentUpdatePatchProperties;
import com.azure.resourcemanager.desktopvirtualization.models.AgentUpdateProperties;
import com.azure.resourcemanager.desktopvirtualization.models.HostPool;
import com.azure.resourcemanager.desktopvirtualization.models.HostPoolPatch;
import com.azure.resourcemanager.desktopvirtualization.models.HostpoolPublicNetworkAccess;
import com.azure.resourcemanager.desktopvirtualization.models.HostPoolType;
import com.azure.resourcemanager.desktopvirtualization.models.LoadBalancerType;
import com.azure.resourcemanager.desktopvirtualization.models.PersonalDesktopAssignmentType;
import com.azure.resourcemanager.desktopvirtualization.models.PreferredAppGroupType;
import com.azure.resourcemanager.desktopvirtualization.models.PrivateEndpointConnection;
import com.azure.resourcemanager.desktopvirtualization.models.RegistrationInfo;
import com.azure.resourcemanager.desktopvirtualization.models.RegistrationInfoPatch;
import com.azure.resourcemanager.desktopvirtualization.models.RegistrationTokenList;
import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity;
import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan;
import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku;
import com.azure.resourcemanager.desktopvirtualization.models.SsoSecretType;
import java.util.Collections;
import java.util.List;
import java.util.Map;

public final class HostPoolImpl implements HostPool, HostPool.Definition, HostPool.Update {
    private HostPoolInner innerObject;

    private final com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager serviceManager;

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public String location() {
        return this.innerModel().location();
    }

    public Map tags() {
        Map inner = this.innerModel().tags();
        if (inner != null) {
            return Collections.unmodifiableMap(inner);
        } else {
            return Collections.emptyMap();
        }
    }

    public String managedBy() {
        return this.innerModel().managedBy();
    }

    public String kind() {
        return this.innerModel().kind();
    }

    public String etag() {
        return this.innerModel().etag();
    }

    public ResourceModelWithAllowedPropertySetIdentity identity() {
        return this.innerModel().identity();
    }

    public ResourceModelWithAllowedPropertySetSku sku() {
        return this.innerModel().sku();
    }

    public ResourceModelWithAllowedPropertySetPlan plan() {
        return this.innerModel().plan();
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public String objectId() {
        return this.innerModel().objectId();
    }

    public String friendlyName() {
        return this.innerModel().friendlyName();
    }

    public String description() {
        return this.innerModel().description();
    }

    public HostPoolType hostPoolType() {
        return this.innerModel().hostPoolType();
    }

    public PersonalDesktopAssignmentType personalDesktopAssignmentType() {
        return this.innerModel().personalDesktopAssignmentType();
    }

    public String customRdpProperty() {
        return this.innerModel().customRdpProperty();
    }

    public Integer maxSessionLimit() {
        return this.innerModel().maxSessionLimit();
    }

    public LoadBalancerType loadBalancerType() {
        return this.innerModel().loadBalancerType();
    }

    public Integer ring() {
        return this.innerModel().ring();
    }

    public Boolean validationEnvironment() {
        return this.innerModel().validationEnvironment();
    }

    public RegistrationInfo registrationInfo() {
        RegistrationInfoInner inner = this.innerModel().registrationInfo();
        if (inner != null) {
            return new RegistrationInfoImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public String vmTemplate() {
        return this.innerModel().vmTemplate();
    }

    public List applicationGroupReferences() {
        List inner = this.innerModel().applicationGroupReferences();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public List appAttachPackageReferences() {
        List inner = this.innerModel().appAttachPackageReferences();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public String ssoadfsAuthority() {
        return this.innerModel().ssoadfsAuthority();
    }

    public String ssoClientId() {
        return this.innerModel().ssoClientId();
    }

    public String ssoClientSecretKeyVaultPath() {
        return this.innerModel().ssoClientSecretKeyVaultPath();
    }

    public SsoSecretType ssoSecretType() {
        return this.innerModel().ssoSecretType();
    }

    public PreferredAppGroupType preferredAppGroupType() {
        return this.innerModel().preferredAppGroupType();
    }

    public Boolean startVMOnConnect() {
        return this.innerModel().startVMOnConnect();
    }

    public Boolean cloudPcResource() {
        return this.innerModel().cloudPcResource();
    }

    public HostpoolPublicNetworkAccess publicNetworkAccess() {
        return this.innerModel().publicNetworkAccess();
    }

    public AgentUpdateProperties agentUpdate() {
        return this.innerModel().agentUpdate();
    }

    public List privateEndpointConnections() {
        List inner = this.innerModel().privateEndpointConnections();
        if (inner != null) {
            return Collections.unmodifiableList(inner);
        } else {
            return Collections.emptyList();
        }
    }

    public Region region() {
        return Region.fromName(this.regionName());
    }

    public String regionName() {
        return this.location();
    }

    public String resourceGroupName() {
        return resourceGroupName;
    }

    public HostPoolInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String hostPoolName;

    private HostPoolPatch updateHostPool;

    public HostPoolImpl withExistingResourceGroup(String resourceGroupName) {
        this.resourceGroupName = resourceGroupName;
        return this;
    }

    public HostPool create() {
        this.innerObject = serviceManager.serviceClient()
            .getHostPools()
            .createOrUpdateWithResponse(resourceGroupName, hostPoolName, this.innerModel(), Context.NONE)
            .getValue();
        return this;
    }

    public HostPool create(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getHostPools()
            .createOrUpdateWithResponse(resourceGroupName, hostPoolName, this.innerModel(), context)
            .getValue();
        return this;
    }

    HostPoolImpl(String name,
        com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager serviceManager) {
        this.innerObject = new HostPoolInner();
        this.serviceManager = serviceManager;
        this.hostPoolName = name;
    }

    public HostPoolImpl update() {
        this.updateHostPool = new HostPoolPatch();
        return this;
    }

    public HostPool apply() {
        this.innerObject = serviceManager.serviceClient()
            .getHostPools()
            .updateWithResponse(resourceGroupName, hostPoolName, updateHostPool, Context.NONE)
            .getValue();
        return this;
    }

    public HostPool apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getHostPools()
            .updateWithResponse(resourceGroupName, hostPoolName, updateHostPool, context)
            .getValue();
        return this;
    }

    HostPoolImpl(HostPoolInner innerObject,
        com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
        this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups");
        this.hostPoolName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "hostPools");
    }

    public HostPool refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getHostPools()
            .getByResourceGroupWithResponse(resourceGroupName, hostPoolName, Context.NONE)
            .getValue();
        return this;
    }

    public HostPool refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getHostPools()
            .getByResourceGroupWithResponse(resourceGroupName, hostPoolName, context)
            .getValue();
        return this;
    }

    public Response retrieveRegistrationTokenWithResponse(Context context) {
        return serviceManager.hostPools()
            .retrieveRegistrationTokenWithResponse(resourceGroupName, hostPoolName, context);
    }

    public RegistrationInfo retrieveRegistrationToken() {
        return serviceManager.hostPools().retrieveRegistrationToken(resourceGroupName, hostPoolName);
    }

    public Response listRegistrationTokensWithResponse(Context context) {
        return serviceManager.hostPools().listRegistrationTokensWithResponse(resourceGroupName, hostPoolName, context);
    }

    public RegistrationTokenList listRegistrationTokens() {
        return serviceManager.hostPools().listRegistrationTokens(resourceGroupName, hostPoolName);
    }

    public HostPoolImpl withRegion(Region location) {
        this.innerModel().withLocation(location.toString());
        return this;
    }

    public HostPoolImpl withRegion(String location) {
        this.innerModel().withLocation(location);
        return this;
    }

    public HostPoolImpl withHostPoolType(HostPoolType hostPoolType) {
        this.innerModel().withHostPoolType(hostPoolType);
        return this;
    }

    public HostPoolImpl withLoadBalancerType(LoadBalancerType loadBalancerType) {
        if (isInCreateMode()) {
            this.innerModel().withLoadBalancerType(loadBalancerType);
            return this;
        } else {
            this.updateHostPool.withLoadBalancerType(loadBalancerType);
            return this;
        }
    }

    public HostPoolImpl withPreferredAppGroupType(PreferredAppGroupType preferredAppGroupType) {
        if (isInCreateMode()) {
            this.innerModel().withPreferredAppGroupType(preferredAppGroupType);
            return this;
        } else {
            this.updateHostPool.withPreferredAppGroupType(preferredAppGroupType);
            return this;
        }
    }

    public HostPoolImpl withTags(Map tags) {
        if (isInCreateMode()) {
            this.innerModel().withTags(tags);
            return this;
        } else {
            this.updateHostPool.withTags(tags);
            return this;
        }
    }

    public HostPoolImpl withManagedBy(String managedBy) {
        this.innerModel().withManagedBy(managedBy);
        return this;
    }

    public HostPoolImpl withKind(String kind) {
        this.innerModel().withKind(kind);
        return this;
    }

    public HostPoolImpl withIdentity(ResourceModelWithAllowedPropertySetIdentity identity) {
        this.innerModel().withIdentity(identity);
        return this;
    }

    public HostPoolImpl withSku(ResourceModelWithAllowedPropertySetSku sku) {
        this.innerModel().withSku(sku);
        return this;
    }

    public HostPoolImpl withPlan(ResourceModelWithAllowedPropertySetPlan plan) {
        this.innerModel().withPlan(plan);
        return this;
    }

    public HostPoolImpl withFriendlyName(String friendlyName) {
        if (isInCreateMode()) {
            this.innerModel().withFriendlyName(friendlyName);
            return this;
        } else {
            this.updateHostPool.withFriendlyName(friendlyName);
            return this;
        }
    }

    public HostPoolImpl withDescription(String description) {
        if (isInCreateMode()) {
            this.innerModel().withDescription(description);
            return this;
        } else {
            this.updateHostPool.withDescription(description);
            return this;
        }
    }

    public HostPoolImpl withPersonalDesktopAssignmentType(PersonalDesktopAssignmentType personalDesktopAssignmentType) {
        if (isInCreateMode()) {
            this.innerModel().withPersonalDesktopAssignmentType(personalDesktopAssignmentType);
            return this;
        } else {
            this.updateHostPool.withPersonalDesktopAssignmentType(personalDesktopAssignmentType);
            return this;
        }
    }

    public HostPoolImpl withCustomRdpProperty(String customRdpProperty) {
        if (isInCreateMode()) {
            this.innerModel().withCustomRdpProperty(customRdpProperty);
            return this;
        } else {
            this.updateHostPool.withCustomRdpProperty(customRdpProperty);
            return this;
        }
    }

    public HostPoolImpl withMaxSessionLimit(Integer maxSessionLimit) {
        if (isInCreateMode()) {
            this.innerModel().withMaxSessionLimit(maxSessionLimit);
            return this;
        } else {
            this.updateHostPool.withMaxSessionLimit(maxSessionLimit);
            return this;
        }
    }

    public HostPoolImpl withRing(Integer ring) {
        if (isInCreateMode()) {
            this.innerModel().withRing(ring);
            return this;
        } else {
            this.updateHostPool.withRing(ring);
            return this;
        }
    }

    public HostPoolImpl withValidationEnvironment(Boolean validationEnvironment) {
        if (isInCreateMode()) {
            this.innerModel().withValidationEnvironment(validationEnvironment);
            return this;
        } else {
            this.updateHostPool.withValidationEnvironment(validationEnvironment);
            return this;
        }
    }

    public HostPoolImpl withRegistrationInfo(RegistrationInfoInner registrationInfo) {
        this.innerModel().withRegistrationInfo(registrationInfo);
        return this;
    }

    public HostPoolImpl withVmTemplate(String vmTemplate) {
        if (isInCreateMode()) {
            this.innerModel().withVmTemplate(vmTemplate);
            return this;
        } else {
            this.updateHostPool.withVmTemplate(vmTemplate);
            return this;
        }
    }

    public HostPoolImpl withSsoadfsAuthority(String ssoadfsAuthority) {
        if (isInCreateMode()) {
            this.innerModel().withSsoadfsAuthority(ssoadfsAuthority);
            return this;
        } else {
            this.updateHostPool.withSsoadfsAuthority(ssoadfsAuthority);
            return this;
        }
    }

    public HostPoolImpl withSsoClientId(String ssoClientId) {
        if (isInCreateMode()) {
            this.innerModel().withSsoClientId(ssoClientId);
            return this;
        } else {
            this.updateHostPool.withSsoClientId(ssoClientId);
            return this;
        }
    }

    public HostPoolImpl withSsoClientSecretKeyVaultPath(String ssoClientSecretKeyVaultPath) {
        if (isInCreateMode()) {
            this.innerModel().withSsoClientSecretKeyVaultPath(ssoClientSecretKeyVaultPath);
            return this;
        } else {
            this.updateHostPool.withSsoClientSecretKeyVaultPath(ssoClientSecretKeyVaultPath);
            return this;
        }
    }

    public HostPoolImpl withSsoSecretType(SsoSecretType ssoSecretType) {
        if (isInCreateMode()) {
            this.innerModel().withSsoSecretType(ssoSecretType);
            return this;
        } else {
            this.updateHostPool.withSsoSecretType(ssoSecretType);
            return this;
        }
    }

    public HostPoolImpl withStartVMOnConnect(Boolean startVMOnConnect) {
        if (isInCreateMode()) {
            this.innerModel().withStartVMOnConnect(startVMOnConnect);
            return this;
        } else {
            this.updateHostPool.withStartVMOnConnect(startVMOnConnect);
            return this;
        }
    }

    public HostPoolImpl withPublicNetworkAccess(HostpoolPublicNetworkAccess publicNetworkAccess) {
        if (isInCreateMode()) {
            this.innerModel().withPublicNetworkAccess(publicNetworkAccess);
            return this;
        } else {
            this.updateHostPool.withPublicNetworkAccess(publicNetworkAccess);
            return this;
        }
    }

    public HostPoolImpl withAgentUpdate(AgentUpdateProperties agentUpdate) {
        this.innerModel().withAgentUpdate(agentUpdate);
        return this;
    }

    public HostPoolImpl withRegistrationInfo(RegistrationInfoPatch registrationInfo) {
        this.updateHostPool.withRegistrationInfo(registrationInfo);
        return this;
    }

    public HostPoolImpl withAgentUpdate(AgentUpdatePatchProperties agentUpdate) {
        this.updateHostPool.withAgentUpdate(agentUpdate);
        return this;
    }

    private boolean isInCreateMode() {
        return this.innerModel().id() == null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy