pub fn healthcheck_response(
    creds: Option<GcpCredentials>,
    not_found_error: crate::Error,
) -> impl FnOnce(http02::Response<hyper::Body>) -> crate::Result<()> {
    move |response| match response.status() {
        StatusCode::OK => {
            // If there are credentials configured, the
            // generated OAuth token needs to be periodically
            // regenerated. Since the health check runs at
            // startup, after a successful health check is a
            // good place to create the regeneration task.
            creds.map(|creds| creds.spawn_regenerate_token());
            Ok(())
        }
        StatusCode::FORBIDDEN => Err(GcpError::InvalidCredentials0.into()),
        StatusCode::NOT_FOUND => Err(not_found_error),
        status => Err(HealthcheckError::UnexpectedStatus2 { status }.into()),
    }
}
// Use this to map a healthcheck response, as it handles setting up the renewal task.
Use this to map a healthcheck response, as it handles setting up the renewal task.
Use this to map a healthcheck response as it handles setting up the renewal task .
pub fn healthcheck_response(
    creds: Option<GcpCredentials>,
    not_found_error: crate::Error,
) -> impl FnOnce(http02::Response<hyper::Body>) -> crate::Result<()> {
    move |response| match response.status() {
        StatusCode::OK => {
            // If there are credentials configured, the
            // generated OAuth token needs to be periodically
            // regenerated. Since the health check runs at
            // startup, after a successful health check is a
            // good place to create the regeneration task.
            creds.map(|creds| creds.spawn_regenerate_token());
            Ok(())
        }
        StatusCode::FORBIDDEN => Err(GcpError::InvalidCredentials0.into()),
        StatusCode::NOT_FOUND => Err(not_found_error),
        status => Err(HealthcheckError::UnexpectedStatus2 { status }.into()),
    }
}
pub fn healthcheck_response ( creds : Option < GcpCredentials > , not_found_error : crate :: Error , ) -> impl FnOnce ( http02 :: Response < hyper :: Body > ) -> crate :: Result < ( ) > { move | response | match response . status ( ) { StatusCode :: OK => { // If there are credentials configured, the // generated OAuth token needs to be periodically // regenerated. Since the health check runs at // startup, after a successful health check is a // good place to create the regeneration task. creds . map ( | creds | creds . spawn_regenerate_token ( ) ) ; Ok ( ( ) ) } StatusCode :: FORBIDDEN => Err ( GcpError :: InvalidCredentials0 . into ( ) ) , StatusCode :: NOT_FOUND => Err ( not_found_error ) , status => Err ( HealthcheckError :: UnexpectedStatus2 { status } . into ( ) ) , } }
Use this to map a healthcheck response, as it handles setting up the renewal task.
Use this to map a healthcheck response as it handles setting up the renewal task .
creds
Option<GcpCredentials>
not_found_error
crate::Error