-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
3083108
commit fdd7164
Showing
43 changed files
with
3,146 additions
and
1,035 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
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. |
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 |
---|---|---|
@@ -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? |
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
Oops, something went wrong.