logstash-input-google_cloud_storage 0.13.0-java → 0.14.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8266dd28a3bf6c8ccb71007d44aa08749138300851d2fbe8505fb8354fec414
4
- data.tar.gz: 53107f4d0597aa6faa20514dc1bd43cca2d565ddd19212f9c19d7a88c4ce7be4
3
+ metadata.gz: d5deb7203755cea341c28b9ae42f8e62605c0c4ac3880ae1ecb58fd4f92cda63
4
+ data.tar.gz: dba78aed232fa56d67341ad5e4e3dd6a7361d42c2df2ae040f4795cc63dbcd90
5
5
  SHA512:
6
- metadata.gz: a0961a7c380c9b539f2ce5f80055eec6413a0893789dc5db4cf91452f4baed5d04873125a8af4e4a9141bdb1949338606cbad4634276125abdc1a0188522d757
7
- data.tar.gz: c01c3314bbb5bf73e905084ec2afb7fdaaf813077e63bf72d2b6f473025ef5c86ae0f4008fcff7e836cf7740ba773d571d0f2f2396b36b29efb91a7df1905e94
6
+ metadata.gz: 93c2a0b32fea57e63490d67bd3ff6995d58c8f1dcceec472435d073751d5aed8bfd0202a5e42cf872562c3d9d798cc88d0cf6ebdfba3cd6652c53c18654a1786
7
+ data.tar.gz: f9edbf2e175a54ac412bff1fb6b516381875c8a72188bfbbe2c8039905c64a70238ca7a89432d090edfe09ec2fad86a0261c37da62d66d20f0c354c17cd732b8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.14.0
2
+ - Feature, update so that unauthenticated client can access public buckets [#24](https://github.com/logstash-plugins/logstash-input-google_cloud_storage/pull/24)
3
+
1
4
  ## 0.13.0
2
5
  - Updated Google Cloud Storage client library, from `1.118.1` to `2.12.0` [#21](https://github.com/logstash-plugins/logstash-output-google_cloud_storage/pull/21)
3
6
 
data/README.md CHANGED
@@ -26,19 +26,29 @@ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/log
26
26
 
27
27
  ## Developing
28
28
 
29
- ### 1. Plugin Developement and Testing
29
+ ### 1. Plugin Development and Testing
30
30
 
31
31
  #### Code
32
+
32
33
  - To get started, you'll need JRuby with the Bundler gem installed.
34
+ - You'll also need a Logstash installation to build the plugin against.
33
35
 
34
36
  - Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).
37
+ - `export LOGSTASH_SOURCE=1` and point `LOGSTASH_PATH` to a local Logstash
38
+ e.g. `export LOGSTASH_PATH=/opt/local/logstash-8.7.0`
35
39
 
36
- - Install dependencies
40
+ - Install Ruby dependencies
37
41
  ```sh
38
42
  bundle install
39
- bundle exec rake vendor
40
43
  ```
41
44
 
45
+ - Install Java dependencies - regenerates the *lib/logstash-input-google_cloud_storage_jars.rb*
46
+ script used to load the .jar dependencies when the plugin starts.
47
+ ```sh
48
+ ./gradlew vendor
49
+ ```
50
+ NOTE: This step is necessary whenever **build.gradle** is updated.
51
+
42
52
  #### Test
43
53
 
44
54
  - Update your dependencies
@@ -47,7 +57,7 @@ bundle exec rake vendor
47
57
  bundle install
48
58
  ```
49
59
 
50
- - Run tests
60
+ - Run Ruby tests
51
61
 
52
62
  ```sh
53
63
  bundle exec rspec
data/docs/index.asciidoc CHANGED
@@ -56,6 +56,8 @@ To manually install the "mimemagic" gem into Logstash use:
56
56
  bin/ruby -S gem install mimemagic -v '>= 0.3.7'
57
57
  ----------------------------------
58
58
 
59
+ The mimemagic gem also requires the `shared-mime-info` package to be present, it can be installed using `apt-get install shared-mime-info` on Debian/Ubuntu or `yum install shared-mime-info` on Red Hat/RockyOS distributions.
60
+
59
61
  Then install the plugin as usual with:
60
62
  [source,bash]
61
63
  ----------------------------------
@@ -217,8 +219,9 @@ The bucket containing your log files.
217
219
  * There is no default value for this setting.
218
220
 
219
221
  The path to the key to authenticate your user to the bucket.
220
- This service user _should_ have the `storage.objects.update` permission so it can
221
- create metadata on the object preventing it from being scanned multiple times.
222
+ This service user _should_ have the `storage.objects.update` permission so it can create metadata on the object preventing it from being scanned multiple times.
223
+
224
+ If no key is provided the plugin will try to use the https://cloud.google.com/java/docs/reference/google-auth-library/latest/com.google.auth.oauth2.GoogleCredentials#com_google_auth_oauth2_GoogleCredentials_getApplicationDefault__[default application credentials], and if they don't exist, it falls back to unauthenticated mode.
222
225
 
223
226
  [id="plugins-{type}s-{plugin}-interval"]
224
227
  ===== `interval`
@@ -27,24 +27,41 @@ module LogStash
27
27
  end
28
28
 
29
29
  private
30
-
30
+
31
+
31
32
  def initialize_storage(json_key_path)
32
- com.google.cloud.storage.StorageOptions.newBuilder()
33
- .setCredentials(credentials(json_key_path))
34
- .setHeaderProvider(http_headers)
35
- .setRetrySettings(retry_settings)
36
- .build()
37
- .getService()
33
+ builder = setup_builder_from_credentials(json_key_path)
34
+ builder.setHeaderProvider(http_headers)
35
+ .setRetrySettings(retry_settings)
36
+ .build()
37
+ .getService()
38
38
  end
39
-
39
+
40
40
  java_import 'com.google.auth.oauth2.GoogleCredentials'
41
- def credentials(json_key_path)
42
- return GoogleCredentials.getApplicationDefault() if json_key_path.empty?
41
+ def setup_builder_from_credentials(json_key_path)
42
+ # initialize the StorageOptions builder
43
+ builder = com.google.cloud.storage.StorageOptions.newBuilder()
43
44
 
44
- key_file = java.io.FileInputStream.new(json_key_path)
45
- GoogleCredentials.fromStream(key_file)
45
+ # initialize it normally if a json_key_path is provided
46
+ if !json_key_path.empty?
47
+ key_file = java.io.FileInputStream.new(json_key_path)
48
+ builder.setCredentials(GoogleCredentials.fromStream(key_file))
49
+ else
50
+ # if a json_key_path is not provided, try using the getApplicationDefault, normally
51
+ # using GOOGLE_APPLICATION_CREDENTIALS env variable
52
+ begin
53
+ builder.setCredentials(GoogleCredentials.getApplicationDefault())
54
+ rescue Java::JavaIo::IOException => e
55
+ # an IOException is generated if no default credentials exist, trying unauthenticated
56
+ builder = com.google.cloud.storage.StorageOptions.getUnauthenticatedInstance()
57
+ .toBuilder()
58
+ end
59
+ end
60
+ return builder
46
61
  end
47
62
 
63
+
64
+
48
65
  java_import 'com.google.api.gax.rpc.FixedHeaderProvider'
49
66
  def http_headers
50
67
  gem_name = 'logstash-input-google_cloud_storage'
@@ -35,4 +35,4 @@ require_jar('com.google.protobuf', 'protobuf-java-util', '3.21.6')
35
35
  require_jar('org.threeten', 'threetenbp', '1.6.1')
36
36
  require_jar('com.fasterxml.jackson.core', 'jackson-core', '2.13.4')
37
37
  require_jar('com.google.code.findbugs', 'jsr305', '3.0.2')
38
- require_jar('org.logstash.inputs', 'plugin', '0.13.0')
38
+ require_jar('org.logstash.inputs', 'plugin', '0.14.0')
data/version CHANGED
@@ -1 +1 @@
1
- 0.13.0
1
+ 0.14.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-google_cloud_storage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-11-22 00:00:00.000000000 Z
12
+ date: 2023-05-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  requirement: !ruby/object:Gem::Requirement
@@ -182,7 +182,7 @@ files:
182
182
  - vendor/jar-dependencies/io/opencensus/opencensus-contrib-http-util/0.31.1/opencensus-contrib-http-util-0.31.1.jar
183
183
  - vendor/jar-dependencies/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar
184
184
  - vendor/jar-dependencies/org/checkerframework/checker-qual/3.25.0/checker-qual-3.25.0.jar
185
- - vendor/jar-dependencies/org/logstash/inputs/plugin/0.13.0/plugin-0.13.0.jar
185
+ - vendor/jar-dependencies/org/logstash/inputs/plugin/0.14.0/plugin-0.14.0.jar
186
186
  - vendor/jar-dependencies/org/threeten/threetenbp/1.6.1/threetenbp-1.6.1.jar
187
187
  - version
188
188
  homepage: http://www.elastic.co/guide/en/logstash/current/index.html