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

com.azure.resourcemanager.azurestackhci.implementation.EdgeDevicesImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for AzureStackHci Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. 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.azurestackhci.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.azurestackhci.fluent.EdgeDevicesClient;
import com.azure.resourcemanager.azurestackhci.fluent.models.EdgeDeviceInner;
import com.azure.resourcemanager.azurestackhci.fluent.models.ValidateResponseInner;
import com.azure.resourcemanager.azurestackhci.models.EdgeDevice;
import com.azure.resourcemanager.azurestackhci.models.EdgeDevices;
import com.azure.resourcemanager.azurestackhci.models.ValidateRequest;
import com.azure.resourcemanager.azurestackhci.models.ValidateResponse;

public final class EdgeDevicesImpl implements EdgeDevices {
    private static final ClientLogger LOGGER = new ClientLogger(EdgeDevicesImpl.class);

    private final EdgeDevicesClient innerClient;

    private final com.azure.resourcemanager.azurestackhci.AzureStackHciManager serviceManager;

    public EdgeDevicesImpl(EdgeDevicesClient innerClient,
        com.azure.resourcemanager.azurestackhci.AzureStackHciManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

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

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

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

    public EdgeDevice get(String resourceUri, String edgeDeviceName) {
        EdgeDeviceInner inner = this.serviceClient().get(resourceUri, edgeDeviceName);
        if (inner != null) {
            return new EdgeDeviceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public EdgeDevice createOrUpdate(String resourceUri, String edgeDeviceName, EdgeDeviceInner resource) {
        EdgeDeviceInner inner = this.serviceClient().createOrUpdate(resourceUri, edgeDeviceName, resource);
        if (inner != null) {
            return new EdgeDeviceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public EdgeDevice createOrUpdate(String resourceUri, String edgeDeviceName, EdgeDeviceInner resource,
        Context context) {
        EdgeDeviceInner inner = this.serviceClient().createOrUpdate(resourceUri, edgeDeviceName, resource, context);
        if (inner != null) {
            return new EdgeDeviceImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public void deleteByResourceGroup(String resourceUri, String edgeDeviceName) {
        this.serviceClient().delete(resourceUri, edgeDeviceName);
    }

    public void delete(String resourceUri, String edgeDeviceName, Context context) {
        this.serviceClient().delete(resourceUri, edgeDeviceName, context);
    }

    public ValidateResponse validate(String resourceUri, String edgeDeviceName, ValidateRequest validateRequest) {
        ValidateResponseInner inner = this.serviceClient().validate(resourceUri, edgeDeviceName, validateRequest);
        if (inner != null) {
            return new ValidateResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public ValidateResponse validate(String resourceUri, String edgeDeviceName, ValidateRequest validateRequest,
        Context context) {
        ValidateResponseInner inner
            = this.serviceClient().validate(resourceUri, edgeDeviceName, validateRequest, context);
        if (inner != null) {
            return new ValidateResponseImpl(inner, this.manager());
        } else {
            return null;
        }
    }

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

    private com.azure.resourcemanager.azurestackhci.AzureStackHciManager manager() {
        return this.serviceManager;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy