com.microsoft.azure.management.monitor.implementation.MetricDefinitionsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-mgmt-monitor Show documentation
Show all versions of azure-mgmt-monitor Show documentation
This package contains Microsoft Azure Monitor SDK. This package has been deprecated. A replacement package com.azure.resourcemanager:azure-resourcemanager-monitor is available as of 31-March-2022. We strongly encourage you to upgrade to continue receiving updates. See Migration Guide https://aka.ms/java-track2-migration-guide for guidance on upgrading. Refer to our deprecation policy https://azure.github.io/azure-sdk/policies_support.html for more details.
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/
package com.microsoft.azure.management.monitor.implementation;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.monitor.MetricDefinition;
import com.microsoft.azure.management.monitor.MetricDefinitions;
import rx.Observable;
import rx.functions.Func1;
import java.util.List;
/**
* Implementation for {@link MetricDefinitions}.
*/
@LangDefinition
class MetricDefinitionsImpl
implements MetricDefinitions {
private final MonitorManager myManager;
MetricDefinitionsImpl(final MonitorManager monitorManager) {
this.myManager = monitorManager;
}
@Override
public MonitorManager manager() {
return this.myManager;
}
@Override
public MetricDefinitionsInner inner() {
return this.myManager.inner().metricDefinitions();
}
@Override
public List listByResource(String resourceId) {
List inners = this.inner().list(resourceId);
if (inners == null) {
return null;
}
return Lists.transform(inners, new Function() {
@Override
public MetricDefinition apply(MetricDefinitionInner metricDefinitionInner) {
return new MetricDefinitionImpl(metricDefinitionInner, myManager);
}
});
}
@Override
public Observable listByResourceAsync(String resourceId) {
return this.inner().listAsync(resourceId)
.flatMapIterable(new Func1, Iterable>() {
@Override
public Iterable call(List items) {
return items;
}
}).map(new Func1() {
@Override
public MetricDefinition call(MetricDefinitionInner metricDefinitionInner) {
return new MetricDefinitionImpl(metricDefinitionInner, myManager);
}
});
}
}