Skip to content

Commit 59e3548

Browse files
authored
Add missing fields to API Gateway request context (#422)
* extendedRequestId * requestTime * requestTimeEpoch * domainName * protocol
1 parent 2de67a1 commit 59e3548

File tree

1 file changed

+193
-0
lines changed

1 file changed

+193
-0
lines changed

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

+193
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ public static class ProxyRequestContext implements Serializable, Cloneable {
6666

6767
private Map<String, Object> authorizer;
6868

69+
private String extendedRequestId;
70+
71+
private String requestTime;
72+
73+
private Long requestTimeEpoch;
74+
75+
private String domainName;
76+
77+
private String domainPrefix;
78+
79+
private String protocol;
80+
6981
/**
7082
* default constructor
7183
*/
@@ -305,6 +317,145 @@ public ProxyRequestContext withOperationName(String operationName) {
305317
return this;
306318
}
307319

320+
/**
321+
* @return The API Gateway Extended Request Id
322+
*/
323+
public String getExtendedRequestId() {
324+
return extendedRequestId;
325+
}
326+
327+
/**
328+
* @param extendedRequestId The API Gateway Extended Request Id
329+
*/
330+
public void setExtendedRequestId(String extendedRequestId) {
331+
this.extendedRequestId = extendedRequestId;
332+
}
333+
334+
/**
335+
* @param extendedRequestId The API Gateway Extended Request Id
336+
* @return ProxyRequestContext object
337+
*/
338+
public ProxyRequestContext withExtendedRequestId(String extendedRequestId) {
339+
this.setExtendedRequestId(extendedRequestId);
340+
return this;
341+
}
342+
343+
/**
344+
* @return The CLF-formatted request time (dd/MMM/yyyy:HH:mm:ss +-hhmm).
345+
*/
346+
public String getRequestTime() {
347+
return requestTime;
348+
}
349+
350+
/**
351+
* @param requestTime The CLF-formatted request time (dd/MMM/yyyy:HH:mm:ss +-hhmm).
352+
*/
353+
public void setRequestTime(String requestTime) {
354+
this.requestTime = requestTime;
355+
}
356+
357+
/**
358+
* @param requestTime The CLF-formatted request time (dd/MMM/yyyy:HH:mm:ss +-hhmm).
359+
* @return ProxyRequestContext object
360+
*/
361+
public ProxyRequestContext withRequestTime(String requestTime) {
362+
this.setRequestTime(requestTime);
363+
return this;
364+
}
365+
366+
/**
367+
* @return The Epoch-formatted request time (in millis)
368+
*/
369+
public Long getRequestTimeEpoch() {
370+
return requestTimeEpoch;
371+
}
372+
373+
/**
374+
* @param requestTimeEpoch The Epoch-formatted request time (in millis)
375+
*/
376+
public void setRequestTimeEpoch(Long requestTimeEpoch) {
377+
this.requestTimeEpoch = requestTimeEpoch;
378+
}
379+
380+
/**
381+
* @param requestTimeEpoch The Epoch-formatted request time (in millis)
382+
* @return ProxyRequestContext object
383+
*/
384+
public ProxyRequestContext withRequestTimeEpoch(Long requestTimeEpoch) {
385+
this.setRequestTimeEpoch(requestTimeEpoch);
386+
return this;
387+
}
388+
389+
/**
390+
* @return The full domain name used to invoke the API. This should be the same as the incoming Host header.
391+
*/
392+
public String getDomainName() {
393+
return domainName;
394+
}
395+
396+
/**
397+
* @param domainName The full domain name used to invoke the API.
398+
* This should be the same as the incoming Host header.
399+
*/
400+
public void setDomainName(String domainName) {
401+
this.domainName = domainName;
402+
}
403+
404+
/**
405+
* @param domainName The full domain name used to invoke the API.
406+
* This should be the same as the incoming Host header.
407+
* @return ProxyRequestContext object
408+
*/
409+
public ProxyRequestContext withDomainName(String domainName) {
410+
this.setDomainName(domainName);
411+
return this;
412+
}
413+
414+
/**
415+
* @return The first label of the domainName. This is often used as a caller/customer identifier.
416+
*/
417+
public String getDomainPrefix() {
418+
return domainPrefix;
419+
}
420+
421+
/**
422+
* @param domainPrefix The first label of the domainName. This is often used as a caller/customer identifier.
423+
*/
424+
public void setDomainPrefix(String domainPrefix) {
425+
this.domainPrefix = domainPrefix;
426+
}
427+
428+
/**
429+
* @param domainPrefix The first label of the domainName. This is often used as a caller/customer identifier.
430+
* @return
431+
*/
432+
public ProxyRequestContext withDomainPrefix(String domainPrefix) {
433+
this.setDomainPrefix(domainPrefix);
434+
return this;
435+
}
436+
/**
437+
* @return The request protocol, for example, HTTP/1.1.
438+
*/
439+
public String getProtocol() {
440+
return protocol;
441+
}
442+
443+
/**
444+
* @param protocol The request protocol, for example, HTTP/1.1.
445+
*/
446+
public void setProtocol(String protocol) {
447+
this.protocol = protocol;
448+
}
449+
450+
/**
451+
* @param protocol The request protocol, for example, HTTP/1.1.
452+
* @return ProxyRequestContext object
453+
*/
454+
public ProxyRequestContext withProtocol(String protocol) {
455+
this.setProtocol(protocol);
456+
return this;
457+
}
458+
308459
/**
309460
* Returns a string representation of this object; useful for testing and debugging.
310461
*
@@ -338,6 +489,18 @@ public String toString() {
338489
sb.append("authorizer: ").append(getAuthorizer().toString());
339490
if (getOperationName() != null)
340491
sb.append("operationName: ").append(getOperationName().toString());
492+
if (getExtendedRequestId() != null)
493+
sb.append("extendedRequestId: ").append(getExtendedRequestId()).append(",");
494+
if (getRequestTime() != null)
495+
sb.append("requestTime: ").append(getRequestTime()).append(",");
496+
if (getProtocol() != null)
497+
sb.append("protocol: ").append(getProtocol()).append(",");
498+
if (getRequestTimeEpoch() != null)
499+
sb.append("requestTimeEpoch: ").append(getRequestTimeEpoch()).append(",");
500+
if (getDomainPrefix() != null)
501+
sb.append("domainPrefix: ").append(getDomainPrefix()).append(",");
502+
if (getDomainName() != null)
503+
sb.append("domainName: ").append(getDomainName());
341504
sb.append("}");
342505
return sb.toString();
343506
}
@@ -396,6 +559,30 @@ public boolean equals(Object obj) {
396559
return false;
397560
if (other.getOperationName() != null && !other.getOperationName().equals(this.getOperationName()))
398561
return false;
562+
if (other.getExtendedRequestId() == null ^ this.getExtendedRequestId() == null)
563+
return false;
564+
if (other.getExtendedRequestId() != null && other.getExtendedRequestId().equals(this.getExtendedRequestId()) == false)
565+
return false;
566+
if (other.getRequestTime() == null ^ this.getRequestTime() == null)
567+
return false;
568+
if (other.getRequestTime() != null && other.getRequestTime().equals(this.getRequestTime()) == false)
569+
return false;
570+
if (other.getRequestTimeEpoch() == null ^ this.getRequestTimeEpoch() == null)
571+
return false;
572+
if (other.getRequestTimeEpoch() != null && other.getRequestTimeEpoch().equals(this.getRequestTimeEpoch()) == false)
573+
return false;
574+
if (other.getDomainName() == null ^ this.getDomainName() == null)
575+
return false;
576+
if (other.getDomainName() != null && other.getDomainName().equals(this.getDomainName()) == false)
577+
return false;
578+
if (other.getDomainPrefix() == null ^ this.getDomainPrefix() == null)
579+
return false;
580+
if (other.getDomainPrefix() != null && other.getDomainPrefix().equals(this.getDomainPrefix()) == false)
581+
return false;
582+
if (other.getProtocol() == null ^ this.getProtocol() == null)
583+
return false;
584+
if (other.getProtocol() != null && other.getProtocol().equals(this.getProtocol()) == false)
585+
return false;
399586
return true;
400587
}
401588

@@ -415,6 +602,12 @@ public int hashCode() {
415602
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
416603
hashCode = prime * hashCode + ((getAuthorizer() == null) ? 0 : getAuthorizer().hashCode());
417604
hashCode = prime * hashCode + ((getOperationName() == null) ? 0: getOperationName().hashCode());
605+
hashCode = prime * hashCode + ((getExtendedRequestId() == null) ? 0 : getExtendedRequestId().hashCode());
606+
hashCode = prime * hashCode + ((getRequestTime() == null) ? 0 : getRequestTime().hashCode());
607+
hashCode = prime * hashCode + ((getRequestTimeEpoch() == null) ? 0 : getRequestTimeEpoch().hashCode());
608+
hashCode = prime * hashCode + ((getDomainName() == null) ? 0 : getDomainName().hashCode());
609+
hashCode = prime * hashCode + ((getDomainPrefix() == null) ? 0 : getDomainPrefix().hashCode());
610+
hashCode = prime * hashCode + ((getProtocol() == null) ? 0 : getProtocol().hashCode());
418611
return hashCode;
419612
}
420613

0 commit comments

Comments
 (0)