Skip to content

Commit 7ef1338

Browse files
hercules90Swarnim Kulkarni
authored andcommitted
Adding support for OperationName in the APIGatewayProxyRequestEvent (aws#126)
Co-authored-by: Swarnim Kulkarni <[email protected]>
1 parent 26b11a5 commit 7ef1338

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java

+30-3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public static class ProxyRequestContext implements Serializable, Cloneable {
5050

5151
private String requestId;
5252

53+
private String operationName;
54+
5355
private RequestIdentity identity;
5456

5557
private String resourcePath;
@@ -282,6 +284,25 @@ public ProxyRequestContext withPath(String path) {
282284
return this;
283285
}
284286

287+
/**
288+
* @return The name of the operation being performed
289+
* */
290+
public String getOperationName() {
291+
return operationName;
292+
}
293+
294+
/**
295+
* @param operationName The name of the operation being performed
296+
* */
297+
public void setOperationName(String operationName) {
298+
this.operationName = operationName;
299+
}
300+
301+
public ProxyRequestContext withOperationName(String operationName) {
302+
this.setOperationName(operationName);
303+
return this;
304+
}
305+
285306
/**
286307
* Returns a string representation of this object; useful for testing and debugging.
287308
*
@@ -313,6 +334,8 @@ public String toString() {
313334
sb.append("path: ").append(getPath()).append(",");
314335
if (getAuthorizer() != null)
315336
sb.append("authorizer: ").append(getAuthorizer().toString());
337+
if (getOperationName() != null)
338+
sb.append("operationName: ").append(getOperationName().toString());
316339
sb.append("}");
317340
return sb.toString();
318341
}
@@ -367,6 +390,10 @@ public boolean equals(Object obj) {
367390
return false;
368391
if (other.getAuthorizer() != null && !other.getAuthorizer().equals(this.getAuthorizer()))
369392
return false;
393+
if (other.getOperationName() == null ^ this.getOperationName() == null)
394+
return false;
395+
if (other.getOperationName() != null && !other.getOperationName().equals(this.getOperationName()))
396+
return false;
370397
return true;
371398
}
372399

@@ -385,6 +412,7 @@ public int hashCode() {
385412
hashCode = prime * hashCode + ((getApiId() == null) ? 0 : getApiId().hashCode());
386413
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
387414
hashCode = prime * hashCode + ((getAuthorizer() == null) ? 0 : getAuthorizer().hashCode());
415+
hashCode = prime * hashCode + ((getOperationName() == null) ? 0: getOperationName().hashCode());
388416
return hashCode;
389417
}
390418

@@ -396,7 +424,6 @@ public ProxyRequestContext clone() {
396424
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone()", e);
397425
}
398426
}
399-
400427
}
401428

402429
public static class RequestIdentity implements Serializable, Cloneable {
@@ -958,7 +985,7 @@ public APIGatewayProxyRequestEvent withMultiValueHeaders(Map<String, List<String
958985
this.setMultiValueHeaders(multiValueHeaders);
959986
return this;
960987
}
961-
988+
962989
/**
963990
* @return The query string parameters that were part of the request
964991
*/
@@ -1135,7 +1162,7 @@ public APIGatewayProxyRequestEvent withIsBase64Encoded(Boolean isBase64Encoded)
11351162
this.setIsBase64Encoded(isBase64Encoded);
11361163
return this;
11371164
}
1138-
1165+
11391166
/**
11401167
* Returns a string representation of this object; useful for testing and debugging.
11411168
*

0 commit comments

Comments
 (0)