com.azure.resourcemanager.applicationinsights.implementation.FavoritesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-applicationinsights Show documentation
Show all versions of azure-resourcemanager-applicationinsights Show documentation
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.FavoritesClient;
import com.azure.resourcemanager.applicationinsights.fluent.models.ApplicationInsightsComponentFavoriteInner;
import com.azure.resourcemanager.applicationinsights.models.ApplicationInsightsComponentFavorite;
import com.azure.resourcemanager.applicationinsights.models.FavoriteSourceType;
import com.azure.resourcemanager.applicationinsights.models.FavoriteType;
import com.azure.resourcemanager.applicationinsights.models.Favorites;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public final class FavoritesImpl implements Favorites {
private static final ClientLogger LOGGER = new ClientLogger(FavoritesImpl.class);
private final FavoritesClient innerClient;
private final com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager;
public FavoritesImpl(
FavoritesClient innerClient,
com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public List list(String resourceGroupName, String resourceName) {
List inner =
this.serviceClient().list(resourceGroupName, resourceName);
if (inner != null) {
return Collections
.unmodifiableList(
inner
.stream()
.map(inner1 -> new ApplicationInsightsComponentFavoriteImpl(inner1, this.manager()))
.collect(Collectors.toList()));
} else {
return Collections.emptyList();
}
}
public Response> listWithResponse(
String resourceGroupName,
String resourceName,
FavoriteType favoriteType,
FavoriteSourceType sourceType,
Boolean canFetchContent,
List tags,
Context context) {
Response> inner =
this
.serviceClient()
.listWithResponse(
resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
inner
.getValue()
.stream()
.map(inner1 -> new ApplicationInsightsComponentFavoriteImpl(inner1, this.manager()))
.collect(Collectors.toList()));
} else {
return null;
}
}
public ApplicationInsightsComponentFavorite get(String resourceGroupName, String resourceName, String favoriteId) {
ApplicationInsightsComponentFavoriteInner inner =
this.serviceClient().get(resourceGroupName, resourceName, favoriteId);
if (inner != null) {
return new ApplicationInsightsComponentFavoriteImpl(inner, this.manager());
} else {
return null;
}
}
public Response getWithResponse(
String resourceGroupName, String resourceName, String favoriteId, Context context) {
Response inner =
this.serviceClient().getWithResponse(resourceGroupName, resourceName, favoriteId, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new ApplicationInsightsComponentFavoriteImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public ApplicationInsightsComponentFavorite add(
String resourceGroupName,
String resourceName,
String favoriteId,
ApplicationInsightsComponentFavoriteInner favoriteProperties) {
ApplicationInsightsComponentFavoriteInner inner =
this.serviceClient().add(resourceGroupName, resourceName, favoriteId, favoriteProperties);
if (inner != null) {
return new ApplicationInsightsComponentFavoriteImpl(inner, this.manager());
} else {
return null;
}
}
public Response addWithResponse(
String resourceGroupName,
String resourceName,
String favoriteId,
ApplicationInsightsComponentFavoriteInner favoriteProperties,
Context context) {
Response inner =
this
.serviceClient()
.addWithResponse(resourceGroupName, resourceName, favoriteId, favoriteProperties, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new ApplicationInsightsComponentFavoriteImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public ApplicationInsightsComponentFavorite update(
String resourceGroupName,
String resourceName,
String favoriteId,
ApplicationInsightsComponentFavoriteInner favoriteProperties) {
ApplicationInsightsComponentFavoriteInner inner =
this.serviceClient().update(resourceGroupName, resourceName, favoriteId, favoriteProperties);
if (inner != null) {
return new ApplicationInsightsComponentFavoriteImpl(inner, this.manager());
} else {
return null;
}
}
public Response updateWithResponse(
String resourceGroupName,
String resourceName,
String favoriteId,
ApplicationInsightsComponentFavoriteInner favoriteProperties,
Context context) {
Response inner =
this
.serviceClient()
.updateWithResponse(resourceGroupName, resourceName, favoriteId, favoriteProperties, context);
if (inner != null) {
return new SimpleResponse<>(
inner.getRequest(),
inner.getStatusCode(),
inner.getHeaders(),
new ApplicationInsightsComponentFavoriteImpl(inner.getValue(), this.manager()));
} else {
return null;
}
}
public void delete(String resourceGroupName, String resourceName, String favoriteId) {
this.serviceClient().delete(resourceGroupName, resourceName, favoriteId);
}
public Response deleteWithResponse(
String resourceGroupName, String resourceName, String favoriteId, Context context) {
return this.serviceClient().deleteWithResponse(resourceGroupName, resourceName, favoriteId, context);
}
private FavoritesClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager manager() {
return this.serviceManager;
}
}