forked from XT-i/aws-lambda-jenkins-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added AWS Lambda post build action awaiting testing for Lambda invocation
- Loading branch information
Showing
26 changed files
with
1,115 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
src/main/java/com/xti/jenkins/plugin/awslambda/invoke/InvokeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.xti.jenkins.plugin.awslambda.invoke; | ||
|
||
import java.util.List; | ||
|
||
public class InvokeConfig { | ||
private String awsAccessKeyId; | ||
private String awsSecretKey; | ||
private String awsRegion; | ||
private String functionName; | ||
private String payload; | ||
private boolean synchronous; | ||
private boolean successOnly; | ||
private List<JsonParameter> jsonParameters; | ||
|
||
public InvokeConfig(String awsAccessKeyId, String awsSecretKey, String awsRegion, String functionName, String payload, boolean synchronous, boolean successOnly, List<JsonParameter> jsonParameters) { | ||
this.awsAccessKeyId = awsAccessKeyId; | ||
this.awsSecretKey = awsSecretKey; | ||
this.awsRegion = awsRegion; | ||
this.functionName = functionName; | ||
this.payload = payload; | ||
this.synchronous = synchronous; | ||
this.successOnly = successOnly; | ||
this.jsonParameters = jsonParameters; | ||
} | ||
|
||
public String getAwsAccessKeyId() { | ||
return awsAccessKeyId; | ||
} | ||
|
||
public void setAwsAccessKeyId(String awsAccessKeyId) { | ||
this.awsAccessKeyId = awsAccessKeyId; | ||
} | ||
|
||
public String getAwsSecretKey() { | ||
return awsSecretKey; | ||
} | ||
|
||
public void setAwsSecretKey(String awsSecretKey) { | ||
this.awsSecretKey = awsSecretKey; | ||
} | ||
|
||
public String getAwsRegion() { | ||
return awsRegion; | ||
} | ||
|
||
public void setAwsRegion(String awsRegion) { | ||
this.awsRegion = awsRegion; | ||
} | ||
|
||
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 boolean isSuccessOnly() { | ||
return successOnly; | ||
} | ||
|
||
public void setSuccessOnly(boolean successOnly) { | ||
this.successOnly = successOnly; | ||
} | ||
|
||
public List<JsonParameter> getJsonParameters() { | ||
return jsonParameters; | ||
} | ||
|
||
public void setJsonParameters(List<JsonParameter> jsonParameters) { | ||
this.jsonParameters = jsonParameters; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
src/main/java/com/xti/jenkins/plugin/awslambda/invoke/JsonParameterVariables.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package com.xti.jenkins.plugin.awslambda.invoke; | ||
|
||
/* | ||
* #%L | ||
* AWS Lambda Upload Plugin | ||
* %% | ||
* Copyright (C) 2015 XT-i | ||
* %% | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* #L% | ||
*/ | ||
|
||
import hudson.Extension; | ||
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
public class JsonParameterVariables extends AbstractDescribableImpl<JsonParameterVariables> { | ||
private String envVarName; | ||
private String jsonPath; | ||
|
||
@DataBoundConstructor | ||
public JsonParameterVariables(String envVarName, String jsonPath) { | ||
this.envVarName = envVarName; | ||
this.jsonPath = jsonPath; | ||
} | ||
|
||
public String getEnvVarName() { | ||
return envVarName; | ||
} | ||
|
||
public String getJsonPath() { | ||
return jsonPath; | ||
} | ||
|
||
public void setEnvVarName(String envVarName) { | ||
this.envVarName = envVarName; | ||
} | ||
|
||
public void setJsonPath(String jsonPath) { | ||
this.jsonPath = jsonPath; | ||
} | ||
|
||
public JsonParameter getJsonParameter(){ | ||
return new JsonParameter(envVarName, jsonPath); | ||
} | ||
|
||
@Extension // This indicates to Jenkins that this is an implementation of an extension point. | ||
public static class DescriptorImpl extends Descriptor<JsonParameterVariables> { | ||
|
||
/** | ||
* This human readable name is used in the configuration screen. | ||
*/ | ||
public String getDisplayName() { | ||
return "Environment Variable"; | ||
} | ||
|
||
|
||
} | ||
} |
71 changes: 71 additions & 0 deletions
71
src/main/java/com/xti/jenkins/plugin/awslambda/invoke/LambdaInvokeAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.xti.jenkins.plugin.awslambda.invoke; | ||
|
||
/* | ||
* #%L | ||
* AWS Lambda Upload Plugin | ||
* %% | ||
* Copyright (C) 2015 XT-i | ||
* %% | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* #L% | ||
*/ | ||
|
||
import hudson.model.ProminentProjectAction; | ||
|
||
public class LambdaInvokeAction implements ProminentProjectAction { | ||
|
||
//Nothing to show, go to console for now | ||
private static final String URL_NAME = "console"; | ||
|
||
private final String iconFileName; | ||
private final String bigIconFileName; | ||
private final String displayName; | ||
|
||
|
||
public LambdaInvokeAction(String functionName, Boolean success) { | ||
if(success){ | ||
iconFileName = "/plugin/aws-lambda/images/Lambda_24.png"; | ||
bigIconFileName = "/plugin/aws-lambda/images/Lambda_48.png"; | ||
displayName = "Invoked Lambda: " + functionName; | ||
}else { | ||
iconFileName = "/plugin/aws-lambda/images/Lambda_24_grey.png"; | ||
bigIconFileName = "/plugin/aws-lambda/images/Lambda_48_grey.png"; | ||
displayName = "Lambda Invocation Failure: " + functionName; | ||
} | ||
} | ||
|
||
@Override | ||
public String getIconFileName() { | ||
return iconFileName; | ||
} | ||
|
||
public String getBigIconFileName() { | ||
return bigIconFileName; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return displayName; | ||
} | ||
|
||
@Override | ||
public String getUrlName() { | ||
return URL_NAME; | ||
} | ||
} |
Oops, something went wrong.