You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

S3Config.java 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*
  2. * Copyright (C) 2015, Matthias Sohn <matthias.sohn@sap.com>
  3. * Copyright (C) 2015, Sasa Zivkov <sasa.zivkov@sap.com> and others
  4. *
  5. * This program and the accompanying materials are made available under the
  6. * terms of the Eclipse Distribution License v. 1.0 which is available at
  7. * https://www.eclipse.org/org/documents/edl-v10.php.
  8. *
  9. * SPDX-License-Identifier: BSD-3-Clause
  10. */
  11. package org.eclipse.jgit.lfs.server.s3;
  12. /**
  13. * Configuration for an Amazon AWS S3 bucket
  14. *
  15. * @since 4.3
  16. */
  17. public class S3Config {
  18. private final String hostname;
  19. private final String region;
  20. private final String bucket;
  21. private final String storageClass;
  22. private final String accessKey;
  23. private final String secretKey;
  24. private final int expirationSeconds;
  25. private final boolean disableSslVerify;
  26. /**
  27. * <p>
  28. * Constructor for S3Config.
  29. * </p>
  30. *
  31. * @param hostname
  32. * S3 API host
  33. * @param region
  34. * AWS region
  35. * @param bucket
  36. * S3 storage bucket
  37. * @param storageClass
  38. * S3 storage class
  39. * @param accessKey
  40. * access key for authenticating to AWS
  41. * @param secretKey
  42. * secret key for authenticating to AWS
  43. * @param expirationSeconds
  44. * period in seconds after which requests signed for this bucket
  45. * will expire
  46. * @param disableSslVerify
  47. * if {@code true} disable Amazon server certificate and hostname
  48. * verification
  49. * @since 5.8
  50. */
  51. public S3Config(String hostname, String region, String bucket, String storageClass,
  52. String accessKey, String secretKey, int expirationSeconds,
  53. boolean disableSslVerify) {
  54. this.hostname = hostname;
  55. this.region = region;
  56. this.bucket = bucket;
  57. this.storageClass = storageClass;
  58. this.accessKey = accessKey;
  59. this.secretKey = secretKey;
  60. this.expirationSeconds = expirationSeconds;
  61. this.disableSslVerify = disableSslVerify;
  62. }
  63. /**
  64. * <p>Constructor for S3Config.</p>
  65. *
  66. * @param region
  67. * AWS region
  68. * @param bucket
  69. * S3 storage bucket
  70. * @param storageClass
  71. * S3 storage class
  72. * @param accessKey
  73. * access key for authenticating to AWS
  74. * @param secretKey
  75. * secret key for authenticating to AWS
  76. * @param expirationSeconds
  77. * period in seconds after which requests signed for this bucket
  78. * will expire
  79. * @param disableSslVerify
  80. * if {@code true} disable Amazon server certificate and hostname
  81. * verification
  82. */
  83. public S3Config(String region, String bucket, String storageClass,
  84. String accessKey, String secretKey, int expirationSeconds,
  85. boolean disableSslVerify) {
  86. this(String.format("s3-%s.amazonaws.com", region), region, bucket, //$NON-NLS-1$
  87. storageClass, accessKey, secretKey, expirationSeconds,
  88. disableSslVerify);
  89. }
  90. /**
  91. * Get the <code>hostname</code>.
  92. *
  93. * @return Get the S3 API host
  94. * @since 5.8
  95. */
  96. public String getHostname() {
  97. return hostname;
  98. }
  99. /**
  100. * Get the <code>region</code>.
  101. *
  102. * @return Get name of AWS region this bucket resides in
  103. */
  104. public String getRegion() {
  105. return region;
  106. }
  107. /**
  108. * Get the <code>bucket</code>.
  109. *
  110. * @return Get S3 storage bucket name
  111. */
  112. public String getBucket() {
  113. return bucket;
  114. }
  115. /**
  116. * Get the <code>storageClass</code>.
  117. *
  118. * @return S3 storage class to use for objects stored in this bucket
  119. */
  120. public String getStorageClass() {
  121. return storageClass;
  122. }
  123. /**
  124. * Get the <code>accessKey</code>.
  125. *
  126. * @return access key for authenticating to AWS
  127. */
  128. public String getAccessKey() {
  129. return accessKey;
  130. }
  131. /**
  132. * Get the <code>secretKey</code>.
  133. *
  134. * @return secret key for authenticating to AWS
  135. */
  136. public String getSecretKey() {
  137. return secretKey;
  138. }
  139. /**
  140. * Get the <code>expirationSeconds</code>.
  141. *
  142. * @return period in seconds after which requests signed for this bucket
  143. * will expire
  144. */
  145. public int getExpirationSeconds() {
  146. return expirationSeconds;
  147. }
  148. /**
  149. * @return {@code true} if Amazon server certificate and hostname
  150. * verification is disabled
  151. */
  152. boolean isDisableSslVerify() {
  153. return disableSslVerify;
  154. }
  155. }