001/*
002 * Copyright 2012-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.boot.actuate.autoconfigure.cloudfoundry.reactive;
018
019import reactor.core.publisher.Mono;
020
021import org.springframework.boot.actuate.autoconfigure.cloudfoundry.HealthEndpointCloudFoundryExtension;
022import org.springframework.boot.actuate.endpoint.annotation.EndpointExtension;
023import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
024import org.springframework.boot.actuate.endpoint.web.WebEndpointResponse;
025import org.springframework.boot.actuate.health.Health;
026import org.springframework.boot.actuate.health.HealthEndpoint;
027import org.springframework.boot.actuate.health.ReactiveHealthEndpointWebExtension;
028import org.springframework.boot.actuate.health.ShowDetails;
029
030/**
031 * Reactive {@link EndpointExtension} for the {@link HealthEndpoint} that always exposes
032 * full health details.
033 *
034 * @author Madhura Bhave
035 * @since 2.0.0
036 */
037@HealthEndpointCloudFoundryExtension
038public class CloudFoundryReactiveHealthEndpointWebExtension {
039
040        private final ReactiveHealthEndpointWebExtension delegate;
041
042        public CloudFoundryReactiveHealthEndpointWebExtension(
043                        ReactiveHealthEndpointWebExtension delegate) {
044                this.delegate = delegate;
045        }
046
047        @ReadOperation
048        public Mono<WebEndpointResponse<Health>> health() {
049                return this.delegate.health(null, ShowDetails.ALWAYS);
050        }
051
052}