Skip to content

Commit

Permalink
feat: release v5.21.0 (#659)
Browse files Browse the repository at this point in the history
* refactor: minor changes across the codebase (#656)

* refactor: move getting add-on version to a separate function

* refactor: get rid of admin_match

* refactor: move GlobalConfigPostProcessor to its own file

* refactor: remove unused method from GlobalConfigPostProcessor

* refactor: rename global_config to global_config_builder_schema

* refactor: no neeed to pass static import_declare_test variable

* chore: get rid of isort

* refactor: introduce and reuse GlobalConfig class to manage globalConfig file (#658)

* refactor: introduce GlobalConfig class

* refactor: introduce has_inputs method for GlobalConfig

* refactor: reuse GlobalConfig object in some smaller functions

* refactor: propagate global_config object to all other methods and classes

* refactor: get rid of _settings and _configs in GlobalConfig

* test: add simple unit test for GlobalConfig class

* test: ADDON-59948 Added test cases for Multi-level menu (#657)

* ci: update agreements CLA to 1.3 (#650)

* test: ADDON-59948 Added test cases for multilevel menu

* test: simplify test samples

---------

Co-authored-by: Artem Rys <rysartem@gmail.com>

* docs: ADDON-59156 Dependent Dropdown (#660)

* ci: update agreements CLA to 1.3 (#650)

* docs: ADDON-59156 Dependent dropdown doc changes

* docs: ADDON-59156 Dependent dropdown doc changes

---------

Co-authored-by: Artem Rys <rysartem@gmail.com>

* feat: OpenAPI generator for UCC (#648)

* chore: update deps (#626)

* feat: openapi generator code moved and initially adopted

* fix: outputdir and openapi.json can be created

* fix: openapi.json should be in static directory

* chore: smoke tests for openapi added

* fix: ta_version forced

* Update splunk_add_on_ucc_framework/commands/openapi_generator/json_to_object.py

Co-authored-by: Artem Rys <rysartem@gmail.com>

* Update splunk_add_on_ucc_framework/commands/openapi_generator/json_to_object.py

Co-authored-by: Artem Rys <rysartem@gmail.com>

* Update splunk_add_on_ucc_framework/app_manifest.py

Co-authored-by: Artem Rys <rysartem@gmail.com>

* fix: ta_version param taken into consideration when generating openapi

* feat: responses content added

* feat: documentation added

* fix: remove /static/openapi.json path as it would need user information; adding this info would create auth inconsistency

* refactor: integrate OpenAPI feature into the codebase

* refactor: get rid of output parameter for now

* chore: openapi enabled by default

---------

Co-authored-by: Artem Rys <rysartem@gmail.com>

* feat: update UCC UI to v1.22.0 (#661)

---------

Co-authored-by: Tushar Balar <62089106+tbalar-splunk@users.noreply.github.com>
Co-authored-by: hsekowski-splunk <74253926+hsekowski-splunk@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 22, 2023
1 parent 3083108 commit fdd7164
Show file tree
Hide file tree
Showing 43 changed files with 3,146 additions and 1,035 deletions.
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ repos:
rev: 22.12.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.11.1
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.991
hooks:
Expand Down
29 changes: 19 additions & 10 deletions docs/advanced/dependent_dropdown.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
If we need to add a select box that loads dynamically (via an API) or is dependent on another input, we can use the dependencies property.
This feature allows dynamic loading options for single-select fields when options for that field depend on other fields' values. It loads options via API call to the endpoint mentioned in `endpointUrl` under options when any dependencies field is updated and all required dependencies fields are non-null.

Here is how you specify single select `google_project` field which is depedent on `google_credentials_name` field.
All non-required dependencies fields can be of any type, but all required dependencies fields should only be of single-select type.

All dependencies fields' values are added to the endpoint URL as query parameters.

## Usage
```
{
"field": "bucket_name",
"label": "S3 Bucket",
"type": "singleSelect",
"label": "Project",
"field": "google_project",
"required": true,
"options": {
"disableSearch": true,
"dependencies": ["google_credentials_name"],
"denyList": "^_.*$",
"endpointUrl": "Splunk_TA_google_cloudplatform_projects",
"labelField": "projects"
"disableonEdit": true,
"dependencies": [
"aws_account",
"aws_iam_role",
"aws_s3_region",
"private_endpoint_enabled",
"sts_private_endpoint_url",
"s3_private_endpoint_url"
],
"endpointUrl": "splunk_ta_aws/splunk_ta_aws_s3buckets"
}
}
```

Here, `google_project` field is dependent upon `google_credentials_name` field. So, in case if `google_project` field is not loaded, `google_credentials_name` field will also not be loaded. Also, it will be repopulated on the change of `google_credentials_name`. So, we don't need Hook to support this type of functionality.
> Note: When using the text type field, add debounce using the custom hook to reduce the number of API calls.
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ which is a new UI framework based on React.

* Generate UI (`appserver` folder)
* Generate Python REST handlers to support UI CRUD operations (`bin` folder)
* Generate OpenAPI description document (`static/openapi.json` file)
* Generate UI-related `.conf` files (`web.conf`, `restmap.conf`)
* Generate `README` folder (with `.conf.spec` files)
* Generate other `.conf` files (`inputs.conf`)
Expand Down
61 changes: 61 additions & 0 deletions docs/openapi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# OpenAPI description document

`ucc-gen` command is executed with `--openapi` argument enabled by default.
There have to be defined valid `globalConfi.json` and `app.manifest` to have OpenAPI description document (`static/openapi.json` file) generated.

To disable OpenAPI functionality for `ucc-gen` run, call it with `--openapi=0` argument.

## How to find the document?

Once `ucc-gen` command is executed, OpenAPI description document is located in output `static` subdirectory.

When add-on is installed to Splunk instance, it is exposed via web and management interface, so is available under following addresses accordingly:

* \[protocol\]://\[domain\]:\[port\]/en-GB/splunkd/__raw/servicesNS/\[user\]/\[appname\]/static/openapi.json

(eg. http://localhost:8000/en-GB/splunkd/__raw/servicesNS/admin/Splunk_TA_cisco_meraki/static/openapi.json)

* https://\[domain\]:\[port\]/servicesNS/\[user\]/\[appname\]/static/openapi.json

(eg. https://localhost:8089/servicesNS/admin/Splunk_TA_cisco_meraki/static/openapi.json)

All security rules are applied so user has to be authenticated and authorised to be able to have access to the document.

See the following resources for more information on working with the Splunk REST API (eg. how to authenticate):

* [REST API User Manual](http://docs.splunk.com/Documentation/Splunk/9.0.3/RESTUM/RESTusing)
* [REST API Tutorials](http://docs.splunk.com/Documentation/Splunk/9.0.3/RESTTUT/RESTconfigurations)

## Where it can be used?

OpenAPI Description document can be used to create:

* interactive documentation that generates simple curl requests to all documented endpoints (check [this section](#how-to-get-curl-commands-and-use-them) for relevant instruction)
* automation that uses the simple requests to create more complex solutions such as:
* orchestration
* mass load or migration
* automated tests

Check [swagger](https://swagger.io/) or [other tools](https://github.com/OAI/OpenAPI-Specification/blob/main/IMPLEMENTATIONS.md) for more possibilities.

## How to get curl commands and use them?

### Prerequisites

* docker running
* Splunk with your add-on installed

### Instruction

1. Run in terminal: `docker run -p 8081:8080 swaggerapi/swagger-editor`
2. Open SwaggerEditor in web browser (http://localhost:8081/) and load the OpenAPI description document (File > Import file)
3. Check domain and port values for your Splunk instance and Authorize
4. Select method-path pair (eg. GET - /splunk_ta_snow_settings/logging ) and "Try it out"
5. Define parameters and "Execute"
6. Copy curl value, paste to your terminal, ADD `-k` PARAMETER, and run

> Note: Check [Swagger Editor documentation](https://swagger.io/tools/swagger-editor/) in case of any question related to the tool
### Troubleshooting

Are you sure you added `-k` parameter to curl command?
2 changes: 1 addition & 1 deletion example/globalConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"meta": {
"name": "Splunk_TA_dummy_data",
"restRoot": "Splunk_TA_dummy_data",
"version": "5.18.0R05a4667a",
"version": "5.20.0R9f9c8fed",
"displayName": "Splunk_TA_dummy_data",
"schemaVersion": "0.0.3"
}
Expand Down
2 changes: 1 addition & 1 deletion get-ucc-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
wget https://github.com/splunk/addonfactory-ucc-base-ui/releases/download/v1.21.0/splunk-ucc-ui.tgz
wget https://github.com/splunk/addonfactory-ucc-base-ui/releases/download/v1.22.0/splunk-ucc-ui.tgz
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ nav:
- Components: "components.md"
- Tabs: "tabs.md"
- Additional packaging: "additional_packaging.md"
- OpenAPI: "openapi.md"
- Modular Input Type column: "modular_input_type_column.md"
- Custom UI Extensions:
- Custom Hook: "custom_ui_extensions/custom_hook.md"
Expand Down
Loading

0 comments on commit fdd7164

Please sign in to comment.