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

com.azure.resourcemanager.desktopvirtualization.implementation.MsixPackagesImpl 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.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.desktopvirtualization.fluent.MsixPackagesClient;
import com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner;
import com.azure.resourcemanager.desktopvirtualization.models.MsixPackage;
import com.azure.resourcemanager.desktopvirtualization.models.MsixPackages;

public final class MsixPackagesImpl implements MsixPackages {
    private static final ClientLogger LOGGER = new ClientLogger(MsixPackagesImpl.class);

    private final MsixPackagesClient innerClient;

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

    public MsixPackagesImpl(MsixPackagesClient innerClient,
        com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public Response getWithResponse(String resourceGroupName, String hostPoolName,
        String msixPackageFullName, Context context) {
        Response inner
            = this.serviceClient().getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context);
        if (inner != null) {
            return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(),
                new MsixPackageImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public MsixPackage get(String resourceGroupName, String hostPoolName, String msixPackageFullName) {
        MsixPackageInner inner = this.serviceClient().get(resourceGroupName, hostPoolName, msixPackageFullName);
        if (inner != null) {
            return new MsixPackageImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response deleteWithResponse(String resourceGroupName, String hostPoolName, String msixPackageFullName,
        Context context) {
        return this.serviceClient().deleteWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context);
    }

    public void delete(String resourceGroupName, String hostPoolName, String msixPackageFullName) {
        this.serviceClient().delete(resourceGroupName, hostPoolName, msixPackageFullName);
    }

    public PagedIterable list(String resourceGroupName, String hostPoolName) {
        PagedIterable inner = this.serviceClient().list(resourceGroupName, hostPoolName);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new MsixPackageImpl(inner1, this.manager()));
    }

    public PagedIterable list(String resourceGroupName, String hostPoolName, Integer pageSize,
        Boolean isDescending, Integer initialSkip, Context context) {
        PagedIterable inner
            = this.serviceClient().list(resourceGroupName, hostPoolName, pageSize, isDescending, initialSkip, context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new MsixPackageImpl(inner1, this.manager()));
    }

    public MsixPackage getById(String id) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourcegroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id)));
        }
        String hostPoolName = ResourceManagerUtils.getValueFromIdByName(id, "hostPools");
        if (hostPoolName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id)));
        }
        String msixPackageFullName = ResourceManagerUtils.getValueFromIdByName(id, "msixPackages");
        if (msixPackageFullName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'msixPackages'.", id)));
        }
        return this.getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, Context.NONE).getValue();
    }

    public Response getByIdWithResponse(String id, Context context) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourcegroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id)));
        }
        String hostPoolName = ResourceManagerUtils.getValueFromIdByName(id, "hostPools");
        if (hostPoolName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id)));
        }
        String msixPackageFullName = ResourceManagerUtils.getValueFromIdByName(id, "msixPackages");
        if (msixPackageFullName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'msixPackages'.", id)));
        }
        return this.getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context);
    }

    public void deleteById(String id) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourcegroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id)));
        }
        String hostPoolName = ResourceManagerUtils.getValueFromIdByName(id, "hostPools");
        if (hostPoolName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id)));
        }
        String msixPackageFullName = ResourceManagerUtils.getValueFromIdByName(id, "msixPackages");
        if (msixPackageFullName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'msixPackages'.", id)));
        }
        this.deleteWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, Context.NONE);
    }

    public Response deleteByIdWithResponse(String id, Context context) {
        String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourcegroups");
        if (resourceGroupName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id)));
        }
        String hostPoolName = ResourceManagerUtils.getValueFromIdByName(id, "hostPools");
        if (hostPoolName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id)));
        }
        String msixPackageFullName = ResourceManagerUtils.getValueFromIdByName(id, "msixPackages");
        if (msixPackageFullName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'msixPackages'.", id)));
        }
        return this.deleteWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context);
    }

    private MsixPackagesClient serviceClient() {
        return this.innerClient;
    }

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

    public MsixPackageImpl define(String name) {
        return new MsixPackageImpl(name, this.manager());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy