-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from Flared/mahinse/restart_error_message
Rewrote the interfaces of the Splunk object to follow the hierarchy of the Javascript SplunkSDK
- Loading branch information
Showing
5 changed files
with
104 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,65 @@ | ||
export interface SplunkApplicationNamespace { | ||
app?: string; | ||
owner?: string; | ||
sharing?: string; | ||
} | ||
|
||
export interface SplunkPassword { | ||
name: string; | ||
_properties: { | ||
clear_password: string; | ||
}; | ||
} | ||
|
||
export interface SplunkCollectionItem { | ||
export interface KVCollectionItem { | ||
key: string; | ||
value: string; | ||
user: string; | ||
} | ||
|
||
export interface SplunkIndex { | ||
name: string; | ||
} | ||
|
||
export interface SplunkSavedSearch { | ||
name: string; | ||
qualifiedPath: string; | ||
update: (properties: Record<string, string>) => SplunkRequestResponse; | ||
} | ||
|
||
export interface SplunkAppAccessor { | ||
reload: () => void; | ||
} | ||
|
||
export interface Stanza { | ||
name: string; | ||
export interface ApplicationNamespace { | ||
app?: string; | ||
owner?: string; | ||
sharing?: string; | ||
} | ||
|
||
export interface SplunkRequestResponse { | ||
export interface HTTPResponse { | ||
status: number; | ||
data: any; | ||
} | ||
|
||
export interface SplunkAppsAccessor { | ||
fetch: () => SplunkAppsAccessor; | ||
item: (applicationName: string) => SplunkAppAccessor; | ||
export interface Endpoint { | ||
fetch: () => this; | ||
del: (relativePath: string) => HTTPResponse; | ||
qualifiedPath: string; | ||
} | ||
|
||
export interface ConfigurationStanzaAccessor { | ||
fetch: () => ConfigurationStanzaAccessor; | ||
update: (properties: Record<string, string>) => SplunkRequestResponse; | ||
list: () => Array<{ name: string }>; | ||
export interface Resource extends Endpoint { | ||
properties: () => Record<string, string>; | ||
_properties: Record<string, string>; | ||
} | ||
|
||
export interface ConfigurationFileAccessor { | ||
create: (stanzaName: string) => SplunkRequestResponse; | ||
fetch: () => ConfigurationFileAccessor; | ||
item: ( | ||
stanzaName: string, | ||
properties: SplunkApplicationNamespace | ||
) => ConfigurationStanzaAccessor; | ||
list: () => Array<{ name: string }>; | ||
export interface Entity extends Resource { | ||
reload: () => void; | ||
update: (properties: Record<string, string>) => HTTPResponse; | ||
name: string; | ||
} | ||
|
||
export interface ConfigurationsAccessor { | ||
fetch: () => ConfigurationsAccessor; | ||
create: (configurationFilename: string) => SplunkRequestResponse; | ||
item: (stanzaName: string, properties: SplunkApplicationNamespace) => ConfigurationFileAccessor; | ||
list: () => Array<{ name: string }>; | ||
export interface Collection<T extends Entity | Collection<Entity>> extends Resource { | ||
item: (itemName: string, namespace: ApplicationNamespace) => T; | ||
list: () => Array<T>; | ||
} | ||
|
||
export interface ConfigurationFile extends Collection<Entity> { | ||
create: (stanzaName: string) => HTTPResponse; | ||
name: string; | ||
} | ||
|
||
export interface SplunkIndexesAccessor { | ||
fetch: () => SplunkIndexesAccessor; | ||
create: (indexName: string, data: any) => SplunkRequestResponse; | ||
item: (indexName: string) => SplunkIndex; | ||
list: () => Array<SplunkIndex>; | ||
export interface Configurations extends Collection<ConfigurationFile> { | ||
create: (configurationFilename: string) => HTTPResponse; | ||
} | ||
|
||
export interface SplunkSavedSearchAccessor { | ||
fetch: () => SplunkSavedSearchAccessor; | ||
create: (indexName: string, data: any) => SplunkRequestResponse; | ||
item: (indexName: string) => SplunkSavedSearch; | ||
list: () => Array<SplunkSavedSearch>; | ||
export interface Indexes extends Collection<Entity> { | ||
create: (indexName: string, data: any) => HTTPResponse; | ||
} | ||
|
||
export interface SplunkStoragePasswordAccessors { | ||
fetch: () => SplunkStoragePasswordAccessors; | ||
item: (applicationName: string) => SplunkAppAccessor; | ||
list: () => Array<SplunkPassword>; | ||
del: (passwordId: string) => SplunkRequestResponse; | ||
create: (params: { name: string; realm: string; password: string }) => SplunkRequestResponse; | ||
export interface StoragePasswords extends Collection<Entity> { | ||
create: (params: { name: string; realm: string; password: string }) => HTTPResponse; | ||
} | ||
|
||
export interface SplunkService { | ||
configurations: (params: SplunkApplicationNamespace) => ConfigurationsAccessor; | ||
apps: () => SplunkAppsAccessor; | ||
storagePasswords: () => SplunkStoragePasswordAccessors; | ||
indexes: () => SplunkIndexesAccessor; | ||
savedSearches: () => SplunkSavedSearchAccessor; | ||
get: (splunkUrlPath: string, data: any) => SplunkRequestResponse; | ||
post: (splunkUrlPath: string, data: any) => SplunkRequestResponse; | ||
export interface Service { | ||
configurations: (params: ApplicationNamespace) => Configurations; | ||
apps: () => Collection<Entity>; | ||
storagePasswords: () => StoragePasswords; | ||
indexes: () => Indexes; | ||
savedSearches: () => Collection<Entity>; | ||
serverInfo: () => any; | ||
get: (splunkUrlPath: string, data: any) => HTTPResponse; | ||
post: (splunkUrlPath: string, data: any) => HTTPResponse; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.