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

com.azure.resourcemanager.network.implementation.ApplicationGatewayBackendServerHealthImpl Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Network Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

There is a newer version: 2.44.0
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.resourcemanager.network.implementation;

import com.azure.resourcemanager.network.models.ApplicationGatewayBackendHealthStatus;
import com.azure.resourcemanager.network.models.ApplicationGatewayBackendHttpConfigurationHealth;
import com.azure.resourcemanager.network.models.ApplicationGatewayBackendServerHealth;
import com.azure.resourcemanager.network.models.NetworkInterface;
import com.azure.resourcemanager.network.models.NicIpConfiguration;
import com.azure.resourcemanager.network.fluent.models.ApplicationGatewayBackendHealthServerInner;
import com.azure.resourcemanager.resources.fluentcore.arm.ResourceUtils;

/** Implementation of application gateway backend server health information. */
public class ApplicationGatewayBackendServerHealthImpl implements ApplicationGatewayBackendServerHealth {

    private final ApplicationGatewayBackendHealthServerInner inner;
    private final ApplicationGatewayBackendHttpConfigurationHealthImpl httpConfigHealth;

    ApplicationGatewayBackendServerHealthImpl(
        ApplicationGatewayBackendHealthServerInner inner,
        ApplicationGatewayBackendHttpConfigurationHealthImpl httpConfigHealth) {
        this.inner = inner;
        this.httpConfigHealth = httpConfigHealth;
    }

    @Override
    public ApplicationGatewayBackendHealthServerInner innerModel() {
        return this.inner;
    }

    @Override
    public ApplicationGatewayBackendHttpConfigurationHealth parent() {
        return this.httpConfigHealth;
    }

    @Override
    public String ipAddress() {
        return this.innerModel().address();
    }

    @Override
    public NicIpConfiguration getNetworkInterfaceIPConfiguration() {
        if (this.innerModel().ipConfiguration() == null) {
            return null;
        }
        String nicIPConfigId = this.innerModel().ipConfiguration().id();
        if (nicIPConfigId == null) {
            return null;
        }

        String nicIPConfigName = ResourceUtils.nameFromResourceId(nicIPConfigId);
        String nicId = ResourceUtils.parentResourceIdFromResourceId(nicIPConfigId);
        NetworkInterface nic = this.parent().parent().parent().manager().networkInterfaces().getById(nicId);
        if (nic == null) {
            return null;
        } else {
            return nic.ipConfigurations().get(nicIPConfigName);
        }
    }

    @Override
    public ApplicationGatewayBackendHealthStatus status() {
        return ApplicationGatewayBackendHealthStatus.fromString(this.inner.health().toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy