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

com.azure.resourcemanager.applicationinsights.implementation.AnalyticsItemsImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for ApplicationInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Composite Swagger for Application Insights Management Client. Package tag package-2022-04-01.

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.applicationinsights.implementation;

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.applicationinsights.fluent.AnalyticsItemsClient;
import com.azure.resourcemanager.applicationinsights.fluent.models.ApplicationInsightsComponentAnalyticsItemInner;
import com.azure.resourcemanager.applicationinsights.models.AnalyticsItems;
import com.azure.resourcemanager.applicationinsights.models.ApplicationInsightsComponentAnalyticsItem;
import com.azure.resourcemanager.applicationinsights.models.ItemScope;
import com.azure.resourcemanager.applicationinsights.models.ItemScopePath;
import com.azure.resourcemanager.applicationinsights.models.ItemTypeParameter;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public final class AnalyticsItemsImpl implements AnalyticsItems {
    private static final ClientLogger LOGGER = new ClientLogger(AnalyticsItemsImpl.class);

    private final AnalyticsItemsClient innerClient;

    private final com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager;

    public AnalyticsItemsImpl(
        AnalyticsItemsClient innerClient,
        com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager) {
        this.innerClient = innerClient;
        this.serviceManager = serviceManager;
    }

    public List list(
        String resourceGroupName, String resourceName, ItemScopePath scopePath) {
        List inner =
            this.serviceClient().list(resourceGroupName, resourceName, scopePath);
        if (inner != null) {
            return Collections
                .unmodifiableList(
                    inner
                        .stream()
                        .map(inner1 -> new ApplicationInsightsComponentAnalyticsItemImpl(inner1, this.manager()))
                        .collect(Collectors.toList()));
        } else {
            return Collections.emptyList();
        }
    }

    public Response> listWithResponse(
        String resourceGroupName,
        String resourceName,
        ItemScopePath scopePath,
        ItemScope scope,
        ItemTypeParameter type,
        Boolean includeContent,
        Context context) {
        Response> inner =
            this
                .serviceClient()
                .listWithResponse(resourceGroupName, resourceName, scopePath, scope, type, includeContent, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                inner
                    .getValue()
                    .stream()
                    .map(inner1 -> new ApplicationInsightsComponentAnalyticsItemImpl(inner1, this.manager()))
                    .collect(Collectors.toList()));
        } else {
            return null;
        }
    }

    public ApplicationInsightsComponentAnalyticsItem get(
        String resourceGroupName, String resourceName, ItemScopePath scopePath) {
        ApplicationInsightsComponentAnalyticsItemInner inner =
            this.serviceClient().get(resourceGroupName, resourceName, scopePath);
        if (inner != null) {
            return new ApplicationInsightsComponentAnalyticsItemImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response getWithResponse(
        String resourceGroupName,
        String resourceName,
        ItemScopePath scopePath,
        String id,
        String name,
        Context context) {
        Response inner =
            this.serviceClient().getWithResponse(resourceGroupName, resourceName, scopePath, id, name, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ApplicationInsightsComponentAnalyticsItemImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public ApplicationInsightsComponentAnalyticsItem put(
        String resourceGroupName,
        String resourceName,
        ItemScopePath scopePath,
        ApplicationInsightsComponentAnalyticsItemInner itemProperties) {
        ApplicationInsightsComponentAnalyticsItemInner inner =
            this.serviceClient().put(resourceGroupName, resourceName, scopePath, itemProperties);
        if (inner != null) {
            return new ApplicationInsightsComponentAnalyticsItemImpl(inner, this.manager());
        } else {
            return null;
        }
    }

    public Response putWithResponse(
        String resourceGroupName,
        String resourceName,
        ItemScopePath scopePath,
        ApplicationInsightsComponentAnalyticsItemInner itemProperties,
        Boolean overrideItem,
        Context context) {
        Response inner =
            this
                .serviceClient()
                .putWithResponse(resourceGroupName, resourceName, scopePath, itemProperties, overrideItem, context);
        if (inner != null) {
            return new SimpleResponse<>(
                inner.getRequest(),
                inner.getStatusCode(),
                inner.getHeaders(),
                new ApplicationInsightsComponentAnalyticsItemImpl(inner.getValue(), this.manager()));
        } else {
            return null;
        }
    }

    public void delete(String resourceGroupName, String resourceName, ItemScopePath scopePath) {
        this.serviceClient().delete(resourceGroupName, resourceName, scopePath);
    }

    public Response deleteWithResponse(
        String resourceGroupName,
        String resourceName,
        ItemScopePath scopePath,
        String id,
        String name,
        Context context) {
        return this.serviceClient().deleteWithResponse(resourceGroupName, resourceName, scopePath, id, name, context);
    }

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

    private com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager manager() {
        return this.serviceManager;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy