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

com.microsoft.azure.management.network.implementation.TroubleshootingImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Network Management SDK. A new set of management libraries are now Generally Available. For documentation on how to use the new libraries, please see https://aka.ms/azsdk/java/mgmt

There is a newer version: 1.41.4
Show newest version
/**
 * 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.network.implementation;

import com.microsoft.azure.management.apigeneration.LangDefinition;
import com.microsoft.azure.management.network.NetworkWatcher;
import com.microsoft.azure.management.network.Troubleshooting;
import com.microsoft.azure.management.network.TroubleshootingDetails;
import com.microsoft.azure.management.network.TroubleshootingParameters;
import com.microsoft.azure.management.resources.fluentcore.model.implementation.ExecutableImpl;
import org.joda.time.DateTime;
import rx.Observable;
import rx.functions.Func1;

import java.util.List;

/**
 * Implementation of Troubleshooting interface.
 */
@LangDefinition
class TroubleshootingImpl extends ExecutableImpl
        implements Troubleshooting, Troubleshooting.Definition {

    private final NetworkWatcherImpl parent;
    private TroubleshootingParameters parameters = new TroubleshootingParameters();
    private TroubleshootingResultInner result;

    TroubleshootingImpl(NetworkWatcherImpl parent) {
        this.parent = parent;
    }

    @Override
    public TroubleshootingImpl withTargetResourceId(String targetResourceId) {
        parameters.withTargetResourceId(targetResourceId);
        return this;
    }

    @Override
    public TroubleshootingImpl withStorageAccount(String storageAccountId) {
        parameters.withStorageId(storageAccountId);
        return this;
    }

    @Override
    public TroubleshootingImpl withStoragePath(String storagePath) {
        parameters.withStoragePath(storagePath);
        return this;
    }

    @Override
    public NetworkWatcher parent() {
        return parent;
    }

    @Override
    public Observable executeWorkAsync() {
        return this.parent().manager().inner().networkWatchers()
                .getTroubleshootingAsync(parent.resourceGroupName(), parent.name(), parameters)
                .map(new Func1() {
                    @Override
                    public Troubleshooting call(TroubleshootingResultInner troubleshootingResultInner) {
                        TroubleshootingImpl.this.result = troubleshootingResultInner;
                        return TroubleshootingImpl.this;
                    }
                });
    }

    // Getters

    @Override
    public String targetResourceId() {
        return parameters.targetResourceId();
    }

    @Override
    public String storageId() {
        return parameters.storageId();
    }

    @Override
    public String storagePath() {
        return parameters.storagePath();
    }

    @Override
    public DateTime startTime() {
        return result.startTime();
    }

    @Override
    public DateTime endTime() {
        return result.endTime();
    }

    @Override
    public String code() {
        return result.code();
    }

    @Override
    public List results() {
        return result.results();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy