2222import static org .apache .cloudstack .api .ApiConstants .S3_ACCESS_KEY ;
2323import static org .apache .cloudstack .api .ApiConstants .S3_BUCKET_NAME ;
2424import static org .apache .cloudstack .api .ApiConstants .S3_CONNECTION_TIMEOUT ;
25+ import static org .apache .cloudstack .api .ApiConstants .S3_CONNECTION_TTL ;
2526import static org .apache .cloudstack .api .ApiConstants .S3_END_POINT ;
2627import static org .apache .cloudstack .api .ApiConstants .S3_HTTPS_FLAG ;
2728import static org .apache .cloudstack .api .ApiConstants .S3_MAX_ERROR_RETRY ;
2829import static org .apache .cloudstack .api .ApiConstants .S3_SECRET_KEY ;
2930import static org .apache .cloudstack .api .ApiConstants .S3_SOCKET_TIMEOUT ;
31+ import static org .apache .cloudstack .api .ApiConstants .S3_USE_TCP_KEEPALIVE ;
3032import static org .apache .cloudstack .api .BaseCmd .CommandType .BOOLEAN ;
3133import static org .apache .cloudstack .api .BaseCmd .CommandType .INTEGER ;
3234import static org .apache .cloudstack .api .BaseCmd .CommandType .STRING ;
@@ -83,6 +85,12 @@ public final class AddS3Cmd extends BaseCmd {
8385 @ Parameter (name = S3_SOCKET_TIMEOUT , type = INTEGER , required = false , description = "socket timeout (milliseconds)" )
8486 private final Integer socketTimeout = null ;
8587
88+ @ Parameter (name = S3_CONNECTION_TTL , type = INTEGER , required = false , description = "connection ttl (milliseconds)" )
89+ private final Integer connectionTtl = null ;
90+
91+ @ Parameter (name = S3_USE_TCP_KEEPALIVE , type = BOOLEAN , required = false , description = "whether tcp keepalive is used" )
92+ private final Boolean useTCPKeepAlive = null ;
93+
8694 @ Override
8795 public void execute () throws ResourceUnavailableException , InsufficientCapacityException , ServerApiException , ConcurrentOperationException ,
8896 ResourceAllocationException , NetworkRuleConflictException {
@@ -104,6 +112,12 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
104112 if (getSocketTimeout () != null ) {
105113 dm .put (ApiConstants .S3_SOCKET_TIMEOUT , getSocketTimeout ().toString ());
106114 }
115+ if (getConnectionTtl () != null ) {
116+ dm .put (ApiConstants .S3_CONNECTION_TTL , getConnectionTtl ().toString ());
117+ }
118+ if (getUseTCPKeepAlive () != null ) {
119+ dm .put (ApiConstants .S3_USE_TCP_KEEPALIVE , getUseTCPKeepAlive ().toString ());
120+ }
107121
108122
109123 try {
@@ -168,6 +182,14 @@ public boolean equals(final Object thatObject) {
168182 return false ;
169183 }
170184
185+ if (connectionTtl != null ? !connectionTtl .equals (thatAddS3Cmd .connectionTtl ) : thatAddS3Cmd .connectionTtl != null ) {
186+ return false ;
187+ }
188+
189+ if (useTCPKeepAlive != null ? !useTCPKeepAlive .equals (thatAddS3Cmd .useTCPKeepAlive ) : thatAddS3Cmd .useTCPKeepAlive != null ) {
190+ return false ;
191+ }
192+
171193 return true ;
172194
173195 }
@@ -183,6 +205,8 @@ public int hashCode() {
183205 result = 31 * result + (connectionTimeout != null ? connectionTimeout .hashCode () : 0 );
184206 result = 31 * result + (maxErrorRetry != null ? maxErrorRetry .hashCode () : 0 );
185207 result = 31 * result + (socketTimeout != null ? socketTimeout .hashCode () : 0 );
208+ result = 31 * result + (connectionTtl != null ? connectionTtl .hashCode () : 0 );
209+ result = 31 * result + (useTCPKeepAlive != null && useTCPKeepAlive == true ? 1 : 0 );
186210
187211 return result ;
188212
@@ -230,4 +254,11 @@ public Integer getSocketTimeout() {
230254 return socketTimeout ;
231255 }
232256
257+ public Integer getConnectionTtl () {
258+ return connectionTtl ;
259+ }
260+
261+ public Boolean getUseTCPKeepAlive () {
262+ return useTCPKeepAlive ;
263+ }
233264}
0 commit comments