init

splunkjs.Service.PropertyStanza.init

Constructor for splunkjs.Service.PropertyStanza

Syntax

init: function(service, file, name)

Parameters

Name Type Description
service splunkjs.Service

A service instance

name String

The name of the index

Return

splunkjs.Service.PropertyStanza. A splunkjs.Service.PropertyStanza instance

path

splunkjs.Service.PropertyStanza.path

REST path for this resource (with no namespace)

Syntax

path: function()

refreshOnUpdate

splunkjs.Service.PropertyStanza.refreshOnUpdate

Whether or not to call refresh() after an update to fetch the updated item.

updated

splunkjs.Service.Entity.updated

Retrieve the updated time for this entity

Syntax

updated: function()

Return

String. The updated time for this entity

reload

splunkjs.Service.Entity.reload

Reload the entity

This will reload the entity on the server.

Syntax

reload: function(callback)

Parameters

Name Type Description
callback Function

A callback when the object is reloaded: (err, entity)

refresh

splunkjs.Service.Entity.refresh

Refresh the resource

This will unconditionally refresh the object from the server and load it up.

Syntax

refresh: function(options, callback)

Parameters

Name Type Description
options Object

Optional dictionary of collection filtering and pagination options

callback Function

A callback when the object is retrieved: (err, resource)

fields

splunkjs.Service.Entity.fields

Retrieve the fields information for this entity

Syntax

fields: function()

Return

Object. The fields for this entity

enable

splunkjs.Service.Entity.enable

Enable the entity

This will enable the entity on the server.

Syntax

enable: function(callback)

Parameters

Name Type Description
callback Function

A callback when the object is enabled: (err, entity)

disable

splunkjs.Service.Entity.disable

Disable the entity

This will disable the entity on the server.

Syntax

disable: function(callback)

Parameters

Name Type Description
callback Function

A callback when the object is disabled: (err, entity)

update

splunkjs.Service.Entity.update

Update the entity

This will update the entity on the server.

Syntax

update: function(props, callback)

Parameters

Name Type Description
props Object

Properties to be updated the object with.

callback Function

A callback when the object is updated: (err, entity)

remove

splunkjs.Service.Entity.remove

Delete the entity

This will tell the server to delete this entity.

Syntax

remove: function(callback)

Parameters

Name Type Description
callback Function

A callback when the object is deleted: (err)

acl

splunkjs.Service.Entity.acl

Retrieve the ACL information for this entity

Syntax

acl: function()

Return

Object. The ACL for this entity

published

splunkjs.Service.Entity.published

Retrieve the published time for this entity

Syntax

published: function()

Return

String. The published time for this entity

_load

splunkjs.Service.Entity._load

Load the resource, also storing the properties.

Syntax

_load: function(properties)

Parameters

Name Type Description
properties Object

The properties for this resource

author

splunkjs.Service.Entity.author

Retrieve the author information for this entity

Syntax

author: function()

Return

String. The author for this entity

state

splunkjs.Service.Resource.state

Retrieve the state for this resource

This will retrieve the current full state for this resource.

Syntax

state: function()

Return

Object. The full state for this resource

properties

splunkjs.Service.Resource.properties

Retrieve the properties for this resource

This will retrieve the current properties for this resource.

Syntax

properties: function()

Return

Object. The properties for this resource

del

splunkjs.Service.Endpoint.del

Perform a relative DELETE request

Perform a relative DELETE request on this endpoint's path, combined with the parameters and a relative path if specified.

Syntax

del: function(relpath, params, callback)

Parameters

Name Type Description
relpath String

A relative path to append at the end of the path

params Object

A dictionary of parameters to add to the query string

callback Function

A callback to be invoked when the request is complete: (err, response)

Examples

 // Will make a request to {service.prefix}/search/jobs/123456
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.delete("", {}, function() { console.log("DELETED"))});

post

splunkjs.Service.Endpoint.post

Perform a relative POST request

Perform a relative POST request on this endpoint's path, combined with the parameters and a relative path if specified.

Syntax

post: function(relpath, params, callback)

Parameters

Name Type Description
relpath String

A relative path to append at the end of the path

params Object

A dictionary of parameters to add to the body

callback Function

A callback to be invoked when the request is complete: (err, response)

Examples

 // Will make a request to {service.prefix}/search/jobs/123456/control
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.post("control", {action: "cancel"}, function() { console.log("CANCELLED"))});

get

splunkjs.Service.Endpoint.get

Perform a relative GET request

Perform a relative GET request on this endpoint's path, combined with the parameters and a relative path if specified.

Syntax

get: function(relpath, params, callback)

Parameters

Name Type Description
relpath String

A relative path to append at the end of the path

params Object

A dictionary of parameters to add to the query string

callback Function

A callback to be invoked when the request is complete: (err, response)

Examples

 // Will make a request to {service.prefix}/search/jobs/123456/results?offset=1
 var endpoint = new splunkjs.Service.Endpoint(service, "search/jobs/12345");
 endpoint.get("results", {offset: 1}, function() { console.log("DONE"))});