Skip to content

Commit 769cffe

Browse files
committed
Add missing fields to API Gateway request context
* extendedRequestId * requestTime * requestTimeEpoch * domainName * protocol
1 parent 2de67a1 commit 769cffe

File tree

1 file changed

+189
-0
lines changed

1 file changed

+189
-0
lines changed

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

+189
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
*/
@@ -302,6 +314,141 @@ public void setOperationName(String operationName) {
302314

303315
public ProxyRequestContext withOperationName(String operationName) {
304316
this.setOperationName(operationName);
317+
* @return The API Gateway Extended Request Id
318+
*/
319+
public String getExtendedRequestId() {
320+
return extendedRequestId;
321+
}
322+
323+
/**
324+
* @param extendedRequestId The API Gateway Extended Request Id
325+
*/
326+
public void setExtendedRequestId(String extendedRequestId) {
327+
this.extendedRequestId = extendedRequestId;
328+
}
329+
330+
/**
331+
* @param extendedRequestId The API Gateway Extended Request Id
332+
* @return ProxyRequestContext object
333+
*/
334+
public ProxyRequestContext withExtendedRequestId(String extendedRequestId) {
335+
this.setExtendedRequestId(extendedRequestId);
336+
return this;
337+
}
338+
339+
/**
340+
* @return The CLF-formatted request time (dd/MMM/yyyy:HH:mm:ss +-hhmm).
341+
*/
342+
public String getRequestTime() {
343+
return requestTime;
344+
}
345+
346+
/**
347+
* @param requestTime The CLF-formatted request time (dd/MMM/yyyy:HH:mm:ss +-hhmm).
348+
*/
349+
public void setRequestTime(String requestTime) {
350+
this.requestTime = requestTime;
351+
}
352+
353+
/**
354+
* @param requestTime The CLF-formatted request time (dd/MMM/yyyy:HH:mm:ss +-hhmm).
355+
* @return ProxyRequestContext object
356+
*/
357+
public ProxyRequestContext withRequestTime(String requestTime) {
358+
this.setRequestTime(requestTime);
359+
return this;
360+
}
361+
362+
/**
363+
* @return The Epoch-formatted request time (in millis)
364+
*/
365+
public Long getRequestTimeEpoch() {
366+
return requestTimeEpoch;
367+
}
368+
369+
/**
370+
* @param requestTimeEpoch The Epoch-formatted request time (in millis)
371+
*/
372+
public void setRequestTimeEpoch(Long requestTimeEpoch) {
373+
this.requestTimeEpoch = requestTimeEpoch;
374+
}
375+
376+
/**
377+
* @param requestTimeEpoch The Epoch-formatted request time (in millis)
378+
* @return ProxyRequestContext object
379+
*/
380+
public ProxyRequestContext withRequestTimeEpoch(Long requestTimeEpoch) {
381+
this.setRequestTimeEpoch(requestTimeEpoch);
382+
return this;
383+
}
384+
385+
/**
386+
* @return The full domain name used to invoke the API. This should be the same as the incoming Host header.
387+
*/
388+
public String getDomainName() {
389+
return domainName;
390+
}
391+
392+
/**
393+
* @param domainName The full domain name used to invoke the API.
394+
* This should be the same as the incoming Host header.
395+
*/
396+
public void setDomainName(String domainName) {
397+
this.domainName = domainName;
398+
}
399+
400+
/**
401+
* @param domainName The full domain name used to invoke the API.
402+
* This should be the same as the incoming Host header.
403+
* @return ProxyRequestContext object
404+
*/
405+
public ProxyRequestContext withDomainName(String domainName) {
406+
this.setDomainName(domainName);
407+
return this;
408+
}
409+
410+
/**
411+
* @return The first label of the domainName. This is often used as a caller/customer identifier.
412+
*/
413+
public String getDomainPrefix() {
414+
return domainPrefix;
415+
}
416+
417+
/**
418+
* @param domainPrefix The first label of the domainName. This is often used as a caller/customer identifier.
419+
*/
420+
public void setDomainPrefix(String domainPrefix) {
421+
this.domainPrefix = domainPrefix;
422+
}
423+
424+
/**
425+
* @param domainPrefix The first label of the domainName. This is often used as a caller/customer identifier.
426+
* @return
427+
*/
428+
public ProxyRequestContext withDomainPrefix(String domainPrefix) {
429+
this.setDomainPrefix(domainPrefix);
430+
return this;
431+
}
432+
/**
433+
* @return The request protocol, for example, HTTP/1.1.
434+
*/
435+
public String getProtocol() {
436+
return protocol;
437+
}
438+
439+
/**
440+
* @param protocol The request protocol, for example, HTTP/1.1.
441+
*/
442+
public void setProtocol(String protocol) {
443+
this.protocol = protocol;
444+
}
445+
446+
/**
447+
* @param protocol The request protocol, for example, HTTP/1.1.
448+
* @return ProxyRequestContext object
449+
*/
450+
public ProxyRequestContext withProtocol(String protocol) {
451+
this.setProtocol(protocol);
305452
return this;
306453
}
307454

@@ -338,6 +485,18 @@ public String toString() {
338485
sb.append("authorizer: ").append(getAuthorizer().toString());
339486
if (getOperationName() != null)
340487
sb.append("operationName: ").append(getOperationName().toString());
488+
if (getExtendedRequestId() != null)
489+
sb.append("extendedRequestId: ").append(getExtendedRequestId()).append(",");
490+
if (getRequestTime() != null)
491+
sb.append("requestTime: ").append(getRequestTime()).append(",");
492+
if (getProtocol() != null)
493+
sb.append("protocol: ").append(getProtocol()).append(",");
494+
if (getRequestTimeEpoch() != null)
495+
sb.append("requestTimeEpoch: ").append(getRequestTimeEpoch()).append(",");
496+
if (getDomainPrefix() != null)
497+
sb.append("domainPrefix: ").append(getDomainPrefix()).append(",");
498+
if (getDomainName() != null)
499+
sb.append("domainName: ").append(getDomainName());
341500
sb.append("}");
342501
return sb.toString();
343502
}
@@ -396,6 +555,30 @@ public boolean equals(Object obj) {
396555
return false;
397556
if (other.getOperationName() != null && !other.getOperationName().equals(this.getOperationName()))
398557
return false;
558+
if (other.getExtendedRequestId() == null ^ this.getExtendedRequestId() == null)
559+
return false;
560+
if (other.getExtendedRequestId() != null && other.getExtendedRequestId().equals(this.getExtendedRequestId()) == false)
561+
return false;
562+
if (other.getRequestTime() == null ^ this.getRequestTime() == null)
563+
return false;
564+
if (other.getRequestTime() != null && other.getRequestTime().equals(this.getRequestTime()) == false)
565+
return false;
566+
if (other.getRequestTimeEpoch() == null ^ this.getRequestTimeEpoch() == null)
567+
return false;
568+
if (other.getRequestTimeEpoch() != null && other.getRequestTimeEpoch().equals(this.getRequestTimeEpoch()) == false)
569+
return false;
570+
if (other.getDomainName() == null ^ this.getDomainName() == null)
571+
return false;
572+
if (other.getDomainName() != null && other.getDomainName().equals(this.getDomainName()) == false)
573+
return false;
574+
if (other.getDomainPrefix() == null ^ this.getDomainPrefix() == null)
575+
return false;
576+
if (other.getDomainPrefix() != null && other.getDomainPrefix().equals(this.getDomainPrefix()) == false)
577+
return false;
578+
if (other.getProtocol() == null ^ this.getProtocol() == null)
579+
return false;
580+
if (other.getProtocol() != null && other.getProtocol().equals(this.getProtocol()) == false)
581+
return false;
399582
return true;
400583
}
401584

@@ -415,6 +598,12 @@ public int hashCode() {
415598
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
416599
hashCode = prime * hashCode + ((getAuthorizer() == null) ? 0 : getAuthorizer().hashCode());
417600
hashCode = prime * hashCode + ((getOperationName() == null) ? 0: getOperationName().hashCode());
601+
hashCode = prime * hashCode + ((getExtendedRequestId() == null) ? 0 : getExtendedRequestId().hashCode());
602+
hashCode = prime * hashCode + ((getRequestTime() == null) ? 0 : getRequestTime().hashCode());
603+
hashCode = prime * hashCode + ((getRequestTimeEpoch() == null) ? 0 : getRequestTimeEpoch().hashCode());
604+
hashCode = prime * hashCode + ((getDomainName() == null) ? 0 : getDomainName().hashCode());
605+
hashCode = prime * hashCode + ((getDomainPrefix() == null) ? 0 : getDomainPrefix().hashCode());
606+
hashCode = prime * hashCode + ((getProtocol() == null) ? 0 : getProtocol().hashCode());
418607
return hashCode;
419608
}
420609

0 commit comments

Comments
 (0)