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

com.sap.cloud.mt.tools.api.ServiceEndpointMediators Maven / Gradle / Ivy

/*******************************************************************************
 *   © 2019-2024 SAP SE or an SAP affiliate company. All rights reserved.
 ******************************************************************************/

package com.sap.cloud.mt.tools.api;

import com.sap.cloud.mt.tools.exception.InternalException;
import com.sap.cloud.sdk.cloudplatform.connectivity.HttpDestination;

import java.util.List;
import java.util.Set;
import java.util.function.IntFunction;

/**
 * Define syntax of fluent API to create a service endpoint
 */

public interface ServiceEndpointMediators {
    /*
         at -> destinationName -> path ---> |returnCodeChecker            | ->|retry     | -> forReturnCodes-> config -> end
                                            |throwNoExceptionForReturnCode|   |doNotRetry| -> end                                                                                                    |
     */

	public static interface FromCreate {
		FromDestinationName destinationName(String destinationName);

		FromDestinationName destination(HttpDestination destination);
	}


	public interface FromDestinationName {
		FromPath path(String path);
	}

	public interface FromPath {
		FromCodeChecker returnCodeChecker(IntFunction checkFunction);

		FromCodeChecker throwNoExceptionForReturnCode();
	}

	public interface FromCodeChecker {
		FromRetry retry();

		FromDoNotRetry doNotRetry();
	}

	public interface FromDoNotRetry extends End {

	}

	public interface FromRetry {
		FromReturnCodes forReturnCodes(Set returnCodes);

		FromReturnCodes forReturnCodes(List returnCodes);

		FromReturnCodes forReturnCodes(Integer... returnCodes);

	}

	public interface FromReturnCodes {
		FromConfig config(ResilienceConfig config);
	}

	public interface FromConfig extends End {
	}


	public interface End {
		ServiceEndpoint end() throws InternalException;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy