Skip to content

Commit 2452ea6

Browse files
authored
Merge pull request #200 from splunk/Release/1.9.2
Release/1.9.2
2 parents 305e6aa + df4ea50 commit 2452ea6

File tree

12 files changed

+90
-31
lines changed

12 files changed

+90
-31
lines changed

.github/workflows/release.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ jobs:
1919
server-id: splunk-artifactory
2020
- name: build
2121
run: mvn package --file pom.xml -DskipTests=true
22-
- name: Create temp artifacts apidocs folder
23-
run: mkdir apidocs
2422
- name: Create GitHub Release
2523
uses: softprops/action-gh-release@v1
2624
with:
@@ -35,11 +33,8 @@ jobs:
3533
MAVEN_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
3634
MAVEN_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
3735

38-
- name: Zip docs
39-
run: zip -r apidocs/docs.zip splunk/target/apidocs
40-
4136
- name: Upload Artifact
4237
uses: actions/upload-artifact@v3
4338
with:
44-
name: apidocs
45-
path: apidocs/docs.zip
39+
name: java_sdk_docs
40+
path: splunk/target/apidocs

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Splunk Enterprise SDK for Java Changelog
22

3+
## Version 1.9.2
4+
5+
### New Features and APIs
6+
* Added feature that allows to update ACL properties of an entity (GitHub PR [#196](https://github.com/splunk/splunk-sdk-java/pull/196))
7+
8+
### Minor Changes
9+
* Added null check for child to handle error when no value is passed for a parameter in modular-inputs (Ref issue [#198](https://github.com/splunk/splunk-sdk-java/issues/198) & GitHub PR [#199](https://github.com/splunk/splunk-sdk-java/pull/199))
10+
311
## Version 1.9.1
412

513
### New Features and APIs

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Java SDK Test](https://github.com/splunk/splunk-sdk-java/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/splunk/splunk-sdk-java/actions/workflows/test.yml)
22
# The Splunk Software Development Kit for Java
33

4-
#### Version 1.9.1
4+
#### Version 1.9.2
55

66
The Splunk Software Development Kit (SDK) for Java contains library code and
77
examples designed to enable developers to build applications using Splunk.
@@ -75,7 +75,7 @@ To add the Splunk SDK for Java `.JAR` file as a dependency:
7575
<dependency>
7676
<groupId>com.splunk</groupId>
7777
<artifactId>splunk</artifactId>
78-
<version>1.9.1</version>
78+
<version>1.9.2</version>
7979
</dependency>
8080
</dependencies>
8181
```

deploy

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
declare -r scriptDirectory="$(dirname $(readlink -e $0))"
44
declare -r scriptName="$(basename $0)"
5-
declare -r version="1.9.1"
5+
declare -r version="1.9.2"
66

77
if [[ $# -ne 1 ]]; then
88
echo 1>&2 "Usage: ${scriptName} {local|staging||production}"

deploy.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ deploy \<repository-name>
99

1010
##DESCRIPTION
1111

12-
Deploy transmits **target/splunk-1.9.1.jar**, **target/splunk-1.9.1-javadoc.jar**, and
13-
**target/splunk-1.9.1-sources.jar** to the **local**, **staging**, or **production**
12+
Deploy transmits **target/splunk-1.9.2.jar**, **target/splunk-1.9.2-javadoc.jar**, and
13+
**target/splunk-1.9.2-sources.jar** to the **local**, **staging**, or **production**
1414
maven repository. Repository names are mapped to locations as follows.
1515

1616
| repository-name | location |
@@ -21,18 +21,18 @@ maven repository. Repository names are mapped to locations as follows.
2121

2222
After deployment you should find this tree structure at the location of your repository
2323

24-
com/splunk/splunk/1.9.1/
25-
├── splunk-1.9.1-javadoc.jar
26-
├── splunk-1.9.1-javadoc.jar.md5
27-
├── splunk-1.9.1-javadoc.jar.sha1
28-
├── splunk-1.9.1-sources.jar
29-
├── splunk-1.9.1-sources.jar.md5
30-
├── splunk-1.9.1-sources.jar.sha1
31-
├── splunk-1.9.1.jar
32-
├── splunk-1.9.1.jar.md5
33-
├── splunk-1.9.1.jar.sha1
34-
├── splunk-1.9.1.pom
35-
├── splunk-1.9.1.pom.md5
36-
└── splunk-1.9.1.pom.sha1
24+
com/splunk/splunk/1.9.2/
25+
├── splunk-1.9.2-javadoc.jar
26+
├── splunk-1.9.2-javadoc.jar.md5
27+
├── splunk-1.9.2-javadoc.jar.sha1
28+
├── splunk-1.9.2-sources.jar
29+
├── splunk-1.9.2-sources.jar.md5
30+
├── splunk-1.9.2-sources.jar.sha1
31+
├── splunk-1.9.2.jar
32+
├── splunk-1.9.2.jar.md5
33+
├── splunk-1.9.2.jar.sha1
34+
├── splunk-1.9.2.pom
35+
├── splunk-1.9.2.pom.md5
36+
└── splunk-1.9.2.pom.sha1
3737

3838
Verify this structure prior to release.

examples/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<dependency>
3838
<groupId>com.splunk</groupId>
3939
<artifactId>splunk</artifactId>
40-
<version>1.9.1</version>
40+
<version>1.9.2</version>
4141
<scope>provided</scope>
4242
</dependency>
4343
<dependency>

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77

88
<properties>
9-
<version.number>1.9.1</version.number>
9+
<version.number>1.9.2</version.number>
1010
<maven.resources.overwrite>true</maven.resources.overwrite>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1212
<maven.compiler.source>8</maven.compiler.source>

splunk/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<artifactId>splunk</artifactId>
8-
<version>1.9.1</version>
8+
<version>1.9.2</version>
99
<parent>
1010
<artifactId>splunk-sdk-java</artifactId>
1111
<groupId>com.splunk</groupId>

splunk/src/main/java/com/splunk/Entity.java

+22
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ protected String actionPath(String action) {
5050
return path + "/enable";
5151
if (action.equals("remove"))
5252
return path;
53+
if (action.equals("acl"))
54+
return path + "/acl";
5355
throw new IllegalArgumentException("Invalid action: " + action);
5456
}
5557

@@ -450,6 +452,26 @@ public void update() {
450452
update(Collections.EMPTY_MAP);
451453
}
452454

455+
456+
/**
457+
* Update the access control list (ACL) properties for this entity,
458+
*
459+
* @param args: Properties to update for this entity.
460+
* Required Properties in 'args'
461+
* - `owner`: The Splunk username, such as "admin". A value of "nobody" means no specific user.
462+
* - `sharing`: A mode that indicates how the resource is shared. The sharing mode can be "user", "app", "global", or "system".
463+
*/
464+
public void aclUpdate(Map<String, Object> args){
465+
if(!args.containsKey("sharing")){
466+
throw new IllegalArgumentException("Required argument 'sharing' is missing.");
467+
}
468+
if(!args.containsKey("owner")){
469+
throw new IllegalArgumentException("Required argument 'owner' is missing.");
470+
}
471+
service.post(actionPath("acl"), args);
472+
invalidate();
473+
}
474+
453475
/**
454476
* Removes this entity from its corresponding collection.
455477
*/

splunk/src/main/java/com/splunk/HttpService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public boolean verify(String s, SSLSession sslSession) {
8989
private String prefix = null;
9090

9191
static Map<String, String> defaultHeader = new HashMap<String, String>() {{
92-
put("User-Agent", "splunk-sdk-java/1.9.1");
92+
put("User-Agent", "splunk-sdk-java/1.9.2");
9393
put("Accept", "*/*");
9494
}};
9595

splunk/src/main/java/com/splunk/modularinput/XmlUtil.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ class XmlUtil {
3535
*/
3636
static String textInNode(Node node, String errorMessage) throws MalformedDataException {
3737
Node child = node.getFirstChild();
38-
if (child.getNodeType() != Node.TEXT_NODE) {
38+
if (null == child) {
39+
return "";
40+
} else if (child.getNodeType() != Node.TEXT_NODE) {
3941
throw new MalformedDataException(errorMessage);
4042
} else {
41-
return ((Text)child).getData();
43+
return ((Text) child).getData();
4244
}
4345
}
4446

splunk/src/test/java/com/splunk/SavedSearchTest.java

+32
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,38 @@ public void testCannotUpdateName() {
360360
} catch (Exception e) {}
361361
}
362362

363+
@Test
364+
public void testACLUpdates(){
365+
Record aclInfo = savedSearch.getMetadata().getEaiAcl();
366+
Assert.assertNotEquals(aclInfo.getString("sharing"), "app");
367+
Assert.assertNotEquals(aclInfo.getString("owner"), "nobody");
368+
Assert.assertNull(aclInfo.get("perms"));
369+
Args args = new Args();
370+
args.add("sharing","app");
371+
args.add("owner","nobody");
372+
args.add("app","search");
373+
args.add("perms.read","admin, nobody");
374+
savedSearch.aclUpdate(args);
375+
aclInfo = savedSearch.getMetadata().getEaiAcl();
376+
Assert.assertEquals(aclInfo.getString("sharing"), "app");
377+
Assert.assertEquals(aclInfo.getString("owner"), "nobody");
378+
Assert.assertNotNull(aclInfo.get("perms"));
379+
}
380+
381+
@Test
382+
public void testACLUpdateWithoutSharing(){
383+
Args args = new Args();
384+
args.add("owner","nobody");
385+
args.add("app","search");
386+
Assert.assertThrows("Required argument 'sharing' is missing.", IllegalArgumentException.class, () -> {savedSearch.aclUpdate(args);});
387+
}
388+
389+
@Test
390+
public void testACLUpdateWithoutOwner(){
391+
Args args = new Args();
392+
Assert.assertThrows("Required argument 'owner' is missing.", IllegalArgumentException.class, () -> {savedSearch.aclUpdate(args);});
393+
}
394+
363395
@Test
364396
public void testDispatch() {
365397
final JobCollection jobs = service.getJobs();

0 commit comments

Comments
 (0)