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

com.azure.resourcemanager.desktopvirtualization.implementation.MsixPackageImpl 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.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner;
import com.azure.resourcemanager.desktopvirtualization.models.MsixPackage;
import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageApplications;
import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageDependencies;
import com.azure.resourcemanager.desktopvirtualization.models.MsixPackagePatch;
import java.time.OffsetDateTime;
import java.util.Collections;
import java.util.List;

public final class MsixPackageImpl implements MsixPackage, MsixPackage.Definition, MsixPackage.Update {
    private MsixPackageInner 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 SystemData systemData() {
        return this.innerModel().systemData();
    }

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

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

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

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

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

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

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

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

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

    public OffsetDateTime lastUpdated() {
        return this.innerModel().lastUpdated();
    }

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

    public String resourceGroupName() {
        return resourceGroupName;
    }

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

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

    private String resourceGroupName;

    private String hostPoolName;

    private String msixPackageFullName;

    private MsixPackagePatch updateMsixPackage;

    public MsixPackageImpl withExistingHostPool(String resourceGroupName, String hostPoolName) {
        this.resourceGroupName = resourceGroupName;
        this.hostPoolName = hostPoolName;
        return this;
    }

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

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

    MsixPackageImpl(String name,
        com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager serviceManager) {
        this.innerObject = new MsixPackageInner();
        this.serviceManager = serviceManager;
        this.msixPackageFullName = name;
    }

    public MsixPackageImpl update() {
        this.updateMsixPackage = new MsixPackagePatch();
        return this;
    }

    public MsixPackage apply() {
        this.innerObject = serviceManager.serviceClient()
            .getMsixPackages()
            .updateWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, updateMsixPackage, Context.NONE)
            .getValue();
        return this;
    }

    public MsixPackage apply(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getMsixPackages()
            .updateWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, updateMsixPackage, context)
            .getValue();
        return this;
    }

    MsixPackageImpl(MsixPackageInner 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");
        this.msixPackageFullName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "msixPackages");
    }

    public MsixPackage refresh() {
        this.innerObject = serviceManager.serviceClient()
            .getMsixPackages()
            .getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, Context.NONE)
            .getValue();
        return this;
    }

    public MsixPackage refresh(Context context) {
        this.innerObject = serviceManager.serviceClient()
            .getMsixPackages()
            .getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context)
            .getValue();
        return this;
    }

    public MsixPackageImpl withImagePath(String imagePath) {
        this.innerModel().withImagePath(imagePath);
        return this;
    }

    public MsixPackageImpl withPackageName(String packageName) {
        this.innerModel().withPackageName(packageName);
        return this;
    }

    public MsixPackageImpl withPackageFamilyName(String packageFamilyName) {
        this.innerModel().withPackageFamilyName(packageFamilyName);
        return this;
    }

    public MsixPackageImpl withDisplayName(String displayName) {
        if (isInCreateMode()) {
            this.innerModel().withDisplayName(displayName);
            return this;
        } else {
            this.updateMsixPackage.withDisplayName(displayName);
            return this;
        }
    }

    public MsixPackageImpl withPackageRelativePath(String packageRelativePath) {
        this.innerModel().withPackageRelativePath(packageRelativePath);
        return this;
    }

    public MsixPackageImpl withIsRegularRegistration(Boolean isRegularRegistration) {
        if (isInCreateMode()) {
            this.innerModel().withIsRegularRegistration(isRegularRegistration);
            return this;
        } else {
            this.updateMsixPackage.withIsRegularRegistration(isRegularRegistration);
            return this;
        }
    }

    public MsixPackageImpl withIsActive(Boolean isActive) {
        if (isInCreateMode()) {
            this.innerModel().withIsActive(isActive);
            return this;
        } else {
            this.updateMsixPackage.withIsActive(isActive);
            return this;
        }
    }

    public MsixPackageImpl withPackageDependencies(List packageDependencies) {
        this.innerModel().withPackageDependencies(packageDependencies);
        return this;
    }

    public MsixPackageImpl withVersion(String version) {
        this.innerModel().withVersion(version);
        return this;
    }

    public MsixPackageImpl withLastUpdated(OffsetDateTime lastUpdated) {
        this.innerModel().withLastUpdated(lastUpdated);
        return this;
    }

    public MsixPackageImpl withPackageApplications(List packageApplications) {
        this.innerModel().withPackageApplications(packageApplications);
        return this;
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy