Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ jobs:
server-id: splunk-artifactory
- name: build
run: mvn package --file pom.xml -DskipTests=true
- name: Create temp artifacts apidocs folder
run: mkdir apidocs
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
Expand All @@ -35,11 +33,8 @@ jobs:
MAVEN_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}

- name: Zip docs
run: zip -r apidocs/docs.zip splunk/target/apidocs

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: apidocs
path: apidocs/docs.zip
name: java_sdk_docs
path: splunk/target/apidocs
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Splunk Enterprise SDK for Java Changelog

## Version 1.9.2

### New Features and APIs
* Added feature that allows to update ACL properties of an entity (GitHub PR [#196](https://github.com/splunk/splunk-sdk-java/pull/196))

### Minor Changes
* 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))

## Version 1.9.1

### New Features and APIs
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![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)
# The Splunk Software Development Kit for Java

#### Version 1.9.1
#### Version 1.9.2

The Splunk Software Development Kit (SDK) for Java contains library code and
examples designed to enable developers to build applications using Splunk.
Expand Down Expand Up @@ -75,7 +75,7 @@ To add the Splunk SDK for Java `.JAR` file as a dependency:
<dependency>
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
<version>1.9.1</version>
<version>1.9.2</version>
</dependency>
</dependencies>
```
Expand Down
2 changes: 1 addition & 1 deletion deploy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare -r scriptDirectory="$(dirname $(readlink -e $0))"
declare -r scriptName="$(basename $0)"
declare -r version="1.9.1"
declare -r version="1.9.2"

if [[ $# -ne 1 ]]; then
echo 1>&2 "Usage: ${scriptName} {local|staging||production}"
Expand Down
30 changes: 15 additions & 15 deletions deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ deploy \<repository-name>

##DESCRIPTION

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

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

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

com/splunk/splunk/1.9.1/
├── splunk-1.9.1-javadoc.jar
├── splunk-1.9.1-javadoc.jar.md5
├── splunk-1.9.1-javadoc.jar.sha1
├── splunk-1.9.1-sources.jar
├── splunk-1.9.1-sources.jar.md5
├── splunk-1.9.1-sources.jar.sha1
├── splunk-1.9.1.jar
├── splunk-1.9.1.jar.md5
├── splunk-1.9.1.jar.sha1
├── splunk-1.9.1.pom
├── splunk-1.9.1.pom.md5
└── splunk-1.9.1.pom.sha1
com/splunk/splunk/1.9.2/
├── splunk-1.9.2-javadoc.jar
├── splunk-1.9.2-javadoc.jar.md5
├── splunk-1.9.2-javadoc.jar.sha1
├── splunk-1.9.2-sources.jar
├── splunk-1.9.2-sources.jar.md5
├── splunk-1.9.2-sources.jar.sha1
├── splunk-1.9.2.jar
├── splunk-1.9.2.jar.md5
├── splunk-1.9.2.jar.sha1
├── splunk-1.9.2.pom
├── splunk-1.9.2.pom.md5
└── splunk-1.9.2.pom.sha1

Verify this structure prior to release.
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>com.splunk</groupId>
<artifactId>splunk</artifactId>
<version>1.9.1</version>
<version>1.9.2</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>

<properties>
<version.number>1.9.1</version.number>
<version.number>1.9.2</version.number>
<maven.resources.overwrite>true</maven.resources.overwrite>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
Expand Down
2 changes: 1 addition & 1 deletion splunk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>splunk</artifactId>
<version>1.9.1</version>
<version>1.9.2</version>
<parent>
<artifactId>splunk-sdk-java</artifactId>
<groupId>com.splunk</groupId>
Expand Down
22 changes: 22 additions & 0 deletions splunk/src/main/java/com/splunk/Entity.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ protected String actionPath(String action) {
return path + "/enable";
if (action.equals("remove"))
return path;
if (action.equals("acl"))
return path + "/acl";
throw new IllegalArgumentException("Invalid action: " + action);
}

Expand Down Expand Up @@ -450,6 +452,26 @@ public void update() {
update(Collections.EMPTY_MAP);
}


/**
* Update the access control list (ACL) properties for this entity,
*
* @param args: Properties to update for this entity.
* Required Properties in 'args'
* - `owner`: The Splunk username, such as "admin". A value of "nobody" means no specific user.
* - `sharing`: A mode that indicates how the resource is shared. The sharing mode can be "user", "app", "global", or "system".
*/
public void aclUpdate(Map<String, Object> args){
if(!args.containsKey("sharing")){
throw new IllegalArgumentException("Required argument 'sharing' is missing.");
}
if(!args.containsKey("owner")){
throw new IllegalArgumentException("Required argument 'owner' is missing.");
}
service.post(actionPath("acl"), args);
invalidate();
}

/**
* Removes this entity from its corresponding collection.
*/
Expand Down
2 changes: 1 addition & 1 deletion splunk/src/main/java/com/splunk/HttpService.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public boolean verify(String s, SSLSession sslSession) {
private String prefix = null;

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

Expand Down
6 changes: 4 additions & 2 deletions splunk/src/main/java/com/splunk/modularinput/XmlUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ class XmlUtil {
*/
static String textInNode(Node node, String errorMessage) throws MalformedDataException {
Node child = node.getFirstChild();
if (child.getNodeType() != Node.TEXT_NODE) {
if (null == child) {
return "";
} else if (child.getNodeType() != Node.TEXT_NODE) {
throw new MalformedDataException(errorMessage);
} else {
return ((Text)child).getData();
return ((Text) child).getData();
}
}

Expand Down
32 changes: 32 additions & 0 deletions splunk/src/test/java/com/splunk/SavedSearchTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,38 @@ public void testCannotUpdateName() {
} catch (Exception e) {}
}

@Test
public void testACLUpdates(){
Record aclInfo = savedSearch.getMetadata().getEaiAcl();
Assert.assertNotEquals(aclInfo.getString("sharing"), "app");
Assert.assertNotEquals(aclInfo.getString("owner"), "nobody");
Assert.assertNull(aclInfo.get("perms"));
Args args = new Args();
args.add("sharing","app");
args.add("owner","nobody");
args.add("app","search");
args.add("perms.read","admin, nobody");
savedSearch.aclUpdate(args);
aclInfo = savedSearch.getMetadata().getEaiAcl();
Assert.assertEquals(aclInfo.getString("sharing"), "app");
Assert.assertEquals(aclInfo.getString("owner"), "nobody");
Assert.assertNotNull(aclInfo.get("perms"));
}

@Test
public void testACLUpdateWithoutSharing(){
Args args = new Args();
args.add("owner","nobody");
args.add("app","search");
Assert.assertThrows("Required argument 'sharing' is missing.", IllegalArgumentException.class, () -> {savedSearch.aclUpdate(args);});
}

@Test
public void testACLUpdateWithoutOwner(){
Args args = new Args();
Assert.assertThrows("Required argument 'owner' is missing.", IllegalArgumentException.class, () -> {savedSearch.aclUpdate(args);});
}

@Test
public void testDispatch() {
final JobCollection jobs = service.getJobs();
Expand Down