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

com.azure.resourcemanager.healthdataaiservices.implementation.DeidServicesImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Health Data AI Services Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.resourcemanager.healthdataaiservices.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.healthdataaiservices.fluent.DeidServicesClient;
import com.azure.resourcemanager.healthdataaiservices.fluent.models.DeidServiceInner;
import com.azure.resourcemanager.healthdataaiservices.models.DeidService;
import com.azure.resourcemanager.healthdataaiservices.models.DeidServices;

public final class DeidServicesImpl implements DeidServices {
    private static final ClientLogger LOGGER = new ClientLogger(DeidServicesImpl.class);

    private final DeidServicesClient innerClient;

    private final com.azure.resourcemanager.healthdataaiservices.HealthDataAIServicesManager serviceManager;

    public DeidServicesImpl(DeidServicesClient innerClient,
        com.azure.resourcemanager.healthdataaiservices.HealthDataAIServicesManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

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

    public DeidService getByResourceGroup(String resourceGroupName, String deidServiceName) {
        DeidServiceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, deidServiceName);
        if (inner != null) {
            return new DeidServiceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
        PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new DeidServiceImpl(inner1, this.manager()));
    }

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

    public PagedIterable list(Context context) {
        PagedIterable inner = this.serviceClient().list(context);
        return ResourceManagerUtils.mapPage(inner, inner1 -> new DeidServiceImpl(inner1, this.manager()));
    }

    public void deleteByResourceGroup(String resourceGroupName, String deidServiceName) {
        this.serviceClient().delete(resourceGroupName, deidServiceName);
    }

    public void delete(String resourceGroupName, String deidServiceName, Context context) {
        this.serviceClient().delete(resourceGroupName, deidServiceName, context);
    }

    public DeidService 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 deidServiceName = ResourceManagerUtils.getValueFromIdByName(id, "deidServices");
        if (deidServiceName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'deidServices'.", id)));
        }
        return this.getByResourceGroupWithResponse(resourceGroupName, deidServiceName, 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 deidServiceName = ResourceManagerUtils.getValueFromIdByName(id, "deidServices");
        if (deidServiceName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'deidServices'.", id)));
        }
        return this.getByResourceGroupWithResponse(resourceGroupName, deidServiceName, 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 deidServiceName = ResourceManagerUtils.getValueFromIdByName(id, "deidServices");
        if (deidServiceName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'deidServices'.", id)));
        }
        this.delete(resourceGroupName, deidServiceName, Context.NONE);
    }

    public void 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 deidServiceName = ResourceManagerUtils.getValueFromIdByName(id, "deidServices");
        if (deidServiceName == null) {
            throw LOGGER.logExceptionAsError(new IllegalArgumentException(
                String.format("The resource ID '%s' is not valid. Missing path segment 'deidServices'.", id)));
        }
        this.delete(resourceGroupName, deidServiceName, context);
    }

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

    private com.azure.resourcemanager.healthdataaiservices.HealthDataAIServicesManager manager() {
        return this.serviceManager;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy