// Path: src/main/java/com/xti/jenkins/plugin/awslambda/invoke/InvokeConfig.java
// public class InvokeConfig implements Serializable {
//     private String functionName;
//     private String payload;
//     private boolean synchronous;
//     private List<JsonParameter> jsonParameters;
// 
//     public InvokeConfig(String functionName, String payload, boolean synchronous, List<JsonParameter> jsonParameters) {
//         this.functionName = functionName;
//         this.payload = payload;
//         this.synchronous = synchronous;
//         this.jsonParameters = jsonParameters;
//     }
// 
//     public String getFunctionName() {
//         return functionName;
//     }
// 
//     public void setFunctionName(String functionName) {
//         this.functionName = functionName;
//     }
// 
//     public String getPayload() {
//         return payload;
//     }
// 
//     public void setPayload(String payload) {
//         this.payload = payload;
//     }
// 
//     public boolean isSynchronous() {
//         return synchronous;
//     }
// 
//     public void setSynchronous(boolean synchronous) {
//         this.synchronous = synchronous;
//     }
// 
//     public List<JsonParameter> getJsonParameters() {
//         return jsonParameters;
//     }
// 
//     public void setJsonParameters(List<JsonParameter> jsonParameters) {
//         this.jsonParameters = jsonParameters;
//     }
// }


import com.amazonaws.services.lambda.AWSLambdaClient;
import com.amazonaws.services.lambda.model.InvocationType;
import com.amazonaws.services.lambda.model.InvokeRequest;
import com.amazonaws.services.lambda.model.InvokeResult;
import com.amazonaws.services.lambda.model.LogType;
import com.amazonaws.util.Base64;
import com.xti.jenkins.plugin.awslambda.exception.LambdaInvokeException;
import com.xti.jenkins.plugin.awslambda.invoke.InvokeConfig;
import org.apache.commons.lang.StringUtils;
import java.nio.charset.Charset;
package com.xti.jenkins.plugin.awslambda.service;



public class LambdaInvokeService {
    private AWSLambdaClient client;
    private JenkinsLogger logger;

    public LambdaInvokeService(AWSLambdaClient client, JenkinsLogger logger) {
        this.client = client;
        this.logger = logger;
    }

    /**
     * Synchronously or asynchronously invokes an AWS Lambda function.
     * If synchronously invoked, the AWS Lambda log is collected and the response payload is returned
     * @param invokeConfig AWS Lambda invocation configuration
     * @return response payload
     */
    public String invokeLambdaFunction(InvokeConfig invokeConfig) throws LambdaInvokeException {
        InvokeRequest invokeRequest = new InvokeRequest()
                .withFunctionName(invokeConfig.getFunctionName())
                .withPayload(invokeConfig.getPayload());

// Path: src/main/java/com/xti/jenkins/plugin/awslambda/invoke/InvokeConfig.java
// public class InvokeConfig implements Serializable {
//     private String functionName;
//     private String payload;
//     private boolean synchronous;
//     private List<JsonParameter> jsonParameters;
// 
//     public InvokeConfig(String functionName, String payload, boolean synchronous, List<JsonParameter> jsonParameters) {
//         this.functionName = functionName;
//         this.payload = payload;
//         this.synchronous = synchronous;
//         this.jsonParameters = jsonParameters;
//     }
// 
//     public String getFunctionName() {
//         return functionName;
//     }
// 
//     public void setFunctionName(String functionName) {
//         this.functionName = functionName;
//     }
// 
//     public String getPayload() {
//         return payload;
//     }
// 
//     public void setPayload(String payload) {
//         this.payload = payload;
//     }
// 
//     public boolean isSynchronous() {
//         return synchronous;
//     }
// 
//     public void setSynchronous(boolean synchronous) {
//         this.synchronous = synchronous;
//     }
// 
//     public List<JsonParameter> getJsonParameters() {
//         return jsonParameters;
//     }
// 
//     public void setJsonParameters(List<JsonParameter> jsonParameters) {
//         this.jsonParameters = jsonParameters;
//     }
// }


// Path: src/main/java/com/xti/jenkins/plugin/awslambda/service/LambdaInvokeService.java
import com.amazonaws.services.lambda.AWSLambdaClient;
import com.amazonaws.services.lambda.model.InvocationType;
import com.amazonaws.services.lambda.model.InvokeRequest;
import com.amazonaws.services.lambda.model.InvokeResult;
import com.amazonaws.services.lambda.model.LogType;
import com.amazonaws.util.Base64;
import com.xti.jenkins.plugin.awslambda.exception.LambdaInvokeException;
import com.xti.jenkins.plugin.awslambda.invoke.InvokeConfig;
import org.apache.commons.lang.StringUtils;
import java.nio.charset.Charset;

package com.xti.jenkins.plugin.awslambda.service;



public class LambdaInvokeService {
    private AWSLambdaClient client;
    private JenkinsLogger logger;

    public LambdaInvokeService(AWSLambdaClient client, JenkinsLogger logger) {
        this.client = client;
        this.logger = logger;
    }

    /**
     * Synchronously or asynchronously invokes an AWS Lambda function.
     * If synchronously invoked, the AWS Lambda log is collected and the response payload is returned
     * @param invokeConfig AWS Lambda invocation configuration
     * @return response payload
     */
    public String invokeLambdaFunction(InvokeConfig invokeConfig) throws LambdaInvokeException {
        InvokeRequest invokeRequest = new InvokeRequest()
                .withFunctionName(invokeConfig.getFunctionName())
                .withPayload(invokeConfig.getPayload());

        if(invokeConfig.isSynchronous()){