mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 04:09:40 -06:00
chore(search): add vendor dependencies
This commit is contained in:
15
vendor/github.com/opensearch-project/opensearch-go/v4/.codecov.yml
generated
vendored
Normal file
15
vendor/github.com/opensearch-project/opensearch-go/v4/.codecov.yml
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# https://docs.codecov.com/docs/pull-request-comments
|
||||
comment:
|
||||
layout: "diff, flags, files"
|
||||
behavior: default
|
||||
require_changes: false # if true: only post the comment if coverage changes
|
||||
require_base: false # [true :: must have a base report to post]
|
||||
require_head: true # [true :: must have a head report to post]
|
||||
hide_project_coverage: false # [true :: only show coverage on the git diff]
|
||||
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
threshold: 5% # allow 5% coverage decrease
|
||||
patch: off
|
||||
2
vendor/github.com/opensearch-project/opensearch-go/v4/.dockerignore
generated
vendored
Normal file
2
vendor/github.com/opensearch-project/opensearch-go/v4/.dockerignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
.git/
|
||||
tmp/
|
||||
9
vendor/github.com/opensearch-project/opensearch-go/v4/.gitignore
generated
vendored
Normal file
9
vendor/github.com/opensearch-project/opensearch-go/v4/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
tmp/
|
||||
*.test
|
||||
|
||||
# editors
|
||||
.idea
|
||||
.vscode
|
||||
bin/
|
||||
|
||||
.DS_Store
|
||||
175
vendor/github.com/opensearch-project/opensearch-go/v4/.golangci.yml
generated
vendored
Normal file
175
vendor/github.com/opensearch-project/opensearch-go/v4/.golangci.yml
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
run:
|
||||
timeout: 10m
|
||||
modules-download-mode: readonly
|
||||
|
||||
linters-settings:
|
||||
errcheck:
|
||||
check-blank: true
|
||||
check-type-assertions: false
|
||||
errorlint:
|
||||
check-generated: false
|
||||
default-signifies-exhaustive: false
|
||||
exhaustive:
|
||||
default-signifies-exhaustive: false
|
||||
gci:
|
||||
sections:
|
||||
- standard
|
||||
- default
|
||||
- prefix(github.com/opensearch-project/opensearch-go)
|
||||
goconst:
|
||||
min-len: 3
|
||||
min-occurrences: 3
|
||||
godox:
|
||||
keywords:
|
||||
- BUG
|
||||
- FIXME
|
||||
- HACK
|
||||
goimports:
|
||||
local-prefixes: github.com/opensearch-project/opensearch-go
|
||||
lll:
|
||||
line-length: 140
|
||||
nolintlint:
|
||||
allow-leading-space: false
|
||||
require-explanation: true
|
||||
require-specific: true
|
||||
unparam:
|
||||
check-exported: true
|
||||
misspell:
|
||||
locale: US
|
||||
ignore-words:
|
||||
- expect
|
||||
- cancelled
|
||||
prealloc:
|
||||
simple: true
|
||||
range-loops: true
|
||||
for-loops: false
|
||||
revive:
|
||||
rules:
|
||||
- name: exported
|
||||
severity: error
|
||||
disabled: false
|
||||
arguments:
|
||||
- "checkPrivateReceivers"
|
||||
- "sayRepetitiveInsteadOfStutters"
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- asasalint
|
||||
- asciicheck
|
||||
- bidichk
|
||||
- bodyclose
|
||||
- containedctx
|
||||
- contextcheck
|
||||
- decorder
|
||||
- dogsled
|
||||
- dupl
|
||||
- dupword
|
||||
- durationcheck
|
||||
- errcheck
|
||||
- errchkjson
|
||||
- errname
|
||||
- errorlint
|
||||
- execinquery
|
||||
- exhaustive
|
||||
- exportloopref
|
||||
- gci
|
||||
- ginkgolinter
|
||||
- gocheckcompilerdirectives
|
||||
- gochecknoglobals
|
||||
- gochecknoinits
|
||||
- goconst
|
||||
- gocritic
|
||||
- godox
|
||||
- gofmt
|
||||
- gofumpt
|
||||
- goheader
|
||||
- goimports
|
||||
- gomoddirectives
|
||||
- gomodguard
|
||||
- goprintffuncname
|
||||
- gosec
|
||||
- gosimple
|
||||
- govet
|
||||
- grouper
|
||||
- importas
|
||||
- ineffassign
|
||||
- interfacebloat
|
||||
- lll
|
||||
- loggercheck
|
||||
- makezero
|
||||
- mirror
|
||||
- misspell
|
||||
- musttag
|
||||
- nakedret
|
||||
- nestif
|
||||
- nilerr
|
||||
- nilnil
|
||||
- noctx
|
||||
- nolintlint
|
||||
- nonamedreturns
|
||||
- nosprintfhostport
|
||||
- prealloc
|
||||
- predeclared
|
||||
- promlinter
|
||||
- reassign
|
||||
- revive
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- staticcheck
|
||||
- stylecheck
|
||||
- tagalign
|
||||
- testpackage
|
||||
- thelper
|
||||
- tparallel
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- unused
|
||||
- usestdlibvars
|
||||
- wastedassign
|
||||
- whitespace
|
||||
- zerologlint
|
||||
|
||||
issues:
|
||||
include:
|
||||
- EXC0012
|
||||
- EXC0014
|
||||
exclude-rules:
|
||||
- path: (_test\.go|internal/)
|
||||
linters:
|
||||
- cyclop
|
||||
- dupl
|
||||
- errcheck
|
||||
- gochecknoglobals
|
||||
- gochecknoinits
|
||||
- goconst
|
||||
- noctx
|
||||
- linters:
|
||||
- gosec
|
||||
text: "math/rand"
|
||||
path: _test\.go
|
||||
- linters:
|
||||
- gosec
|
||||
text: "TLS InsecureSkipVerify set true"
|
||||
path: (_test\.go|internal/)
|
||||
- linters:
|
||||
- gosec
|
||||
text: "G108: Profiling endpoint is automatically exposed on /debug/pprof"
|
||||
path: _test\.go
|
||||
- linters:
|
||||
- goconst
|
||||
path: opensearchapi\/api_
|
||||
- linters:
|
||||
- errcheck
|
||||
text: "Error return value of `debugLogger.Logf` is not checked"
|
||||
- linters:
|
||||
- errcheck
|
||||
- gochecknoglobals
|
||||
path: opensearchtransport\/logger\.go
|
||||
- linters:
|
||||
- nestif
|
||||
path: opensearchtransport/opensearchtransport.go
|
||||
- linters:
|
||||
- dupl
|
||||
path: (-params\.go|api_indices|api_dangling\.go|api_point_in_time\.go|rethrottle\.go|api_cat-.*\.go|plugins/security/api_\w+.go|plugins/security/api_.*-patch.go)
|
||||
15
vendor/github.com/opensearch-project/opensearch-go/v4/.whitesource
generated
vendored
Normal file
15
vendor/github.com/opensearch-project/opensearch-go/v4/.whitesource
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"scanSettings": {
|
||||
"configMode": "AUTO",
|
||||
"configExternalURL": "",
|
||||
"projectToken": "",
|
||||
"baseBranches": []
|
||||
},
|
||||
"checkRunSettings": {
|
||||
"vulnerableCheckRunConclusionLevel": "failure",
|
||||
"displayMode": "diff"
|
||||
},
|
||||
"issueSettings": {
|
||||
"minSeverityLevel": "LOW"
|
||||
}
|
||||
}
|
||||
38
vendor/github.com/opensearch-project/opensearch-go/v4/ADMINS.md
generated
vendored
Normal file
38
vendor/github.com/opensearch-project/opensearch-go/v4/ADMINS.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
- [Overview](#overview)
|
||||
- [Current Admins](#current-admins)
|
||||
- [Admin Responsibilities](#admin-responsibilities)
|
||||
- [Prioritize Security](#prioritize-security)
|
||||
- [Enforce Code of Conduct](#enforce-code-of-conduct)
|
||||
- [Adopt Organizational Best Practices](#adopt-organizational-best-practices)
|
||||
|
||||
## Overview
|
||||
|
||||
This document explains who the admins are (see below), what they do in this repo, and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
|
||||
|
||||
## Current Admins
|
||||
|
||||
| Admin | GitHub ID | Affiliation |
|
||||
| --- | --- | --- |
|
||||
| Charlotte | [CEHENKLE](https://github.com/CEHENKLE) | Amazon |
|
||||
| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |
|
||||
| Jack Mazanec | [jmazanec15](https://github.com/jmazanec15) | Amazon |
|
||||
| Vamshi Vijay Nakkirtha | [vamshin](https://github.com/vamshin) | Amazon |
|
||||
| Vijayan Balasubramanian | [VijayanB](https://github.com/VijayanB) | Amazon |
|
||||
|
||||
## Admin Responsibilities
|
||||
|
||||
As an admin you own stewartship of the repository and its settings. Admins have [admin-level permissions on a repository](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-permission-levels-for-an-organization). Use those privileges to serve the community and protect the repository as follows.
|
||||
|
||||
### Prioritize Security
|
||||
|
||||
Security is your number one priority. Manage security keys and safeguard access to the repository.
|
||||
|
||||
Note that this repository is monitored and supported 24/7 by Amazon Security, see [Reporting a Vulnerability](SECURITY.md) for details.
|
||||
|
||||
### Enforce Code of Conduct
|
||||
|
||||
Act on [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) violations by revoking access, and blocking malicious actors.
|
||||
|
||||
### Adopt Organizational Best Practices
|
||||
|
||||
Adopt organizational best practices, work in the open, and collaborate with other admins by opening issues before making process changes. Prefer consistency, and avoid diverging from practices in the opensearch-project organization.
|
||||
345
vendor/github.com/opensearch-project/opensearch-go/v4/CHANGELOG.md
generated
vendored
Normal file
345
vendor/github.com/opensearch-project/opensearch-go/v4/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
# CHANGELOG
|
||||
|
||||
Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
|
||||
## [4.5.0]
|
||||
|
||||
### Dependencies
|
||||
- Bump `github.com/aws/aws-sdk-go-v2/config` from 1.29.6 to 1.29.14 ([#692](https://github.com/opensearch-project/opensearch-go/pull/692))
|
||||
- Bump `github.com/aws/aws-sdk-go` from 1.55.6 to 1.55.7 ([#696](https://github.com/opensearch-project/opensearch-go/pull/696))
|
||||
- Bump `github.com/wI2L/jsondiff` from 0.6.1 to 0.7.0 ([#700](https://github.com/opensearch-project/opensearch-go/pull/700))
|
||||
|
||||
### Added
|
||||
- Adds DataStream field to IndicesGetResp struct ([#701](https://github.com/opensearch-project/opensearch-go/pull/701))
|
||||
- Adds `InnerHits` field to `SearchResp` ([#672](https://github.com/opensearch-project/opensearch-go/pull/672))
|
||||
- Adds `FilterPath` param ([#673](https://github.com/opensearch-project/opensearch-go/pull/673))
|
||||
- Adds `Aggregations` field to `MSearchResp` ([#690](https://github.com/opensearch-project/opensearch-go/pull/690))
|
||||
|
||||
### Changed
|
||||
- Bump golang version to 1.22 ([#691](https://github.com/opensearch-project/opensearch-go/pull/691))
|
||||
- Change ChangeCatRecoveryItemResp Byte fields from int to string ([#691](https://github.com/opensearch-project/opensearch-go/pull/691))
|
||||
- Changed log formatted examples code ([#694](https://github.com/opensearch-project/opensearch-go/pull/694))
|
||||
- Improve the error reporting of invalid body response ([#699](https://github.com/opensearch-project/opensearch-go/pull/699))
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
|
||||
## [4.4.0]
|
||||
|
||||
### Added
|
||||
- Adds `Highlight` field to `SearchHit` ([#654](https://github.com/opensearch-project/opensearch-go/pull/654))
|
||||
- Adds `MatchedQueries` field to `SearchHit` ([#663](https://github.com/opensearch-project/opensearch-go/pull/663))
|
||||
- Adds support for Opensearch 2.19 ([#668](https://github.com/opensearch-project/opensearch-go/pull/668))
|
||||
|
||||
### Changed
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
|
||||
### Dependencies
|
||||
- Bump `github.com/aws/aws-sdk-go` from 1.55.5 to 1.55.6 ([#657](https://github.com/opensearch-project/opensearch-go/pull/657))
|
||||
- Bump `github.com/wI2L/jsondiff` from 0.6.0 to 0.6.1 ([#643](https://github.com/opensearch-project/opensearch-go/pull/643))
|
||||
- Bump `github.com/aws/aws-sdk-go-v2` from 1.32.2 to 1.36.1 ([#664](https://github.com/opensearch-project/opensearch-go/pull/664))
|
||||
- Bump `github.com/stretchr/testify` from 1.9.0 to 1.10.0 ([#644](https://github.com/opensearch-project/opensearch-go/pull/644))
|
||||
- Bump `github.com/aws/aws-sdk-go-v2/config` from 1.27.43 to 1.29.6 ([#665](https://github.com/opensearch-project/opensearch-go/pull/665))
|
||||
|
||||
## [4.3.0]
|
||||
|
||||
### Added
|
||||
- Adds ISM Alias action ([#615](https://github.com/opensearch-project/opensearch-go/pull/615))
|
||||
- Adds support for opensearch 2.17 ([#623](https://github.com/opensearch-project/opensearch-go/pull/623))
|
||||
|
||||
### Changed
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
- Fix ISM Transition to omitempty Conditions field ([#609](https://github.com/opensearch-project/opensearch-go/pull/609))
|
||||
- Fix ISM Allocation field types ([#609](https://github.com/opensearch-project/opensearch-go/pull/609))
|
||||
- Fix ISM Error Notification types ([#612](https://github.com/opensearch-project/opensearch-go/pull/612))
|
||||
- Fix signer receiving drained body on retries ([#620](https://github.com/opensearch-project/opensearch-go/pull/620))
|
||||
- Fix Bulk Index Items not executing failure callbacks on bulk request failure ([#626](https://github.com/opensearch-project/opensearch-go/issues/626))
|
||||
|
||||
### Security
|
||||
|
||||
### Dependencies
|
||||
- Bump `github.com/aws/aws-sdk-go-v2/config` from 1.27.31 to 1.27.43 ([#611](https://github.com/opensearch-project/opensearch-go/pull/611), [#630](https://github.com/opensearch-project/opensearch-go/pull/630), [#632](https://github.com/opensearch-project/opensearch-go/pull/632))
|
||||
- Bump `github.com/aws/aws-sdk-go-v2` from 1.32.1 to 1.32.2 ([#631](https://github.com/opensearch-project/opensearch-go/pull/631))
|
||||
|
||||
## [4.2.0]
|
||||
|
||||
### Dependencies
|
||||
- Bump `github.com/aws/aws-sdk-go-v2/config` from 1.27.23 to 1.27.31 ([#584](https://github.com/opensearch-project/opensearch-go/pull/584), [#588](https://github.com/opensearch-project/opensearch-go/pull/588), [#593](https://github.com/opensearch-project/opensearch-go/pull/593), [#605](https://github.com/opensearch-project/opensearch-go/pull/605))
|
||||
- Bump `github.com/aws/aws-sdk-go` from 1.54.12 to 1.55.5 ([#583](https://github.com/opensearch-project/opensearch-go/pull/583), [#590](https://github.com/opensearch-project/opensearch-go/pull/590), [#595](https://github.com/opensearch-project/opensearch-go/pull/595), [#596](https://github.com/opensearch-project/opensearch-go/pull/596))
|
||||
|
||||
### Added
|
||||
- Adds `Suggest` to `SearchResp` ([#602](https://github.com/opensearch-project/opensearch-go/pull/602))
|
||||
- Adds `MaxScore` to `ScrollGetResp` ([#607](https://github.com/opensearch-project/opensearch-go/pull/607))
|
||||
|
||||
### Changed
|
||||
- Split SnapshotGetResp into sub structs ([#603](https://github.com/opensearch-project/opensearch-go/pull/603))
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
- Remove workflow tests against gotip ([#604](https://github.com/opensearch-project/opensearch-go/pull/604))
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
|
||||
## [4.1.0]
|
||||
|
||||
### Added
|
||||
- Adds the `Routing` field in SearchHit interface. ([#516](https://github.com/opensearch-project/opensearch-go/pull/516))
|
||||
- Adds the `SearchPipelines` field to `SearchParams` ([#532](https://github.com/opensearch-project/opensearch-go/pull/532))
|
||||
- Adds support for OpenSearch 2.14 ([#552](https://github.com/opensearch-project/opensearch-go/pull/552))
|
||||
- Adds the `Caches` field to Node stats ([#572](https://github.com/opensearch-project/opensearch-go/pull/572))
|
||||
- Adds the `SeqNo` and `PrimaryTerm` fields in `SearchHit` ([#574](https://github.com/opensearch-project/opensearch-go/pull/574))
|
||||
- Adds guide on configuring the client with retry and backoff ([#540](https://github.com/opensearch-project/opensearch-go/pull/540))
|
||||
- Adds OpenSearch 2.15 to compatibility workflow test ([#575](https://github.com/opensearch-project/opensearch-go/pull/575))
|
||||
|
||||
### Changed
|
||||
- Security roles get response struct has its own sub structs without omitempty ([#572](https://github.com/opensearch-project/opensearch-go/pull/572))
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixes empty request body on retry with compression enabled ([#543](https://github.com/opensearch-project/opensearch-go/pull/543))
|
||||
- Fixes `Conditions` in `PolicyStateTransition` of ISM plugin ([#556](https://github.com/opensearch-project/opensearch-go/pull/556))
|
||||
- Fixes integration test response validation when response is null ([#572](https://github.com/opensearch-project/opensearch-go/pull/572))
|
||||
- Adjust security Role struct for FLS from string to []string ([#572](https://github.com/opensearch-project/opensearch-go/pull/572))
|
||||
- Fixes wrong response parsing for indices mapping and recovery ([#572](https://github.com/opensearch-project/opensearch-go/pull/572))
|
||||
- Fixes wrong response parsing for security get requests ([#572](https://github.com/opensearch-project/opensearch-go/pull/572))
|
||||
- Fixes opensearchtransport ignores request context cancellation when `retryBackoff` is configured ([#540](https://github.com/opensearch-project/opensearch-go/pull/540))
|
||||
- Fixes opensearchtransport sleeps unexpectedly after the last retry ([#540](https://github.com/opensearch-project/opensearch-go/pull/540))
|
||||
- Improves ParseError response when server response is an unknown json ([#592](https://github.com/opensearch-project/opensearch-go/pull/592))
|
||||
|
||||
### Security
|
||||
|
||||
### Dependencies
|
||||
- Bump `github.com/aws/aws-sdk-go` from 1.51.21 to 1.54.12 ([#534](https://github.com/opensearch-project/opensearch-go/pull/534), [#537](https://github.com/opensearch-project/opensearch-go/pull/537), [#538](https://github.com/opensearch-project/opensearch-go/pull/538), [#545](https://github.com/opensearch-project/opensearch-go/pull/545), [#554](https://github.com/opensearch-project/opensearch-go/pull/554), [#557](https://github.com/opensearch-project/opensearch-go/pull/557), [#563](https://github.com/opensearch-project/opensearch-go/pull/563), [#564](https://github.com/opensearch-project/opensearch-go/pull/564), [#570](https://github.com/opensearch-project/opensearch-go/pull/570), [#579](https://github.com/opensearch-project/opensearch-go/pull/579))
|
||||
- Bump `github.com/wI2L/jsondiff` from 0.5.1 to 0.6.0 ([#535](https://github.com/opensearch-project/opensearch-go/pull/535), [#566](https://github.com/opensearch-project/opensearch-go/pull/566))
|
||||
- Bump `github.com/aws/aws-sdk-go-v2/config` from 1.27.11 to 1.27.23 ([#546](https://github.com/opensearch-project/opensearch-go/pull/546), [#553](https://github.com/opensearch-project/opensearch-go/pull/553), [#558](https://github.com/opensearch-project/opensearch-go/pull/558), [#562](https://github.com/opensearch-project/opensearch-go/pull/562), [#567](https://github.com/opensearch-project/opensearch-go/pull/567), [#571](https://github.com/opensearch-project/opensearch-go/pull/571), [#577](https://github.com/opensearch-project/opensearch-go/pull/577))
|
||||
- Bump `github.com/aws/aws-sdk-go-v2` from 1.27.0 to 1.30.1 ([#559](https://github.com/opensearch-project/opensearch-go/pull/559), [#578](https://github.com/opensearch-project/opensearch-go/pull/578))
|
||||
|
||||
## [4.0.0]
|
||||
|
||||
### Added
|
||||
- Adds GlobalIOUsage struct for nodes stats ([#506](https://github.com/opensearch-project/opensearch-go/pull/506))
|
||||
- Adds the `Explanation` field containing the document explain details to the `SearchHit` struct. ([#504](https://github.com/opensearch-project/opensearch-go/pull/504))
|
||||
- Adds new error types ([#512](https://github.com/opensearch-project/opensearch-go/pull/506))
|
||||
- Adds handling of non json errors to ParseError ([#512](https://github.com/opensearch-project/opensearch-go/pull/506))
|
||||
- Adds the `Failures` field to opensearchapi structs ([#510](https://github.com/opensearch-project/opensearch-go/pull/510))
|
||||
- Adds the `Fields` field containing the document fields to the `SearchHit` struct. ([#508](https://github.com/opensearch-project/opensearch-go/pull/508))
|
||||
- Adds security plugin ([#507](https://github.com/opensearch-project/opensearch-go/pull/507))
|
||||
- Adds security settings to container for security testing ([#507](https://github.com/opensearch-project/opensearch-go/pull/507))
|
||||
- Adds cluster.get-certs to copy admin certs out of the container ([#507](https://github.com/opensearch-project/opensearch-go/pull/507))
|
||||
- Adds the `Fields` field containing stored fields to the `DocumentGetResp` struct ([#526](https://github.com/opensearch-project/opensearch-go/pull/526))
|
||||
- Adds ism plugin ([#524](https://github.com/opensearch-project/opensearch-go/pull/524))
|
||||
|
||||
### Changed
|
||||
- Uses docker compose v2 instead of v1 ([#506](https://github.com/opensearch-project/opensearch-go/pull/506))
|
||||
- Updates go version to 1.21 ([#509](https://github.com/opensearch-project/opensearch-go/pull/509))
|
||||
- Moves Error structs from opensearchapi to opensearch package ([#512](https://github.com/opensearch-project/opensearch-go/pull/506))
|
||||
- Moves parseError function from opensearchapi to opensearch package as ParseError ([#512](https://github.com/opensearch-project/opensearch-go/pull/506))
|
||||
- Changes ParseError function to do type assertion to determine error type ([#512](https://github.com/opensearch-project/opensearch-go/pull/506))
|
||||
- Removes unused structs and functions from opensearch ([#517](https://github.com/opensearch-project/opensearch-go/pull/517))
|
||||
- Adjusts and extent opensearch tests for better coverage ([#517](https://github.com/opensearch-project/opensearch-go/pull/517))
|
||||
- Bumps codecov action version to v4 ([#517](https://github.com/opensearch-project/opensearch-go/pull/517))
|
||||
- Changes bulk error/reason field and some cat response fields to pointer as they can be nil ([#510](https://github.com/opensearch-project/opensearch-go/pull/510))
|
||||
- Adjust workflows to work with security plugin ([#507](https://github.com/opensearch-project/opensearch-go/pull/507))
|
||||
- Updates USER_GUIDE.md and /_samples/ ([#518](https://github.com/opensearch-project/opensearch-go/pull/518))
|
||||
- Updates opensearchtransport.Client to use pooled gzip writer and buffer ([#521](https://github.com/opensearch-project/opensearch-go/pull/521))
|
||||
- Use go:build tags for testing ([#52?](https://github.com/opensearch-project/opensearch-go/pull/52?))
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
- Fixes search request missing a slash when no indices are given ([#470](https://github.com/opensearch-project/opensearch-go/pull/469))
|
||||
- Fixes opensearchtransport check for nil response body ([#517](https://github.com/opensearch-project/opensearch-go/pull/517))
|
||||
|
||||
### Security
|
||||
|
||||
### Dependencies
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2` from 1.25.3 to 1.26.1
|
||||
- Bumps `github.com/wI2L/jsondiff` from 0.4.0 to 0.5.1
|
||||
- Bumps `github.com/aws/aws-sdk-go` from 1.50.36 to 1.51.21
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2/config` from 1.27.7 to 1.27.11
|
||||
|
||||
## [3.1.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Adds new struct fields introduced in OpenSearch 2.12 ([#482](https://github.com/opensearch-project/opensearch-go/pull/482))
|
||||
- Adds initial admin password environment variable and CI changes to support 2.12.0 release ([#449](https://github.com/opensearch-project/opensearch-go/pull/449))
|
||||
- Adds `merge_id` field for indices segment request ([#488](https://github.com/opensearch-project/opensearch-go/pull/488))
|
||||
|
||||
### Changed
|
||||
|
||||
- Updates workflow action versions ([#488](https://github.com/opensearch-project/opensearch-go/pull/488))
|
||||
- Changes integration tests to work with secure and unsecure OpenSearch ([#488](https://github.com/opensearch-project/opensearch-go/pull/488))
|
||||
- Moves functions from `opensearch/internal/test` to `internal/test` for more general test uses ([#488](https://github.com/opensearch-project/opensearch-go/pull/488))
|
||||
- Changes `custom_foldername` field to pointer as it can be `null` ([#488](https://github.com/opensearch-project/opensearch-go/pull/488))
|
||||
- Changs cat indices Primary and Replica field to pointer as it can be `null` ([#488](https://github.com/opensearch-project/opensearch-go/pull/488))
|
||||
- Replaces `ioutil` with `io` in examples and integration tests [#495](https://github.com/opensearch-project/opensearch-go/pull/495)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix incorrect SigV4 `x-amz-content-sha256` with AWS SDK v1 requests without a body ([#496](https://github.com/opensearch-project/opensearch-go/pull/496))
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bumps `github.com/aws/aws-sdk-go` from 1.48.13 to 1.50.36
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2/config` from 1.25.11 to 1.27.7
|
||||
- Bumps `github.com/stretchr/testify` from 1.8.4 to 1.9.0
|
||||
|
||||
## [3.0.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Adds `Err()` function to Response for detailed errors ([#246](https://github.com/opensearch-project/opensearch-go/pull/246))
|
||||
- Adds golangci-lint as code analysis tool ([#313](https://github.com/opensearch-project/opensearch-go/pull/313))
|
||||
- Adds govulncheck to check for go vulnerablities ([#405](https://github.com/opensearch-project/opensearch-go/pull/405))
|
||||
- Adds opensearchapi with new client and function structure ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
|
||||
- Adds integration tests for all opensearchapi functions ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
|
||||
- Adds guide on making raw JSON REST requests ([#399](https://github.com/opensearch-project/opensearch-go/pull/399))
|
||||
- Adds IPV6 support in the DiscoverNodes method ([#458](https://github.com/opensearch-project/opensearch-go/issues/458))
|
||||
|
||||
### Changed
|
||||
|
||||
- Removes the need for double error checking ([#246](https://github.com/opensearch-project/opensearch-go/pull/246))
|
||||
- Updates and adjusted golangci-lint, solve linting complains for signer ([#352](https://github.com/opensearch-project/opensearch-go/pull/352))
|
||||
- Solves linting complains for opensearchtransport ([#353](https://github.com/opensearch-project/opensearch-go/pull/353))
|
||||
- Updates Developer guide to include docker build instructions ([#385](https://github.com/opensearch-project/opensearch-go/pull/385))
|
||||
- Tests against version 2.9.0, 2.10.0, run tests in all branches, changes integration tests to wait for OpenSearch to start ([#392](https://github.com/opensearch-project/opensearch-go/pull/392))
|
||||
- Makefile: uses docker golangci-lint, run integration test on `.` folder, change coverage generation ([#392](https://github.com/opensearch-project/opensearch-go/pull/392))
|
||||
- golangci-lint: updates rules and fail when issues are found ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
|
||||
- go: updates to golang version 1.20 ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
|
||||
- guids: updates to work for the new opensearchapi ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
|
||||
- Adjusts tests to new opensearchapi functions and structs ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
|
||||
- Changes codecov to comment code coverage to each PR ([#410](https://github.com/opensearch-project/opensearch-go/pull/410))
|
||||
- Changes module version from v2 to v3 ([#444](https://github.com/opensearch-project/opensearch-go/pull/444))
|
||||
- Handle unexpected non-json errors with the response body ([#523](https://github.com/opensearch-project/opensearch-go/pull/523))
|
||||
|
||||
### Deprecated
|
||||
|
||||
- Deprecates legacy API `/_template` ([#390](https://github.com/opensearch-project/opensearch-go/pull/390))
|
||||
|
||||
### Removed
|
||||
|
||||
- Removes all old opensearchapi functions ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
|
||||
- Removes `/internal/build` code and folders ([#421](https://github.com/opensearch-project/opensearch-go/pull/421))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Corrects AWSv4 signature on DataStream `Stats` with no index name specified ([#338](https://github.com/opensearch-project/opensearch-go/pull/338))
|
||||
- Fixes GetSourceRequest `Source` field and deprecated the `Source` parameter ([#402](https://github.com/opensearch-project/opensearch-go/pull/402))
|
||||
- Corrects developer guide summary with golang version 1.20 ([#434](https://github.com/opensearch-project/opensearch-go/pull/434))
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bumps `github.com/aws/aws-sdk-go` from 1.44.263 to 1.48.13
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2` from 1.18.0 to 1.23.5
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2/config` from 1.18.25 to 1.25.11
|
||||
- Bumps `github.com/stretchr/testify` from 1.8.2 to 1.8.4
|
||||
- Bumps `golang.org/x/net` from 0.7.0 to 0.17.0
|
||||
- Bumps `github.com/golangci/golangci-lint-action` from 1.53.3 to 1.54.2
|
||||
|
||||
## [2.3.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Adds implementation of Data Streams API ([#257](https://github.com/opensearch-project/opensearch-go/pull/257))
|
||||
- Adds Point In Time API ([#253](https://github.com/opensearch-project/opensearch-go/pull/253))
|
||||
- Adds InfoResp type ([#253](https://github.com/opensearch-project/opensearch-go/pull/253))
|
||||
- Adds markdown linter ([#261](https://github.com/opensearch-project/opensearch-go/pull/261))
|
||||
- Adds testcases to check upsert functionality ([#269](https://github.com/opensearch-project/opensearch-go/pull/269))
|
||||
- Adds @Jakob3xD to co-maintainers ([#270](https://github.com/opensearch-project/opensearch-go/pull/270))
|
||||
- Adds dynamic type to \_source field ([#285](https://github.com/opensearch-project/opensearch-go/pull/285))
|
||||
- Adds testcases for Document API ([#285](https://github.com/opensearch-project/opensearch-go/pull/285))
|
||||
- Adds `index_lifecycle` guide ([#287](https://github.com/opensearch-project/opensearch-go/pull/287))
|
||||
- Adds `bulk` guide ([#292](https://github.com/opensearch-project/opensearch-go/pull/292))
|
||||
- Adds `search` guide ([#291](https://github.com/opensearch-project/opensearch-go/pull/291))
|
||||
- Adds `document_lifecycle` guide ([#290](https://github.com/opensearch-project/opensearch-go/pull/290))
|
||||
- Adds `index_template` guide ([#289](https://github.com/opensearch-project/opensearch-go/pull/289))
|
||||
- Adds `advanced_index_actions` guide ([#288](https://github.com/opensearch-project/opensearch-go/pull/288))
|
||||
- Adds testcases to check UpdateByQuery functionality ([#304](https://github.com/opensearch-project/opensearch-go/pull/304))
|
||||
- Adds additional timeout after cluster start ([#303](https://github.com/opensearch-project/opensearch-go/pull/303))
|
||||
- Adds docker healthcheck to auto restart the container ([#315](https://github.com/opensearch-project/opensearch-go/pull/315))
|
||||
|
||||
### Changed
|
||||
|
||||
- Uses `[]string` instead of `string` in `SnapshotDeleteRequest` ([#237](https://github.com/opensearch-project/opensearch-go/pull/237))
|
||||
- Updates workflows to reduce CI time, consolidate OpenSearch versions, update compatibility matrix ([#242](https://github.com/opensearch-project/opensearch-go/pull/242))
|
||||
- Moves @svencowart to emeritus maintainers ([#270](https://github.com/opensearch-project/opensearch-go/pull/270))
|
||||
- Reads, closes and replaces the http Reponse Body ([#300](https://github.com/opensearch-project/opensearch-go/pull/300))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Corrects curl logging to emit the correct URL destination ([#101](https://github.com/opensearch-project/opensearch-go/pull/101))
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bumps `github.com/aws/aws-sdk-go` from 1.44.180 to 1.44.263
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2` from 1.17.4 to 1.18.0
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2/config` from 1.18.8 to 1.18.25
|
||||
- Bumps `github.com/stretchr/testify` from 1.8.1 to 1.8.2
|
||||
|
||||
## [2.2.0]
|
||||
|
||||
### Added
|
||||
|
||||
- Adds Github workflow for changelog verification ([#172](https://github.com/opensearch-project/opensearch-go/pull/172))
|
||||
- Adds Go Documentation link for the client ([#182](https://github.com/opensearch-project/opensearch-go/pull/182))
|
||||
- Adds support for Amazon OpenSearch Serverless ([#216](https://github.com/opensearch-project/opensearch-go/pull/216))
|
||||
|
||||
### Removed
|
||||
|
||||
- Removes info call before performing every request ([#219](https://github.com/opensearch-project/opensearch-go/pull/219))
|
||||
|
||||
### Fixed
|
||||
|
||||
- Renames the sequence number struct tag to if_seq_no to fix optimistic concurrency control ([#166](https://github.com/opensearch-project/opensearch-go/pull/166))
|
||||
- Fixes `RetryOnConflict` on bulk indexer ([#215](https://github.com/opensearch-project/opensearch-go/pull/215))
|
||||
|
||||
### Dependencies
|
||||
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2` from 1.17.1 to 1.17.3
|
||||
- Bumps `github.com/aws/aws-sdk-go-v2/config` from 1.17.10 to 1.18.8
|
||||
- Bumps `github.com/aws/aws-sdk-go` from 1.44.176 to 1.44.180
|
||||
- Bumps `github.com/aws/aws-sdk-go` from 1.44.132 to 1.44.180
|
||||
- Bumps `github.com/stretchr/testify` from 1.8.0 to 1.8.1
|
||||
- Bumps `github.com/aws/aws-sdk-go` from 1.44.45 to 1.44.132
|
||||
|
||||
[4.5.0]: https://github.com/opensearch-project/opensearch-go/compare/v4.4.0...v4.5.0
|
||||
[4.4.0]: https://github.com/opensearch-project/opensearch-go/compare/v4.3.0...v4.4.0
|
||||
[4.3.0]: https://github.com/opensearch-project/opensearch-go/compare/v4.2.0...v4.3.0
|
||||
[4.2.0]: https://github.com/opensearch-project/opensearch-go/compare/v4.1.0...v4.2.0
|
||||
[4.1.0]: https://github.com/opensearch-project/opensearch-go/compare/v4.0.0...v4.1.0
|
||||
[4.0.0]: https://github.com/opensearch-project/opensearch-go/compare/v3.1.0...v4.0.0
|
||||
[3.1.0]: https://github.com/opensearch-project/opensearch-go/compare/v3.0.0...v3.1.0
|
||||
[3.0.0]: https://github.com/opensearch-project/opensearch-go/compare/v2.3.0...v3.0.0
|
||||
[2.3.0]: https://github.com/opensearch-project/opensearch-go/compare/v2.2.0...v2.3.0
|
||||
[2.2.0]: https://github.com/opensearch-project/opensearch-go/compare/v2.1.0...v2.2.0
|
||||
[2.1.0]: https://github.com/opensearch-project/opensearch-go/compare/v2.0.1...v2.1.0
|
||||
[2.0.1]: https://github.com/opensearch-project/opensearch-go/compare/v2.0.0...v2.0.1
|
||||
[2.0.0]: https://github.com/opensearch-project/opensearch-go/compare/v1.1.0...v2.0.0
|
||||
[1.0.0]: https://github.com/opensearch-project/opensearch-go/compare/v1.0.0...v1.1.0
|
||||
22
vendor/github.com/opensearch-project/opensearch-go/v4/CODE_OF_CONDUCT.md
generated
vendored
Normal file
22
vendor/github.com/opensearch-project/opensearch-go/v4/CODE_OF_CONDUCT.md
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
This code of conduct applies to all spaces provided by the OpenSource project including in code, documentation, issue trackers, mailing lists, chat channels, wikis, blogs, social media and any other communication channels used by the project.
|
||||
|
||||
**Our open source communities endeavor to:**
|
||||
|
||||
- Be Inclusive: We are committed to being a community where everyone can join and contribute. This means using inclusive and welcoming language.
|
||||
- Be Welcoming: We are committed to maintaining a safe space for everyone to be able to contribute.
|
||||
- Be Respectful: We are committed to encouraging differing viewpoints, accepting constructive criticism and work collaboratively towards decisions that help the project grow. Disrespectful and unacceptable behavior will not be tolerated.
|
||||
- Be Collaborative: We are committed to supporting what is best for our community and users. When we build anything for the benefit of the project, we should document the work we do and communicate to others on how this affects their work.
|
||||
|
||||
**Our Responsibility. As contributors, members, or bystanders we each individually have the responsibility to behave professionally and respectfully at all times. Disrespectful and unacceptable behaviors include, but are not limited to:**
|
||||
|
||||
- The use of violent threats, abusive, discriminatory, or derogatory language;
|
||||
- Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, race, political or religious affiliation;
|
||||
- Posting of sexually explicit or violent content;
|
||||
- The use of sexualized language and unwelcome sexual attention or advances;
|
||||
- Public or private harassment of any kind;
|
||||
- Publishing private information, such as physical or electronic address, without permission;
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting;
|
||||
- Advocating for or encouraging any of the above behaviors.
|
||||
- Enforcement and Reporting Code of Conduct Issues:
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported. [Contact us](mailto:opensource-codeofconduct@amazon.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances.
|
||||
15
vendor/github.com/opensearch-project/opensearch-go/v4/COMPATIBILITY.md
generated
vendored
Normal file
15
vendor/github.com/opensearch-project/opensearch-go/v4/COMPATIBILITY.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
- [Compatibility with OpenSearch](#compatibility-with-opensearch)
|
||||
- [Upgrading](#upgrading)
|
||||
|
||||
## Compatibility with OpenSearch
|
||||
|
||||
The below matrix shows the compatibility of the [`opensearch-go`](https://pkg.go.dev/github.com/opensearch-project/opensearch-go) with versions of [`OpenSearch`](https://opensearch.org/downloads.html#opensearch).
|
||||
|
||||
| Client Version | OpenSearch Version |
|
||||
| -------------- | ------------------ |
|
||||
| 1.x.0 | 1.x |
|
||||
| 2.x.0 | 1.3.13-2.11.0 |
|
||||
|
||||
## Upgrading
|
||||
|
||||
Major versions of OpenSearch introduce breaking changes that require careful upgrades of the client. While `opensearch-go-client` 2.0.0 works against the latest OpenSearch 1.x, certain deprecated features removed in OpenSearch 2.0 have also been removed from the client. Please refer to the [OpenSearch documentation](https://opensearch.org/docs/latest/clients/index/) for more information.
|
||||
113
vendor/github.com/opensearch-project/opensearch-go/v4/CONTRIBUTING.md
generated
vendored
Normal file
113
vendor/github.com/opensearch-project/opensearch-go/v4/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
- [Contributing to OpenSearch](#contributing-to-opensearch)
|
||||
- [First Things First](#first-things-first)
|
||||
- [Ways to Contribute](#ways-to-contribute)
|
||||
- [Bug Reports](#bug-reports)
|
||||
- [Feature Requests](#feature-requests)
|
||||
- [Contributing Code](#contributing-code)
|
||||
- [Developer Certificate of Origin](#developer-certificate-of-origin)
|
||||
- [Changelog](#changelog)
|
||||
- [Adding Changes](#adding-changes)
|
||||
- [Review Process](#review-process)
|
||||
|
||||
## Contributing to OpenSearch
|
||||
|
||||
OpenSearch is a community project that is built and maintained by people just like **you**. We're glad you're interested in helping out. There are several different ways you can do it, but before we talk about that, let's talk about how to get started.
|
||||
|
||||
## First Things First
|
||||
|
||||
1. **When in doubt, open an issue** - For almost any type of contribution, the first step is opening an issue. Even if you think you already know what the solution is, writing down a description of the problem you're trying to solve will help everyone get context when they review your pull request. If it's truly a trivial change (e.g. spelling error), you can skip this step -- but as the subject says, when it doubt, [open an issue](https://github.com/opensearch-project/opensearch-go/issues/new/choose).
|
||||
|
||||
2. **Only submit your own work** (or work you have sufficient rights to submit) - Please make sure that any code or documentation you submit is your work or you have the rights to submit. We respect the intellectual property rights of others, and as part of contributing, we'll ask you to sign your contribution with a "Developer Certificate of Origin" (DCO) that states you have the rights to submit this work and you understand we'll use your contribution. There's more information about this topic in the [DCO section](#developer-certificate-of-origin).
|
||||
|
||||
## Ways to Contribute
|
||||
|
||||
### Bug Reports
|
||||
|
||||
Ugh! Bugs!
|
||||
|
||||
A bug is when software behaves in a way that you didn't expect and the developer didn't intend. To help us understand what's going on, we first want to make sure you're working from the latest version.
|
||||
|
||||
Once you've confirmed that the bug still exists in the latest version, you'll want to check to make sure it's not something we already know about on the [open issues GitHub page](https://github.com/opensearch-project/opensearch-go/issues/new/choose).
|
||||
|
||||
If you've upgraded to the latest version and you can't find it in our open issues list, then you'll need to tell us how to reproduce it Provide as much information as you can. You may think that the problem lies with your query, when actually it depends on how your data is indexed. The easier it is for us to recreate your problem, the faster it is likely to be fixed.
|
||||
|
||||
### Feature Requests
|
||||
|
||||
If you've thought of a way that OpenSearch could be better, we want to hear about it. We track feature requests using GitHub, so please feel free to open an issue which describes the feature you would like to see, why you need it, and how it should work.
|
||||
|
||||
### Contributing Code
|
||||
|
||||
As with other types of contributions, the first step is to [open an issue on GitHub](https://github.com/opensearch-project/opensearch-go/issues/new/choose). Opening an issue before you make changes makes sure that someone else isn't already working on that particular problem. It also lets us all work together to find the right approach before you spend a bunch of time on a PR. So again, when in doubt, open an issue.
|
||||
|
||||
## Developer Certificate of Origin
|
||||
|
||||
OpenSearch is an open source product released under the Apache 2.0 license (see either [the Apache site](https://www.apache.org/licenses/LICENSE-2.0) or the [LICENSE.txt file](LICENSE.txt)). The Apache 2.0 license allows you to freely use, modify, distribute, and sell your own products that include Apache 2.0 licensed software.
|
||||
|
||||
We respect intellectual property rights of others and we want to make sure all incoming contributions are correctly attributed and licensed. A Developer Certificate of Origin (DCO) is a lightweight mechanism to do that.
|
||||
|
||||
The DCO is a declaration attached to every contribution made by every developer. In the commit message of the contribution, the developer simply adds a `Signed-off-by` statement and thereby agrees to the DCO, which you can find below or at [DeveloperCertificate.org](http://developercertificate.org/).
|
||||
|
||||
```
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
(a) The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file; or
|
||||
|
||||
(b) The contribution is based upon previous work that, to the
|
||||
best of my knowledge, is covered under an appropriate open
|
||||
source license and I have the right under that license to
|
||||
submit that work with modifications, whether created in whole
|
||||
or in part by me, under the same open source license (unless
|
||||
I am permitted to submit under a different license), as
|
||||
Indicated in the file; or
|
||||
|
||||
(c) The contribution was provided directly to me by some other
|
||||
person who certified (a), (b) or (c) and I have not modified
|
||||
it.
|
||||
|
||||
(d) I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including
|
||||
all personal information I submit with it, including my
|
||||
sign-off) is maintained indefinitely and may be redistributed
|
||||
consistent with this project or the open source license(s)
|
||||
involved.
|
||||
```
|
||||
|
||||
We require that every contribution to OpenSearch is signed with a Developer Certificate of Origin. Additionally, please use your real name. We do not accept anonymous contributors nor those utilizing pseudonyms.
|
||||
|
||||
Each commit must include a DCO which looks like this
|
||||
|
||||
```
|
||||
Signed-off-by: Jane Smith <jane.smith@email.com>
|
||||
```
|
||||
|
||||
You may type this line on your own when writing your commit messages. However, if your user.name and user.email are set in your git configs, you can use `-s` or `– – signoff` to add the `Signed-off-by` line to the end of the commit message.
|
||||
|
||||
## Changelog
|
||||
|
||||
OpenSearch-go maintains a version specific changelog by enforcing a change to the ongoing [CHANGELOG](CHANGELOG.md) file adhering to the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.
|
||||
|
||||
The changes are curated by version, with the changes to the main branch added chronologically to the `Unreleased` version. Each version has corresponding sections which list out the category of the change - `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security`.
|
||||
|
||||
### Adding Changes
|
||||
|
||||
As a contributor, you must ensure that every pull request has its changes listed out within the corresponding version and appropriate section of the [CHANGELOG](CHANGELOG.md) file.
|
||||
|
||||
Adding in the change is a two step process -
|
||||
|
||||
1. Add your changes to the corresponding section within the CHANGELOG file with dummy pull request information, publish the PR.
|
||||
|
||||
2. Update the entry for your change in [`CHANGELOG.md`](CHANGELOG.md) and make sure that you reference the pull request there.
|
||||
|
||||
## Review Process
|
||||
|
||||
We deeply appreciate everyone who takes the time to make a contribution. We will review all contributions as quickly as possible. As a reminder, [opening an issue](https://github.com/opensearch-project/opensearch-go/issues/new/choose) discussing your change before you make it is the best way to smooth the PR process. This will prevent a rejection because someone else is already working on the problem, or because the solution is incompatible with the architectural direction.
|
||||
|
||||
During the PR process, expect that there will be some back-and-forth. Please try to respond to comments in a timely fashion, and if you don't wish to continue with the PR, let us know. If a PR takes too many iterations for its complexity or size, we may reject it. Additionally, if you stop responding we may close the PR as abandoned. In either case, if you feel this was done in error, please add a comment on the PR.
|
||||
|
||||
If we accept the PR, a [maintainer](MAINTAINERS.md) will merge your change and usually take care of backporting it to appropriate branches ourselves.
|
||||
|
||||
If we reject the PR, we will close the pull request with a comment explaining why. This decision isn't always final: if you feel we have misunderstood your intended change or otherwise think that we should reconsider then please continue the conversation with a comment on the PR and we'll do our best to address any further points you raise.
|
||||
147
vendor/github.com/opensearch-project/opensearch-go/v4/DEVELOPER_GUIDE.md
generated
vendored
Normal file
147
vendor/github.com/opensearch-project/opensearch-go/v4/DEVELOPER_GUIDE.md
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
- [Developer Guide](#developer-guide)
|
||||
- [Getting Started](#getting-started)
|
||||
- [Git Clone OpenSearch Go Client Repository](#git-clone-opensearch-go-client-repository)
|
||||
- [Install Prerequisites](#install-prerequisites)
|
||||
- [Go 1.21](#go-121)
|
||||
- [Docker](#docker)
|
||||
- [Windows](#windows)
|
||||
- [Unit Testing](#unit-testing)
|
||||
- [Integration Testing](#integration-testing)
|
||||
- [Composing an OpenSearch Docker Container](#composing-an-opensearch-docker-container)
|
||||
- [Execute integration tests from your terminal](#execute-integration-tests-from-your-terminal)
|
||||
- [Lint](#lint)
|
||||
- [Markdown lint](#markdown-lint)
|
||||
- [Go lint](#go-lint)
|
||||
- [Coverage](#coverage)
|
||||
- [Use an Editor](#use-an-editor)
|
||||
- [GoLand](#goland)
|
||||
- [Vim](#vim)
|
||||
|
||||
# Developer Guide
|
||||
|
||||
So you want to contribute code to the OpenSearch Go Client? Excellent! We're glad you're here. Here's what you need to do:
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Git Clone OpenSearch Go Client Repository
|
||||
|
||||
Fork [opensearch-project/opensearch-go](https://github.com/opensearch-project/opensearch-go) and clone locally, e.g. `git clone https://github.com/[your username]/opensearch-go.git`.
|
||||
|
||||
### Install Prerequisites
|
||||
|
||||
#### Go 1.21
|
||||
|
||||
OpenSearch Go Client builds using [Go](https://go.dev/doc/install) 1.21 at a minimum.
|
||||
|
||||
#### Docker
|
||||
|
||||
[Docker](https://docs.docker.com/get-docker/) is required for building some OpenSearch artifacts and executing integration tests.
|
||||
|
||||
#### Windows
|
||||
|
||||
To build the project on Windows, use [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install), the compatibility layer for running Linux applications.
|
||||
|
||||
Install `make`
|
||||
```
|
||||
sudo apt install make
|
||||
```
|
||||
|
||||
### Unit Testing
|
||||
|
||||
Go has a simple tool for running tests, and we simplified it further by creating this make command:
|
||||
|
||||
```
|
||||
make test-unit
|
||||
```
|
||||
|
||||
Individual unit tests can be run with the following command:
|
||||
|
||||
```
|
||||
cd folder-path/to/test;
|
||||
go test -v -run TestName;
|
||||
```
|
||||
|
||||
### Integration Testing
|
||||
|
||||
In order to test opensearch-go client, you need a running OpenSearch cluster. You can use Docker to accomplish this. The [Docker Compose file](.ci/opensearch/docker-compose.yml) supports the ability to run integration tests for the project in local environments. If you have not installed docker-compose, you can install it from this [link](https://docs.docker.com/compose/install/).
|
||||
|
||||
### Composing an OpenSearch Docker Container
|
||||
|
||||
Ensure that Docker is installed on your local machine. You can check by running `docker --version`. Next, navigate to your local opensearch-go repository. Run the following command to build and start the OpenSearch docker container.
|
||||
|
||||
```
|
||||
make cluster.build cluster.start
|
||||
```
|
||||
|
||||
This command will start the OpenSearch container using the `docker-compose.yaml` configuration file. During the build process, the necessary dependencies and files will be downloaded, which may take some time depending on your internet connection and system resources.
|
||||
|
||||
Once the container is built and running, you can open a web browser and navigate to localhost:9200 to access the OpenSearch docker container.
|
||||
|
||||
In order to differentiate unit tests from integration tests, Go has a built-in mechanism for allowing you to logically separate your tests with [build tags](https://pkg.go.dev/cmd/go#hdr-Build_constraints). The build tag needs to be placed as close to the top of the file as possible, and must have a blank line beneath it. Hence, create all integration tests with build tag 'integration'.
|
||||
|
||||
#### Execute integration tests from your terminal
|
||||
|
||||
1. Run below command to start containers. By default, it will launch latest OpenSearch cluster.
|
||||
```
|
||||
make cluster.build cluster.start
|
||||
```
|
||||
2. Run all integration tests.
|
||||
```
|
||||
make test-integ race=true
|
||||
```
|
||||
3. Stop and clean containers.
|
||||
```
|
||||
make cluster.stop cluster.clean
|
||||
```
|
||||
|
||||
## Lint
|
||||
|
||||
To keep all the code in a certain uniform format, it was decided to use some writing rules. If you wrote something wrong, it's okay, you can simply run the script to check the necessary files, and optionally format the content. But keep in mind that all these checks are repeated on the pipeline, so it's better to check locally.
|
||||
|
||||
### Markdown lint
|
||||
|
||||
To check the markdown files, run the following command:
|
||||
|
||||
```
|
||||
make lint.markdown
|
||||
```
|
||||
|
||||
### Go lint
|
||||
|
||||
To check all go files, run the following command:
|
||||
|
||||
```
|
||||
make linters
|
||||
```
|
||||
|
||||
## Coverage
|
||||
|
||||
To get the repository test coverage, run the following command:
|
||||
|
||||
For the results to be display in your terminal:
|
||||
|
||||
```
|
||||
make coverage
|
||||
```
|
||||
|
||||
For the results to be display in your browser:
|
||||
|
||||
```
|
||||
make coverage-html
|
||||
```
|
||||
|
||||
## Use an Editor
|
||||
|
||||
### GoLand
|
||||
|
||||
You can import the OpenSearch project into GoLand as follows:
|
||||
|
||||
1. Select **File | Open**
|
||||
2. In the subsequent dialog navigate to the ~/go/src/opensearch-go and click **Open**
|
||||
|
||||
After you have opened your project, you need to specify the location of the Go SDK. You can either specify a local path to the SDK or download it. To set the Go SDK, navigate to **Go | GOROOT** and set accordingly.
|
||||
|
||||
### Vim
|
||||
|
||||
To improve your vim experience with Go, you might want to check out [fatih/vim-go](https://github.com/fatih/vim-go).
|
||||
For example it correctly formats the file and validates it on save.
|
||||
201
vendor/github.com/opensearch-project/opensearch-go/v4/LICENSE.txt
generated
vendored
Normal file
201
vendor/github.com/opensearch-project/opensearch-go/v4/LICENSE.txt
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
21
vendor/github.com/opensearch-project/opensearch-go/v4/MAINTAINERS.md
generated
vendored
Normal file
21
vendor/github.com/opensearch-project/opensearch-go/v4/MAINTAINERS.md
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
## Overview
|
||||
|
||||
This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md).
|
||||
|
||||
## Current Maintainers
|
||||
|
||||
| Maintainer | GitHub ID | Affiliation |
|
||||
| ----------------------- | ----------------------------------------- | ------------------- |
|
||||
| Daniel Doubrovkine | [dblock](https://github.com/dblock) | Independent |
|
||||
| Jakob Hahn | [Jakob3xD](https://github.com/Jakob3xD) | Hetzner Online GmbH |
|
||||
| Vacha Shah | [VachaShah](https://github.com/VachaShah) | Amazon |
|
||||
| Vijayan Balasubramanian | [VijayanB](https://github.com/VijayanB) | Amazon |
|
||||
|
||||
## Emeritus
|
||||
|
||||
| Maintainer | GitHub ID | Affiliation |
|
||||
| ---------------------- | ------------------------------------------- | ----------- |
|
||||
| Jack Mazanec | [jmazanec15](https://github.com/jmazanec15) | Amazon |
|
||||
| Rob Cowart | [robcowart](https://github.com/robcowart) | ElastiFlow |
|
||||
| Sven Cowart | [svencowart](https://github.com/svencowart) | |
|
||||
| Vamshi Vijay Nakkirtha | [vamshin](https://github.com/vamshin) | Amazon |
|
||||
258
vendor/github.com/opensearch-project/opensearch-go/v4/Makefile
generated
vendored
Normal file
258
vendor/github.com/opensearch-project/opensearch-go/v4/Makefile
generated
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
##@ Format project using goimports tool
|
||||
format:
|
||||
goimports -w .;
|
||||
|
||||
##@ Test
|
||||
test-unit: ## Run unit tests
|
||||
@printf "\033[2m→ Running unit tests...\033[0m\n"
|
||||
ifdef race
|
||||
$(eval testunitargs += "-race")
|
||||
endif
|
||||
$(eval testunitargs += "-cover" "./..." "-args" "-test.gocoverdir=$(PWD)/tmp/unit")
|
||||
@mkdir -p $(PWD)/tmp/unit
|
||||
@echo "go test -v" $(testunitargs); \
|
||||
go test -v $(testunitargs);
|
||||
ifdef coverage
|
||||
@go tool covdata textfmt -i=$(PWD)/tmp/unit -o $(PWD)/tmp/unit.cov
|
||||
endif
|
||||
test: test-unit
|
||||
|
||||
test-integ: ## Run integration tests
|
||||
@printf "\033[2m→ Running integration tests...\033[0m\n"
|
||||
$(eval testintegtags += "integration,core,plugins")
|
||||
ifdef multinode
|
||||
$(eval testintegtags += "multinode")
|
||||
endif
|
||||
ifdef race
|
||||
$(eval testintegargs += "-race")
|
||||
endif
|
||||
$(eval testintegargs += "-cover" "-tags=$(testintegtags)" "-timeout=1h" "./..." "-args" "-test.gocoverdir=$(PWD)/tmp/integration")
|
||||
@mkdir -p $(PWD)/tmp/integration
|
||||
@echo "go test -v" $(testintegargs); \
|
||||
go test -v $(testintegargs);
|
||||
ifdef coverage
|
||||
@go tool covdata textfmt -i=$(PWD)/tmp/integration -o $(PWD)/tmp/integ.cov
|
||||
endif
|
||||
|
||||
test-integ-core: ## Run base integration tests
|
||||
@make test-integ testintegtags=integration,core
|
||||
|
||||
test-integ-plugins: ## Run plugin integration tests
|
||||
@make test-integ testintegtags=integration,plugins
|
||||
|
||||
test-integ-secure: ##Run secure integration tests
|
||||
@SECURE_INTEGRATION=true make test-integ
|
||||
|
||||
test-integ-core-secure: ## Run secure base integration tests
|
||||
@SECURE_INTEGRATION=true make test-integ testintegtags=integration,core
|
||||
|
||||
test-integ-plugins-secure: ## Run secure plugin integration tests
|
||||
@SECURE_INTEGRATION=true make test-integ testintegtags=integration,plugins
|
||||
|
||||
|
||||
test-bench: ## Run benchmarks
|
||||
@printf "\033[2m→ Running benchmarks...\033[0m\n"
|
||||
go test -run=none -bench=. -benchmem ./...
|
||||
|
||||
coverage: ## Print test coverage report
|
||||
@make gen-coverage
|
||||
@go tool cover -func=$(PWD)/tmp/total.cov
|
||||
@printf "\033[0m--------------------------------------------------------------------------------\n\033[0m"
|
||||
|
||||
coverage-html: ## Open test coverage report in browser
|
||||
@make gen-coverage
|
||||
@go tool cover -html $(PWD)/tmp/total.cov
|
||||
|
||||
gen-coverage: ## Generate test coverage report
|
||||
@printf "\033[2m→ Generating test coverage report...\033[0m\n"
|
||||
@rm -rf tmp
|
||||
@mkdir tmp
|
||||
@mkdir tmp/unit
|
||||
@mkdir tmp/integration
|
||||
@make test-unit coverage=true
|
||||
@make test-integ coverage=true
|
||||
@make build-coverage
|
||||
|
||||
build-coverage:
|
||||
@go tool covdata textfmt -i=$(PWD)/tmp/unit,$(PWD)/tmp/integration -o $(PWD)/tmp/total.cov
|
||||
|
||||
##@ Development
|
||||
lint: ## Run lint on the package
|
||||
@printf "\033[2m→ Running lint...\033[0m\n"
|
||||
go vet github.com/opensearch-project/opensearch-go/...
|
||||
go list github.com/opensearch-project/opensearch-go/... | 'grep' -v internal | xargs golint -set_exit_status
|
||||
|
||||
package := "prettier"
|
||||
lint.markdown:
|
||||
@printf "\033[2m→ Checking node installed...\033[0m\n"
|
||||
if type node > /dev/null 2>&1 && which node > /dev/null 2>&1 ; then \
|
||||
node -v; \
|
||||
echo -e "\033[33m Node is installed, continue...\033[0m\n"; \
|
||||
else \
|
||||
echo -e "\033[31m Please install node\033[0m\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@printf "\033[2m→ Checking npm installed...\033[0m\n"
|
||||
if type npm > /dev/null 2>&1 && which npm > /dev/null 2>&1 ; then \
|
||||
npm -v; \
|
||||
echo -e "\033[33m NPM is installed, continue...\033[0m\n"; \
|
||||
else \
|
||||
echo -e "\033[31m Please install npm\033[0m\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@printf "\033[2m→ Checking $(package) installed...\033[0m\n"
|
||||
if [ `npm list -g | grep -c $(package)` -eq 0 -o ! -d node_module ]; then \
|
||||
echo -e "\033[33m Installing $(package)...\033[0m"; \
|
||||
npm install -g $(package) --no-shrinkwrap; \
|
||||
fi
|
||||
@printf "\033[2m→ Running markdown lint...\033[0m\n"
|
||||
if npx $(package) --prose-wrap never --check **/*.md; [[ $$? -ne 0 ]]; then \
|
||||
echo -e "\033[32m→ Found invalid files. Want to auto-format invalid files? (y/n) \033[0m"; \
|
||||
read RESP; \
|
||||
if [[ $$RESP = "y" || $$RESP = "Y" ]]; then \
|
||||
echo -e "\033[33m Formatting...\033[0m"; \
|
||||
npx $(package) --prose-wrap never --write **/*.md; \
|
||||
echo -e "\033[34m \nAll invalid files are formatted\033[0m"; \
|
||||
else \
|
||||
echo -e "\033[33m Unfortunately you are cancelled auto fixing. But we will definitely fix it in the pipeline\033[0m"; \
|
||||
fi \
|
||||
fi
|
||||
|
||||
|
||||
backport: ## Backport one or more commits from main into version branches
|
||||
ifeq ($(origin commits), undefined)
|
||||
@echo "Missing commit(s), exiting..."
|
||||
@exit 2
|
||||
endif
|
||||
ifndef branches
|
||||
$(eval branches_list = '1.x')
|
||||
else
|
||||
$(eval branches_list = $(shell echo $(branches) | tr ',' ' ') )
|
||||
endif
|
||||
$(eval commits_list = $(shell echo $(commits) | tr ',' ' '))
|
||||
@printf "\033[2m→ Backporting commits [$(commits)]\033[0m\n"
|
||||
@{ \
|
||||
set -e -o pipefail; \
|
||||
for commit in $(commits_list); do \
|
||||
git show --pretty='%h | %s' --no-patch $$commit; \
|
||||
done; \
|
||||
echo ""; \
|
||||
for branch in $(branches_list); do \
|
||||
printf "\033[2m→ $$branch\033[0m\n"; \
|
||||
git checkout $$branch; \
|
||||
for commit in $(commits_list); do \
|
||||
git cherry-pick -x $$commit; \
|
||||
done; \
|
||||
git status --short --branch; \
|
||||
echo ""; \
|
||||
done; \
|
||||
printf "\033[2m→ Push updates to Github:\033[0m\n"; \
|
||||
for branch in $(branches_list); do \
|
||||
echo "git push --verbose origin $$branch"; \
|
||||
done; \
|
||||
}
|
||||
|
||||
release: ## Release a new version to Github
|
||||
$(eval branch = $(shell git rev-parse --abbrev-ref HEAD))
|
||||
$(eval current_version = $(shell cat internal/version/version.go | sed -Ee 's/const Client = "(.*)"/\1/' | tail -1))
|
||||
@printf "\033[2m→ [$(branch)] Current version: $(current_version)...\033[0m\n"
|
||||
ifndef version
|
||||
@printf "\033[31m[!] Missing version argument, exiting...\033[0m\n"
|
||||
@exit 2
|
||||
endif
|
||||
ifeq ($(version), "")
|
||||
@printf "\033[31m[!] Empty version argument, exiting...\033[0m\n"
|
||||
@exit 2
|
||||
endif
|
||||
@printf "\033[2m→ [$(branch)] Creating version $(version)...\033[0m\n"
|
||||
@{ \
|
||||
set -e -o pipefail; \
|
||||
cp internal/version/version.go internal/version/version.go.OLD && \
|
||||
cat internal/version/version.go.OLD | sed -e 's/Client = ".*"/Client = "$(version)"/' > internal/version/version.go && \
|
||||
go vet internal/version/version.go && \
|
||||
go fmt internal/version/version.go && \
|
||||
git diff --color-words internal/version/version.go | tail -n 1; \
|
||||
}
|
||||
@{ \
|
||||
set -e -o pipefail; \
|
||||
printf "\033[2m→ Commit and create Git tag? (y/n): \033[0m\c"; \
|
||||
read continue; \
|
||||
if [[ $$continue == "y" ]]; then \
|
||||
git add internal/version/version.go && \
|
||||
git commit --no-status --quiet --message "Release $(version)" && \
|
||||
git tag --annotate v$(version) --message 'Release $(version)'; \
|
||||
printf "\033[2m→ Push `git show --pretty='%h (%s)' --no-patch HEAD` to Github:\033[0m\n\n"; \
|
||||
printf "\033[1m git push origin HEAD && git push origin v$(version)\033[0m\n\n"; \
|
||||
mv internal/version/version.go.OLD internal/version/version.go && \
|
||||
git add internal/version/version.go && \
|
||||
original_version=`cat internal/version/version.go | sed -ne 's;^const Client = "\(.*\)"$$;\1;p'` && \
|
||||
git commit --no-status --quiet --message "Update version to $$original_version"; \
|
||||
printf "\033[2m→ Version updated to [$$original_version].\033[0m\n\n"; \
|
||||
else \
|
||||
echo "Aborting..."; \
|
||||
rm internal/version/version.go.OLD; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
}
|
||||
|
||||
godoc: ## Display documentation for the package
|
||||
@printf "\033[2m→ Generating documentation...\033[0m\n"
|
||||
@echo "* http://localhost:6060/pkg/github.com/opensearch-project/opensearch-go"
|
||||
@echo "* http://localhost:6060/pkg/github.com/opensearch-project/opensearch-go/opensearchapi"
|
||||
@echo "* http://localhost:6060/pkg/github.com/opensearch-project/opensearch-go/opensearchtransport"
|
||||
@echo "* http://localhost:6060/pkg/github.com/opensearch-project/opensearch-go/opensearchutil"
|
||||
@printf "\n"
|
||||
godoc --http=localhost:6060 --play
|
||||
|
||||
cluster.build:
|
||||
docker compose --project-directory .ci/opensearch build --pull;
|
||||
|
||||
cluster.start:
|
||||
docker compose --project-directory .ci/opensearch up -d;
|
||||
|
||||
cluster.stop:
|
||||
docker compose --project-directory .ci/opensearch down;
|
||||
|
||||
cluster.get-cert:
|
||||
@if [[ -v SECURE_INTEGRATION ]] && [[ $$SECURE_INTEGRATION == "true" ]]; then \
|
||||
docker cp $$(docker compose --project-directory .ci/opensearch ps --format '{{.Name}}'):/usr/share/opensearch/config/kirk.pem admin.pem && \
|
||||
docker cp $$(docker compose --project-directory .ci/opensearch ps --format '{{.Name}}'):/usr/share/opensearch/config/kirk-key.pem admin.key; \
|
||||
fi
|
||||
|
||||
|
||||
cluster.clean: ## Remove unused Docker volumes and networks
|
||||
@printf "\033[2m→ Cleaning up Docker assets...\033[0m\n"
|
||||
docker volume prune --force
|
||||
docker network prune --force
|
||||
docker system prune --volumes --force
|
||||
|
||||
linters:
|
||||
docker run -t --rm -v $$(pwd):/app -v ~/.cache/golangci-lint/v1.54.2:/root/.cache -w /app golangci/golangci-lint:v1.54.2 golangci-lint run --timeout=5m
|
||||
|
||||
workflow: ## Run all github workflow commands here sequentially
|
||||
|
||||
# Lint
|
||||
make lint
|
||||
# License Checker
|
||||
.github/check-license-headers.sh
|
||||
# Unit Test
|
||||
make test-unit race=true
|
||||
# Benchmarks Test
|
||||
make test-bench
|
||||
# Integration Test
|
||||
### OpenSearch
|
||||
make cluster.clean cluster.build cluster.start
|
||||
make test-integ race=true
|
||||
make cluster.stop
|
||||
|
||||
##@ Other
|
||||
#------------------------------------------------------------------------------
|
||||
help: ## Display help
|
||||
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
||||
#------------- <https://suva.sh/posts/well-documented-makefiles> --------------
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
.PHONY: help backport cluster cluster.clean coverage godoc lint release test test-bench test-integ test-unit linters linters.install
|
||||
.SILENT: lint.markdown
|
||||
8
vendor/github.com/opensearch-project/opensearch-go/v4/NOTICE.txt
generated
vendored
Normal file
8
vendor/github.com/opensearch-project/opensearch-go/v4/NOTICE.txt
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
OpenSearch (https://opensearch.org/)
|
||||
Copyright 2021 OpenSearch Contributors
|
||||
|
||||
This product includes software developed by
|
||||
Elasticsearch (http://www.elastic.co).
|
||||
|
||||
This product includes software developed by The Apache Software
|
||||
Foundation (http://www.apache.org/).
|
||||
1
vendor/github.com/opensearch-project/opensearch-go/v4/OpenSearch.svg
generated
vendored
Normal file
1
vendor/github.com/opensearch-project/opensearch-go/v4/OpenSearch.svg
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<svg viewBox="0 0 372 72" height="64" fill="none" xmlns="http://www.w3.org/2000/svg"><style>.a{fill:#005EB8}.b{fill:#003B5C}@media(prefers-color-scheme:dark){.a{fill:#00A3E0}.b{fill:#B9D9EB}}</style><g class="a"><path d="M61.74 26.5a2.26 2.26 0 00-2.27 2.26 33.71 33.71 0 01-33.7 33.71 2.26 2.26 0 100 4.53A38.24 38.24 0 0064 28.76a2.26 2.26 0 00-2.26-2.26zM3.92 17A24.43 24.43 0 00.05 31.9c.86 13.73 13.3 24.14 25.03 23.02 4.6-.45 9.31-4.2 8.9-10.9-.19-2.92-1.62-4.64-3.93-5.96C27.84 36.8 25 36 21.79 35.1c-3.89-1.1-8.4-2.32-11.85-4.87-4.15-3.06-6.99-6.6-6.02-13.23z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M107.78 48.26c3.15-4.49 4.72-10.92 4.72-19.28 0-8.36-1.56-14.77-4.69-19.24C104.7 5.24 100.2 3 94.34 3 88.4 3 83.87 5.23 80.72 9.7 77.57 14.15 76 20.55 76 28.91c0 8.43 1.57 14.9 4.72 19.39 3.15 4.47 7.67 6.7 13.55 6.7 5.86 0 10.36-2.25 13.5-6.74zm-19.94-6.11c-1.46-3.02-2.19-7.4-2.19-13.17 0-5.78.73-10.17 2.2-13.16 1.45-3.02 3.62-4.53 6.49-4.53 5.65 0 8.47 5.9 8.47 17.7 0 11.79-2.85 17.68-8.54 17.68-2.83 0-4.97-1.5-6.43-4.52zM128.2 54c1.28.74 2.66 1 4.31 1 3.53 0 6.4-1.67 8.44-5.24C142.98 46.2 144 41.28 144 35c0-6.36-.99-11.28-2.96-14.76-1.97-3.5-4.7-5.24-8.18-5.24-3.62 0-6.46 2.16-8.36 6h-.5l-1.5-5h-7v55.5h9V55c0-.65-.13-2.85-.5-6h.5a10.06 10.06 0 003.69 5zm-2.3-28.62c.8-1.69 2.09-2.53 3.88-2.53 1.67 0 2.9 1 3.68 2.98.8 2 1.2 5 1.2 9.03 0 8.2-1.6 12.3-4.81 12.3-1.86 0-3.19-.98-4-2.92-.8-1.95-1.2-5.05-1.2-9.3v-1.22c.05-3.9.46-6.67 1.24-8.34zM161.64 55c-4.84 0-8.67-1.7-11.48-5.13-2.78-3.44-4.17-8.3-4.17-14.58 0-6.37 1.26-11.34 3.8-14.92 2.52-3.58 6.04-5.37 10.56-5.37 4.23 0 7.55 1.54 9.99 4.6 2.43 3.05 3.65 7.34 3.65 12.85v5.05h-18.5c.07 3.44.67 5.88 2.01 7.56a6.77 6.77 0 005.57 2.5c3.01 0 6.1-.94 9.25-2.81v7.58c-2.97 1.78-6.53 2.67-10.68 2.67zm-1.35-32.9c-1.33 0-2.42.7-3.27 2.11-.86 1.39-1.4 3.86-1.53 6.79h9.5c-.05-2.82-.55-5.26-1.37-6.72-.8-1.45-1.92-2.18-3.33-2.18zm36.2 8.9v23h9V29.2c0-4.64-.88-8.17-2.63-10.58C201.14 16.2 198.52 15 195 15c-2.08 0-3.9.51-5.44 1.53-1.55 1-2.74 2.68-3.57 4.47h-.5l-1.25-5H177v38h9.5V35.75c0-4.71.17-7.92 1.1-9.9.92-1.99 2.37-2.98 4.36-2.98 1.5 0 2.59.71 3.25 2.15A13.12 13.12 0 01196.5 31z"/></g><g class="b"><path d="M48.08 41a24.43 24.43 0 003.87-14.9c-.86-13.73-13.3-24.14-25.03-23.02-4.6.45-9.31 4.2-8.9 10.9.19 2.92 1.62 4.64 3.93 5.96C24.16 21.2 27 22 30.21 22.9c3.89 1.1 8.4 2.32 11.85 4.87 4.15 3.06 6.99 6.6 6.02 13.23z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M362.5 31v23h9V29c0-4.6-.9-8.09-2.7-10.45-1.8-2.38-4.52-3.55-8.05-3.55-3.83 0-6.9 2.24-8.75 6h-.5c.14-1.94.26-3.05.35-3.86.1-.84.15-1.36.15-2.14V.5h-9V54h9.5V35.5c0-4.15.14-7.22 1-9.42.85-2.22 2.34-3.33 4.46-3.33 2.84 0 4.54 2.63 4.54 8.25zM231.85 51.23c2.43-2.52 3.65-6.14 3.65-10.86 0-2.96-.67-5.59-2-7.9-1.3-2.3-3.63-4.56-6.98-6.77-2.48-1.62-4.22-3.06-5.23-4.33a7.08 7.08 0 01-1.47-4.46c0-1.73.41-3.1 1.23-4.08a4.39 4.39 0 013.58-1.53c1.4 0 2.7.26 3.93.76 1.23.51 2.41 1.09 3.54 1.73l3.15-7.54A21.76 21.76 0 00223.93 3c-4.12 0-7.4 1.27-9.86 3.8-2.43 2.54-3.65 5.98-3.65 10.32 0 2.26.3 4.24.91 5.95.63 1.7 1.51 3.25 2.63 4.63a24.91 24.91 0 005.02 4.3c2.53 1.7 4.34 3.26 5.44 4.66a7.22 7.22 0 011.65 4.6c0 1.71-.47 3.06-1.4 4.05-.92 1-2.29 1.49-4.11 1.49-3.2 0-6.72-1.23-10.56-3.7v9.3c3.13 1.74 6.93 2.6 11.4 2.6 4.56 0 8.04-1.26 10.45-3.77zm9.82-1.36c2.81 3.42 6.64 5.13 11.48 5.13 4.15 0 7.71-.89 10.68-2.67v-7.58c-3.15 1.87-6.24 2.8-9.25 2.8a6.77 6.77 0 01-5.57-2.49c-1.34-1.68-1.94-4.12-2.01-7.56h18.5v-5.05c0-5.51-1.22-9.8-3.65-12.84-2.44-3.07-5.76-4.61-9.99-4.61-4.52 0-8.04 1.79-10.57 5.37-2.53 3.58-3.79 8.55-3.79 14.92 0 6.28 1.4 11.14 4.17 14.58zm6.86-25.66c.85-1.4 1.94-2.11 3.27-2.11 1.41 0 2.52.73 3.33 2.18.82 1.46 1.32 3.9 1.37 6.72H247c.14-2.93.67-5.4 1.53-6.79zM288 54l-1.5-5h-.5c-1.38 2.26-2.7 3.87-4.18 4.72a10.99 10.99 0 01-5.57 1.28 8.17 8.17 0 01-6.8-3.18c-1.63-2.12-2.45-5.07-2.45-8.85 0-4.06 1.12-7.07 3.36-9.02 2.27-1.99 5.65-3.08 10.13-3.29l5.19-.2v-2.77c0-3.6-1.58-5.4-4.73-5.4-2.34 0-5.03.9-8.06 2.7l-3.23-6.36A23.23 23.23 0 01282.25 15c4.13 0 7.34 1.18 9.5 3.53 2.16 2.32 3.25 5.63 3.25 9.92V54h-7zm-7.93-6.2c1.7 0 3.06-.74 4.07-2.24 1.02-1.52 1.54-3.54 1.54-6.05v-3.25l-2.88.14c-2.12.12-3.69.71-4.7 1.8-.97 1.08-1.46 2.7-1.46 4.84 0 3.18 1.14 4.77 3.43 4.77zM318 15.76a14.31 14.31 0 00-3.78-.75 6.1 6.1 0 00-4.13 1.55A10.4 10.4 0 00307 21h-.5l-1.5-5h-7v38h9.46V34c0-3.36.22-5.52 1.4-7.27a5.76 5.76 0 015.09-2.66c1.02 0 1.91.2 2.55.43l1.5-8.75zM332 55c-4.56 0-8.05-1.52-10.43-4.87-2.38-3.35-3.57-8.27-3.57-14.75 0-6.8 1.12-11.86 3.37-15.2 2.26-3.35 5.65-5.18 10.37-5.18 1.41 0 3.01.36 4.57.78 1.56.41 3.45.94 4.69 1.72l-3.11 7.24c-1.9-1.13-3.58-1.7-5.05-1.7-1.95 0-3.35 1.04-4.23 3.09-.84 2.03-1.27 5.1-1.27 9.18 0 4 .43 6.98 1.27 8.97.85 1.96 2.24 2.94 4.16 2.94 2.3 0 4.68-.8 7.18-2.42v8.1c-2.4 1.5-5.04 2.1-7.95 2.1z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
42
vendor/github.com/opensearch-project/opensearch-go/v4/README.md
generated
vendored
Normal file
42
vendor/github.com/opensearch-project/opensearch-go/v4/README.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
[](https://pkg.go.dev/github.com/opensearch-project/opensearch-go/v4) [](https://github.com/opensearch-project/opensearch-go/actions/workflows/lint.yml) [](https://github.com/opensearch-project/opensearch-go/actions/workflows/test-unit.yml) [](https://github.com/opensearch-project/opensearch-go/actions/workflows/test-integration.yml) [](https://codecov.io/gh/opensearch-project/opensearch-go) [](https://discuss.opendistrocommunity.dev/c/clients/) 
|
||||
|
||||

|
||||
|
||||
OpenSearch Go Client
|
||||
|
||||
- [Welcome!](#welcome)
|
||||
- [Project Resources](#project-resources)
|
||||
- [Code of Conduct](#code-of-conduct)
|
||||
- [License](#license)
|
||||
- [Copyright](#copyright)
|
||||
|
||||
## Welcome!
|
||||
|
||||
**opensearch-go** is [a community-driven, open source fork](https://aws.amazon.com/blogs/opensource/introducing-opensearch/) of go-elasticsearch licensed under the [Apache v2.0 License](LICENSE.txt). For more information, see [opensearch.org](https://opensearch.org/).
|
||||
|
||||
## Project Resources
|
||||
|
||||
- [Project Website](https://opensearch.org/)
|
||||
- [Developer Guide](DEVELOPER_GUIDE.md)
|
||||
- [User Guide](USER_GUIDE.md)
|
||||
- [Documentation](https://opensearch.org/docs/latest/clients/go/)
|
||||
- [API Documentation](https://pkg.go.dev/github.com/opensearch-project/opensearch-go/v4)
|
||||
- Need help? Try [Forums](https://discuss.opendistrocommunity.dev/c/clients/)
|
||||
- [Project Principles](https://opensearch.org/#principles)
|
||||
- [Contributing to OpenSearch](CONTRIBUTING.md)
|
||||
- [Maintainer Responsibilities](MAINTAINERS.md)
|
||||
- [Release Management](RELEASING.md)
|
||||
- [Admin Responsibilities](ADMINS.md)
|
||||
- [Security](SECURITY.md)
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [opensource-codeofconduct@amazon.com](mailto:opensource-codeofconduct@amazon.com) with any additional questions or comments.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the [Apache v2.0 License](LICENSE.txt).
|
||||
|
||||
## Copyright
|
||||
|
||||
Copyright OpenSearch Contributors. See [NOTICE](NOTICE.txt) for details.
|
||||
61
vendor/github.com/opensearch-project/opensearch-go/v4/RELEASING.md
generated
vendored
Normal file
61
vendor/github.com/opensearch-project/opensearch-go/v4/RELEASING.md
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
- [Overview](#overview)
|
||||
- [Branching](#branching)
|
||||
- [Release Branching](#release-branching)
|
||||
- [Feature Branches](#feature-branches)
|
||||
- [Release Labels](#release-labels)
|
||||
- [Releasing](#releasing)
|
||||
|
||||
## Overview
|
||||
|
||||
This document explains the release strategy for artifacts in this organization.
|
||||
|
||||
## Branching
|
||||
|
||||
### Release Branching
|
||||
|
||||
Given the current major release of 1.0, projects in this organization maintain the following active branches.
|
||||
|
||||
- **main**: The next _major_ release. This is the branch where all merges take place and code moves fast.
|
||||
- **1.x**: The next _minor_ release. Once a change is merged into `main`, decide whether to backport it to `1.x`.
|
||||
- **1.0**: The _current_ release. In between minor releases, only hotfixes (e.g. security) are backported to `1.0`.
|
||||
|
||||
Label PRs with the next major version label (e.g. `2.0.0`) and merge changes into `main`. Label PRs that you believe need to be backported as `1.x` and `1.0`. Backport PRs by checking out the versioned branch, cherry-pick changes and open a PR against each target backport branch.
|
||||
|
||||
### Feature Branches
|
||||
|
||||
Do not creating branches in the upstream repo, use your fork, for the exception of long lasting feature branches that require active collaboration from multiple developers. Name feature branches `feature/<thing>`. Once the work is merged to `main`, please make sure to delete the feature branch.
|
||||
|
||||
## Release Labels
|
||||
|
||||
Repositories create consistent release labels, such as `v1.0.0`, `v1.1.0` and `v2.0.0`, as well as `patch` and `backport`. Use release labels to target an issue or a PR for a given release. See [MAINTAINERS](MAINTAINERS.md#triage-open-issues) for more information on triaging issues.
|
||||
|
||||
## Releasing
|
||||
|
||||
The release process is standard across repositories in this org and is run by a release manager volunteering from amongst [MAINTAINERS](MAINTAINERS.md).
|
||||
|
||||
1. Ensure that the version in [version.go](internal/version/version.go) is correct for the next release. The example here releases version 4.3.0.
|
||||
2. For major version releases, ensure that all references are up-to-date, e.g. `github.com/opensearch-project/opensearch-go/v4`, see [opensearch-go#444](https://github.com/opensearch-project/opensearch-go/pull/444).
|
||||
3. Edit the [CHANGELOG](CHANGELOG.md) and replace the `Unreleased` section with the version about to be released.
|
||||
4. Add a comparison link to the new version at the bottom of the [CHANGELOG](CHANGELOG.md).
|
||||
5. Create a pull request with the changes into `main`, e.g. [opensearch-go#443](https://github.com/opensearch-project/opensearch-go/pull/443).
|
||||
6. Create a tag, e.g. `v4.3.0`, and push it to the GitHub repo. This [makes the new version available](https://go.dev/doc/modules/publishing) on [pkg.go.dev](https://pkg.go.dev/github.com/opensearch-project/opensearch-go/v4).
|
||||
7. Draft and publish a [new GitHub release](https://github.com/opensearch-project/opensearch-go/releases/new) from the newly created tag.
|
||||
8. Create a new `Unreleased` section in the [CHANGELOG](CHANGELOG.md), increment version in [version.go](internal/version/version.go) to the next developer iteration (e.g. `4.3.1`), and make a pull request with this change into `main`, e.g. [opensearch-go#448](https://github.com/opensearch-project/opensearch-go/pull/448).
|
||||
```
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Removed
|
||||
|
||||
### Fixed
|
||||
|
||||
### Security
|
||||
|
||||
### Dependencies
|
||||
```
|
||||
9. Run `go list` with the new version to refresh [pkg.go.dev](https://pkg.go.dev/github.com/opensearch-project/opensearch-go/v4), e.g. `go list -m github.com/opensearch-project/opensearch-go/v4@v4.3.0`.
|
||||
3
vendor/github.com/opensearch-project/opensearch-go/v4/SECURITY.md
generated
vendored
Normal file
3
vendor/github.com/opensearch-project/opensearch-go/v4/SECURITY.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/) or directly via email to aws-security@amazon.com. Please do **not** create a public GitHub issue.
|
||||
307
vendor/github.com/opensearch-project/opensearch-go/v4/UPGRADING.md
generated
vendored
Normal file
307
vendor/github.com/opensearch-project/opensearch-go/v4/UPGRADING.md
generated
vendored
Normal file
@@ -0,0 +1,307 @@
|
||||
- [Upgrading Opensearch GO Client](#upgrading-opensearch-go-client)
|
||||
- [Upgrading to >= 4.0.0](#upgrading-to->=-4.0.0)
|
||||
- [error types](#error-types)
|
||||
- [Upgrading to >= 3.0.0](#upgrading-to->=-3.0.0)
|
||||
- [client creation](#client-creation)
|
||||
- [requests](#requests)
|
||||
- [responses](#responses)
|
||||
- [error handing](#error-handling)
|
||||
- [Upgrading to >= 2.3.0](#upgrading-to->=-2.3.0)
|
||||
- [snapshot delete](#snapshot-delete)
|
||||
|
||||
# Upgrading Opensearch GO Client
|
||||
|
||||
## Upgrading to >= 5.0.0
|
||||
Version 5.0.0 returns `*opensearch.StringError` error type instead of `*fmt.wrapError` when response received from the server is an unknown JSON. For example, consider delete document API which returns an unknown JSON body when document is not found.
|
||||
|
||||
Before 5.0.0:
|
||||
```go
|
||||
docDelResp, err = client.Document.Delete(ctx, opensearchapi.DocumentDeleteReq{Index: "movies", DocumentID: "3"})
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
|
||||
if !errors.Is(err, opensearch.ErrJSONUnmarshalBody) && docDelResp != nil {
|
||||
resp := docDelResp.Inspect().Response
|
||||
// get http status
|
||||
fmt.Println(resp.StatusCode)
|
||||
body := strings.TrimPrefix(err.Error(), "opensearch error response could not be parsed as error: ")
|
||||
errResp := opensearchapi.DocumentDeleteResp{}
|
||||
json.Unmarshal([]byte(body), &errResp)
|
||||
// extract result field from the body
|
||||
fmt.Println(errResp.Result)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
After 5.0.0:
|
||||
```go
|
||||
docDelResp, err = client.Document.Delete(ctx, opensearchapi.DocumentDeleteReq{Index: "movies", DocumentID: "3"})
|
||||
if err != nil {
|
||||
// parse into *opensearch.StringError
|
||||
var myStringErr *opensearch.StringError
|
||||
if errors.As(err, &myStringErr) {
|
||||
// get http status
|
||||
fmt.Println(myStringErr.Status)
|
||||
errResp := opensearchapi.DocumentDeleteResp{}
|
||||
json.Unmarshal([]byte(myStringErr.Err), &errResp)
|
||||
// extract result field from the body
|
||||
fmt.Println(errResp.Result)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Upgrading to >= 4.0.0
|
||||
|
||||
Version 4.0.0 moved the error types, added with 3.0.0, from opensearchapi to opensearch, renamed them and added new error types.
|
||||
|
||||
### Error Types
|
||||
|
||||
Before 4.0.0:
|
||||
Error types:
|
||||
- `opensearchapi.Error`
|
||||
- `opensearchapi.StringError`
|
||||
|
||||
With 4.0.0:
|
||||
Error types
|
||||
- `opensearch.Error`
|
||||
- `opensearch.StringError`
|
||||
- `opensearch.ReasonError`
|
||||
- `opensearch.MessageError`
|
||||
- `opensearch.StructError` (which was the `opensearchapi.Error`)
|
||||
|
||||
## Upgrading to >= 3.0.0
|
||||
|
||||
Version 3.0.0 is a major refactor of the client.
|
||||
|
||||
### Client Creation
|
||||
You now create the client from the opensearchapi and not from the opensearch lib. This was done to make the different APIs independent from each other. Plugin APIs like Security will get there own folder and therefore its own sub-lib.
|
||||
|
||||
Before 3.0.0:
|
||||
```go
|
||||
// default client
|
||||
client, err := opensearch.NewDefaultClient()
|
||||
|
||||
// with config
|
||||
client, err := opensearch.NewClient(
|
||||
opensearch.Config{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
},
|
||||
Addresses: []string{"https://localhost:9200"},
|
||||
Username: "admin",
|
||||
Password: "admin",
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
With 3.0.0:
|
||||
|
||||
```go
|
||||
// default client
|
||||
client, err := opensearchapi.NewDefaultClient()
|
||||
|
||||
// with config
|
||||
client, err := opensearchapi.NewClient(
|
||||
opensearchapi.Config{
|
||||
Client: opensearch.Config{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // For testing only. Use certificate for validation.
|
||||
},
|
||||
Addresses: []string{"https://localhost:9200"},
|
||||
Username: "admin", // For testing only. Don't store credentials in code.
|
||||
Password: "admin",
|
||||
},
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
### Requests
|
||||
|
||||
Prior version 3.0.0 there were two options on how to perform requests. You could either use the request struct of the wished function and execute it with the client .Do() function or use the client function and add wanted args with so called With<arg>() functions. With the new version you now use functions attached to the client and give a context and the wanted request body as argument.
|
||||
|
||||
Before 3.0.0:
|
||||
|
||||
```go
|
||||
// using the client function and adding args by using the With<arg>() functions
|
||||
createIndex, err := client.Indices.Create(
|
||||
"some-index",
|
||||
client.Indices.Create.WithContext(ctx),
|
||||
client.Indices.Create.WithBody(strings.NewReader(`{"settings":{"index":{"number_of_shards":4}}}`)),
|
||||
)
|
||||
|
||||
// using the request struct
|
||||
createIndex := opensearchapi.IndicesCreateRequest{
|
||||
Index: "some-index",
|
||||
Body: strings.NewReader(`{"settings":{"index":{"number_of_shards":4}}}`),
|
||||
}
|
||||
createIndexResponse, err := createIndex.Do(ctx, client)
|
||||
```
|
||||
|
||||
With 3.0.0:
|
||||
|
||||
```go
|
||||
createIndexResponse, err := client.Indices.Create(
|
||||
ctx,
|
||||
opensearchapi.IndicesCreateReq{
|
||||
Index: "some-index",
|
||||
Body: strings.NewReader(`{"settings":{"index":{"number_of_shards":4}}}`),
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
### Responses
|
||||
|
||||
With the version 3.0.0 the lib no longer returns the opensearch.Response which is just a wrap up http.Response. Instead it will check the response for errors and try to parse the body into existing structs. Please note that some responses are so complex that we parse them as [json.RawMessage](https://pkg.go.dev/encoding/json#RawMessage) so you can parse them to your expected struct. If you need the opensearch.Response, then you can call .Inspect().
|
||||
|
||||
Before 3.0.0:
|
||||
|
||||
```go
|
||||
// Create the request
|
||||
createIndex := opensearchapi.IndicesCreateRequest{
|
||||
Index: "some-index",
|
||||
Body: strings.NewReader(`{"settings":{"index":{"number_of_shards":4}}}`),
|
||||
}
|
||||
// Execute the requests
|
||||
resp, err := createIndex.Do(ctx, client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Close the body
|
||||
defer resp.Body.Close()
|
||||
|
||||
// Check if the status code is >299
|
||||
if resp.IsError() {
|
||||
return fmt.Errorf("Opensearch Returned an error: %#v", resp)
|
||||
}
|
||||
|
||||
// Create a struct that represents the create index response
|
||||
createResp := struct {
|
||||
Acknowledged bool `json:"acknowledged"`
|
||||
ShardsAcknowledged bool `json:"shards_acknowledged"`
|
||||
Index string `json:"index"`
|
||||
}
|
||||
|
||||
// Try to parse the response into the created struct
|
||||
if err := json.NewDecoder(resp.Body).Decode(&createResp); err != nil {
|
||||
return fmt.Errorf("Undexpected response body: %s, %#v, %s"resp.StatusCode, resp.Body, err)
|
||||
}
|
||||
// Print the created index name
|
||||
fmt.Println(createResp.Index)
|
||||
```
|
||||
|
||||
With 3.0.0:
|
||||
|
||||
```go
|
||||
// Create and execute the requests
|
||||
createResp, err := client.Indices.Create(
|
||||
ctx,
|
||||
opensearchapi.IndicesCreateReq{
|
||||
Index: "some-index",
|
||||
Body: strings.NewReader(`{"settings":{"index":{"number_of_shards":4}}}`),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Print the created index name
|
||||
fmt.Println(createResp.Index)
|
||||
|
||||
// To get the opensearch.Response/http.Response
|
||||
rawResp := createResp.Inspect().Response
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
||||
With opensearch-go >= 3.0.0 opensearchapi responses are now checked for errors. Checking for errors twice is no longer needed.
|
||||
|
||||
Prior versions only returned an error if the request failed to execute. For example if the client can't reach the server or the TLS handshake failed. With opensearch-go >= 3.0.0 each opensearchapi requests will return an error if the response http status code is > 299. The error can be parsed into the new `opensearchapi.Error` type by using `errors.As` to match for exceptions and get a more detailed view.
|
||||
|
||||
Before 3.0.0:
|
||||
|
||||
```go
|
||||
// Create the request
|
||||
createIndex := opensearchapi.IndicesCreateRequest{
|
||||
Index: "some-index",
|
||||
Body: strings.NewReader(`{"settings":{"index":{"number_of_shards":4}}}`),
|
||||
}
|
||||
|
||||
// Execute the requests
|
||||
resp, err := createIndex.Do(ctx, client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Close the body
|
||||
defer resp.Body.Close()
|
||||
|
||||
// Check if the status code is >299
|
||||
if createIndexResp.IsError() {
|
||||
fmt.Errorf("Opensearch returned an error. Status: %d", createIndexResp.StatusCode)
|
||||
}
|
||||
```
|
||||
|
||||
With 3.0.0:
|
||||
|
||||
```go
|
||||
var opensearchError opensearchapi.Error
|
||||
// Create and execute the requests
|
||||
createResp, err := client.Indices.Create(
|
||||
ctx,
|
||||
opensearchapi.IndicesCreateReq{
|
||||
Index: "some-index",
|
||||
Body: strings.NewReader(`{"settings":{"index":{"number_of_shards":4}}}`),
|
||||
},
|
||||
)
|
||||
// Load err into opensearchapi.Error to access the fields and tolerate if the index already exists
|
||||
if err != nil {
|
||||
if errors.As(err, &opensearchError) {
|
||||
if opensearchError.Err.Type != "resource_already_exists_exception" {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Upgrading to >= 2.3.0
|
||||
|
||||
### Snapshot Delete
|
||||
|
||||
`SnapshotDeleteRequest` and `SnapshotDelete` changed the argument `Snapshot` type from `string` to `[]string`.
|
||||
|
||||
Before 2.3.0:
|
||||
|
||||
```go
|
||||
// If you have a string containing your snapshot
|
||||
stringSnapshotsToDelete := "snapshot-1,snapshot-2"
|
||||
reqSnapshots := &opensearchapi.SnapshotDeleteRequest{
|
||||
Repository: repo,
|
||||
Snapshot: stringSnapshotsToDelete,
|
||||
}
|
||||
|
||||
// If you have a slice of strings containing your snapshot
|
||||
sliceSnapshotToDelete := []string{"snapshot-1","snapshot-2"}
|
||||
reqSnapshots := &opensearchapi.SnapshotDeleteRequest{
|
||||
Repository: repo,
|
||||
Snapshot: strings.Join(sliceSnapshotsToDelete, ","),
|
||||
}
|
||||
```
|
||||
|
||||
With 2.3.0:
|
||||
|
||||
```go
|
||||
// If you have a string containing your snapshots
|
||||
stringSnapshotsToDelete := strings.Split("snapshot-1,snapshot-2", ",")
|
||||
reqSnapshots := &opensearchapi.SnapshotDeleteRequest{
|
||||
Repository: repo,
|
||||
Snapshot: stringSnapshotsToDelete,
|
||||
}
|
||||
|
||||
// If you have a slice of strings containing your snapshots
|
||||
sliceSnapshotToDelete := []string{"snapshot-1", "snapshot-2"}
|
||||
reqSnapshots := &opensearchapi.SnapshotDeleteRequest{
|
||||
Repository: repo,
|
||||
Snapshot: sliceSnapshotsToDelete,
|
||||
```
|
||||
399
vendor/github.com/opensearch-project/opensearch-go/v4/USER_GUIDE.md
generated
vendored
Normal file
399
vendor/github.com/opensearch-project/opensearch-go/v4/USER_GUIDE.md
generated
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
- [User Guide](#user-guide)
|
||||
- [Example](#example)
|
||||
- [Amazon OpenSearch Service](#amazon-opensearch-service)
|
||||
- [AWS SDK v1](#aws-sdk-v1)
|
||||
- [AWS SDK v2](#aws-sdk-v2)
|
||||
- [Guides by Topic](#guides-by-topic)
|
||||
|
||||
# User Guide
|
||||
|
||||
## Example
|
||||
|
||||
In the example below, we create a client, an index with non-default settings, insert a document to the index, search for the document, delete the document and finally delete the index.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
"github.com/opensearch-project/opensearch-go/v4/opensearchapi"
|
||||
"github.com/opensearch-project/opensearch-go/v4/opensearchutil"
|
||||
)
|
||||
|
||||
const IndexName = "go-test-index1"
|
||||
|
||||
func main() {
|
||||
if err := example(); err != nil {
|
||||
fmt.Printf("Error: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func example() error {
|
||||
// Initialize the client with SSL/TLS enabled.
|
||||
client, err := opensearchapi.NewClient(
|
||||
opensearchapi.Config{
|
||||
Client: opensearch.Config{
|
||||
Transport: &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, // For testing only. Use certificate for validation.
|
||||
},
|
||||
Addresses: []string{"https://localhost:9200"},
|
||||
Username: "admin", // For testing only. Don't store credentials in code.
|
||||
Password: "myStrongPassword123!",
|
||||
},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
// Print OpenSearch version information on console.
|
||||
infoResp, err := client.Info(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Cluster INFO:\n Cluster Name: %s\n Cluster UUID: %s\n Version Number: %s\n", infoResp.ClusterName, infoResp.ClusterUUID, infoResp.Version.Number)
|
||||
|
||||
// Define index mapping.
|
||||
// Note: these particular settings (eg, shards/replicas)
|
||||
// will have no effect in AWS OpenSearch Serverless
|
||||
mapping := strings.NewReader(`{
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": 4
|
||||
}
|
||||
}
|
||||
}`)
|
||||
|
||||
// Create an index with non-default settings.
|
||||
createIndexResponse, err := client.Indices.Create(
|
||||
ctx,
|
||||
opensearchapi.IndicesCreateReq{
|
||||
Index: IndexName,
|
||||
Body: mapping,
|
||||
},
|
||||
)
|
||||
|
||||
var opensearchError *opensearch.StructError
|
||||
|
||||
// Load err into opensearch.Error to access the fields and tolerate if the index already exists
|
||||
if err != nil {
|
||||
if errors.As(err, &opensearchError) {
|
||||
if opensearchError.Err.Type != "resource_already_exists_exception" {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
fmt.Printf("Created Index: %s\n Shards Acknowledged: %t\n", createIndexResponse.Index, createIndexResponse.ShardsAcknowledged)
|
||||
|
||||
// When using a structure, the conversion process to io.Reader can be omitted using utility functions.
|
||||
document := struct {
|
||||
Title string `json:"title"`
|
||||
Director string `json:"director"`
|
||||
Year string `json:"year"`
|
||||
}{
|
||||
Title: "Moneyball",
|
||||
Director: "Bennett Miller",
|
||||
Year: "2011",
|
||||
}
|
||||
|
||||
docId := "1"
|
||||
insertResp, err := client.Index(
|
||||
ctx,
|
||||
opensearchapi.IndexReq{
|
||||
Index: IndexName,
|
||||
DocumentID: docId,
|
||||
Body: opensearchutil.NewJSONReader(&document),
|
||||
Params: opensearchapi.IndexParams{
|
||||
Refresh: "true",
|
||||
},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Created document in %s\n ID: %s\n", insertResp.Index, insertResp.ID)
|
||||
|
||||
// Search for the document.
|
||||
content := strings.NewReader(`{
|
||||
"size": 5,
|
||||
"query": {
|
||||
"multi_match": {
|
||||
"query": "miller",
|
||||
"fields": ["title^2", "director"]
|
||||
}
|
||||
}
|
||||
}`)
|
||||
|
||||
searchResp, err := client.Search(
|
||||
ctx,
|
||||
&opensearchapi.SearchReq{
|
||||
Body: content,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Search hits: %v\n", searchResp.Hits.Total.Value)
|
||||
|
||||
if searchResp.Hits.Total.Value > 0 {
|
||||
indices := make([]string, 0)
|
||||
for _, hit := range searchResp.Hits.Hits {
|
||||
add := true
|
||||
for _, index := range indices {
|
||||
if index == hit.Index {
|
||||
add = false
|
||||
}
|
||||
}
|
||||
if add {
|
||||
indices = append(indices, hit.Index)
|
||||
}
|
||||
}
|
||||
fmt.Printf("Search indices: %s\n", strings.Join(indices, ","))
|
||||
}
|
||||
|
||||
// Delete the document.
|
||||
deleteReq := opensearchapi.DocumentDeleteReq{
|
||||
Index: IndexName,
|
||||
DocumentID: docId,
|
||||
}
|
||||
|
||||
deleteResponse, err := client.Document.Delete(ctx, deleteReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted document: %t\n", deleteResponse.Result == "deleted")
|
||||
|
||||
// Delete previously created index.
|
||||
deleteIndex := opensearchapi.IndicesDeleteReq{Indices: []string{IndexName}}
|
||||
|
||||
deleteIndexResp, err := client.Indices.Delete(ctx, deleteIndex)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Deleted index: %t\n", deleteIndexResp.Acknowledged)
|
||||
|
||||
// Try to delete the index again which fails as it does not exist
|
||||
_, err = client.Indices.Delete(ctx, deleteIndex)
|
||||
|
||||
// Load err into opensearchapi.Error to access the fields and tolerate if the index is missing
|
||||
if err != nil {
|
||||
if errors.As(err, &opensearchError) {
|
||||
if opensearchError.Err.Type != "index_not_found_exception" {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Amazon OpenSearch Service
|
||||
|
||||
Before starting, we strongly recommend reading the full AWS documentation regarding using IAM credentials to sign requests to OpenSearch APIs. See [Identity and Access Management in Amazon OpenSearch Service.](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ac.html)
|
||||
|
||||
> Even if you configure a completely open resource-based access policy, all requests to the OpenSearch Service configuration API must be signed. If your policies specify IAM users or roles, requests to the OpenSearch APIs also must be signed using AWS Signature Version 4.
|
||||
>
|
||||
> See [Managed Domains signing-service requests.](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ac.html#managedomains-signing-service-requests)
|
||||
|
||||
Depending on the version of AWS SDK used, import the v1 or v2 request signer from `signer/aws` or `signer/awsv2` respectively. Both signers are equivalent in their functionality, they provide AWS Signature Version 4 (SigV4).
|
||||
|
||||
To read more about SigV4 see [Signature Version 4 signing process](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)
|
||||
|
||||
Here are some Go samples that show how to sign each OpenSearch request and automatically search for AWS credentials from the ~/.aws folder or environment variables:
|
||||
|
||||
### AWS SDK v1
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
requestsigner "github.com/opensearch-project/opensearch-go/v4/signer/aws"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
"github.com/opensearch-project/opensearch-go/v4/opensearchapi"
|
||||
)
|
||||
|
||||
const IndexName = "go-test-index1"
|
||||
|
||||
func main() {
|
||||
if err := example(); err != nil {
|
||||
fmt.Printf("Error: %s\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
const endpoint = "" // e.g. https://opensearch-domain.region.com
|
||||
|
||||
func example() error {
|
||||
// Create an AWS request Signer and load AWS configuration using default config folder or env vars.
|
||||
// See https://docs.aws.amazon.com/opensearch-service/latest/developerguide/request-signing.html#request-signing-go
|
||||
signer, err := requestsigner.NewSignerWithService(
|
||||
session.Options{SharedConfigState: session.SharedConfigEnable},
|
||||
requestsigner.OpenSearchService, // Use requestsigner.OpenSearchServerless for Amazon OpenSearch Serverless.
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Create an opensearch client and use the request-signer.
|
||||
client, err := opensearchapi.NewClient(
|
||||
opensearchapi.Config{
|
||||
Client: opensearch.Config{
|
||||
Addresses: []string{endpoint},
|
||||
Signer: signer,
|
||||
},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
ping, err := client.Ping(ctx, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println(ping)
|
||||
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
### AWS SDK v2
|
||||
|
||||
Use the AWS SDK v2 for Go to authenticate with Amazon OpenSearch service.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
"github.com/aws/aws-sdk-go-v2/config"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
"github.com/opensearch-project/opensearch-go/v4/opensearchapi"
|
||||
requestsigner "github.com/opensearch-project/opensearch-go/v4/signer/awsv2"
|
||||
)
|
||||
|
||||
const endpoint = "" // e.g. https://opensearch-domain.region.com or Amazon OpenSearch Serverless endpoint
|
||||
|
||||
func main() {
|
||||
if err := example(); err != nil {
|
||||
fmt.Println(fmt.Sprintf("Error: %s", err))
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
func example() error {
|
||||
ctx := context.Background()
|
||||
|
||||
awsCfg, err := config.LoadDefaultConfig(ctx,
|
||||
config.WithRegion("<AWS_REGION>"),
|
||||
config.WithCredentialsProvider(
|
||||
getCredentialProvider("<AWS_ACCESS_KEY>", "<AWS_SECRET_ACCESS_KEY>", "<AWS_SESSION_TOKEN>"),
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Create an AWS request Signer and load AWS configuration using default config folder or env vars.
|
||||
signer, err := requestsigner.NewSignerWithService(awsCfg, "es") // Use "aoss" for Amazon OpenSearch Serverless
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Create an opensearch client and use the request-signer.
|
||||
client, err := opensearchapi.NewClient(
|
||||
opensearchapi.Config{
|
||||
Client: opensearch.Config{
|
||||
Addresses: []string{endpoint},
|
||||
Signer: signer,
|
||||
},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
indexName := "go-test-index"
|
||||
|
||||
// Define index mapping.
|
||||
mapping := strings.NewReader(`{
|
||||
"settings": {
|
||||
"index": {
|
||||
"number_of_shards": 4
|
||||
}
|
||||
}
|
||||
}`)
|
||||
|
||||
// Create an index with non-default settings.
|
||||
createResp, err := client.Indices.Create(
|
||||
ctx,
|
||||
opensearchapi.IndicesCreateReq{
|
||||
Index: indexName,
|
||||
Body: mapping,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("created index: %s\n", createResp.Index)
|
||||
|
||||
delResp, err := client.Indices.Delete(ctx, opensearchapi.IndicesDeleteReq{Indices: []string{indexName}})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Printf("deleted index: %#v\n", delResp.Acknowledged)
|
||||
return nil
|
||||
}
|
||||
|
||||
func getCredentialProvider(accessKey, secretAccessKey, token string) aws.CredentialsProviderFunc {
|
||||
return func(ctx context.Context) (aws.Credentials, error) {
|
||||
c := &aws.Credentials{
|
||||
AccessKeyID: accessKey,
|
||||
SecretAccessKey: secretAccessKey,
|
||||
SessionToken: token,
|
||||
}
|
||||
return *c, nil
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Guides by Topic
|
||||
|
||||
- [Index Lifecycle](guides/index_lifecycle.md)
|
||||
- [Document Lifecycle](guides/document_lifecycle.md)
|
||||
- [Search](guides/search.md)
|
||||
- [Bulk](guides/bulk.md)
|
||||
- [Advanced Index Actions](guides/advanced_index_actions.md)
|
||||
- [Index Templates](guides/index_template.md)
|
||||
- [Data Streams](guides/data_streams.md)
|
||||
- [Retry and Backoff](guides/retry_backoff.md)
|
||||
74
vendor/github.com/opensearch-project/opensearch-go/v4/doc.go
generated
vendored
Normal file
74
vendor/github.com/opensearch-project/opensearch-go/v4/doc.go
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to opensearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
/*
|
||||
Package opensearch provides a Go client for OpenSearch.
|
||||
|
||||
Create the client with the NewDefaultClient function:
|
||||
|
||||
opensearch.NewDefaultClient()
|
||||
|
||||
The OPENSEARCH_URL/ELASTICSEARCH_URL environment variable is used instead of the default URL, when set.
|
||||
Use a comma to separate multiple URLs.
|
||||
It is an error to set both environment variable.
|
||||
|
||||
To configure the client, pass a Config object to the NewClient function:
|
||||
|
||||
cfg := opensearch.Config{
|
||||
Addresses: []string{
|
||||
"http://localhost:9200",
|
||||
"http://localhost:9201",
|
||||
},
|
||||
Username: "foo",
|
||||
Password: "bar",
|
||||
Transport: &http.Transport{
|
||||
MaxIdleConnsPerHost: 10,
|
||||
ResponseHeaderTimeout: time.Second,
|
||||
DialContext: (&net.Dialer{Timeout: time.Second}).DialContext,
|
||||
TLSClientConfig: &tls.Config{
|
||||
MinVersion: tls.VersionTLS11,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
opensearch.NewClient(cfg)
|
||||
|
||||
See the opensearch_integration_test.go file for more information.
|
||||
|
||||
Call the OpenSearch APIs by invoking the corresponding methods on the client:
|
||||
|
||||
res, err := client.Info()
|
||||
if err != nil {
|
||||
log.Fatalf("Error getting response: %s", err)
|
||||
}
|
||||
|
||||
log.Println(res)
|
||||
|
||||
See the github.com/opensearch-project/opensearch-go/opensearchapi package for more information about using the API.
|
||||
|
||||
See the github.com/opensearch-project/opensearch-go/opensearchtransport package for more information about configuring the transport.
|
||||
*/
|
||||
package opensearch
|
||||
182
vendor/github.com/opensearch-project/opensearch-go/v4/error.go
generated
vendored
Normal file
182
vendor/github.com/opensearch-project/opensearch-go/v4/error.go
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearch
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
)
|
||||
|
||||
// Error vars
|
||||
var (
|
||||
ErrUnexpectedEmptyBody = errors.New("body is unexpectedly empty")
|
||||
ErrReadBody = errors.New("failed to read body")
|
||||
ErrJSONUnmarshalBody = errors.New("failed to json unmarshal body")
|
||||
ErrUnknownOpensearchError = errors.New("opensearch error response could not be parsed as error")
|
||||
)
|
||||
|
||||
// Error represents an Opensearch error with only an error field
|
||||
type Error struct {
|
||||
Err string `json:"error"`
|
||||
}
|
||||
|
||||
// Error returns a string
|
||||
func (e Error) Error() string {
|
||||
return fmt.Sprintf("error: %s", e.Err)
|
||||
}
|
||||
|
||||
// StringError represnets an Opensearch error where error is a string
|
||||
type StringError struct {
|
||||
Err string `json:"error"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
// Error returns a string
|
||||
func (e StringError) Error() string {
|
||||
return fmt.Sprintf("status: %d, error: %s", e.Status, e.Err)
|
||||
}
|
||||
|
||||
// ReasonError represents an Opensearch error with a reason field
|
||||
type ReasonError struct {
|
||||
Reason string `json:"reason"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// Error returns a string
|
||||
func (e ReasonError) Error() string {
|
||||
return fmt.Sprintf("status: %s, reason: %s", e.Status, e.Reason)
|
||||
}
|
||||
|
||||
// MessageError represents an Opensearch error with a message field
|
||||
type MessageError struct {
|
||||
Message string `json:"message"`
|
||||
Status string `json:"status"`
|
||||
}
|
||||
|
||||
// Error returns a string
|
||||
func (e MessageError) Error() string {
|
||||
return fmt.Sprintf("status: %s, message: %s", e.Status, e.Message)
|
||||
}
|
||||
|
||||
// StructError represents an Opensearch error with a detailed error struct
|
||||
type StructError struct {
|
||||
Err Err `json:"error"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
// Err represents the error of an API error response
|
||||
type Err struct {
|
||||
RootCause []RootCause `json:"root_cause"`
|
||||
Type string `json:"type"`
|
||||
Reason string `json:"reason"`
|
||||
Index string `json:"index,omitempty"`
|
||||
IndexUUID string `json:"index_uuid,omitempty"`
|
||||
}
|
||||
|
||||
// RootCause represents the root_cause of an API error response
|
||||
type RootCause struct {
|
||||
Type string `json:"type"`
|
||||
Reason string `json:"reason"`
|
||||
Index string `json:"index,omitempty"`
|
||||
IndexUUID string `json:"index_uuid,omitempty"`
|
||||
}
|
||||
|
||||
// Error returns a string
|
||||
func (e StructError) Error() string {
|
||||
return fmt.Sprintf("status: %d, type: %s, reason: %s, root_cause: %s", e.Status, e.Err.Type, e.Err.Reason, e.Err.RootCause)
|
||||
}
|
||||
|
||||
// UnmarshalJSON is a custom unmarshal function for StructError returning custom errors in special cases
|
||||
func (e *StructError) UnmarshalJSON(b []byte) error {
|
||||
var dummy struct {
|
||||
Err json.RawMessage `json:"error"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
if err := json.Unmarshal(b, &dummy); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var osErr Err
|
||||
if err := json.Unmarshal(dummy.Err, &osErr); err != nil {
|
||||
return &StringError{Status: dummy.Status, Err: string(dummy.Err)}
|
||||
}
|
||||
if dummy.Status == 0 || (osErr.Type == "" && osErr.Reason == "") {
|
||||
return fmt.Errorf("%w: %s", ErrUnknownOpensearchError, b)
|
||||
}
|
||||
|
||||
e.Err = osErr
|
||||
e.Status = dummy.Status
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ParseError tries to parse the opensearch error into an custom error
|
||||
func ParseError(resp *Response) error {
|
||||
if resp.Body == nil {
|
||||
return fmt.Errorf("%w, status: %s", ErrUnexpectedEmptyBody, resp.Status())
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%w: %w", ErrReadBody, err)
|
||||
}
|
||||
|
||||
var testResp struct {
|
||||
Status any `json:"status"`
|
||||
Error any `json:"error"`
|
||||
Message any `json:"message"`
|
||||
Reason any `json:"reason"`
|
||||
}
|
||||
if err = json.Unmarshal(body, &testResp); err != nil {
|
||||
return fmt.Errorf("%w: %w", ErrJSONUnmarshalBody, err)
|
||||
}
|
||||
|
||||
// Check for errors where status is a number
|
||||
if _, ok := testResp.Status.(float64); ok {
|
||||
// Check for errors where error is a string
|
||||
if _, ok := testResp.Error.(string); ok {
|
||||
var apiError StringError
|
||||
return parseError(body, &apiError)
|
||||
}
|
||||
// Check for errors where error is a struct
|
||||
if _, ok := testResp.Error.(map[string]any); ok {
|
||||
var apiError StructError
|
||||
return parseError(body, &apiError)
|
||||
}
|
||||
}
|
||||
|
||||
// Check for errors where status is a string
|
||||
if _, ok := testResp.Status.(string); ok {
|
||||
// Check for erros where message is a string
|
||||
if _, ok := testResp.Message.(string); ok {
|
||||
var apiError MessageError
|
||||
return parseError(body, &apiError)
|
||||
}
|
||||
// Check for errors where reason is a string
|
||||
if _, ok := testResp.Reason.(string); ok {
|
||||
var apiError ReasonError
|
||||
return parseError(body, &apiError)
|
||||
}
|
||||
}
|
||||
|
||||
// Check for errors that only contain the error field
|
||||
if testResp.Status == nil && testResp.Message == nil && testResp.Reason == nil && testResp.Error != nil {
|
||||
var apiError Error
|
||||
return parseError(body, &apiError)
|
||||
}
|
||||
|
||||
return &StringError{Status: resp.StatusCode, Err: string(body)}
|
||||
}
|
||||
|
||||
func parseError(body []byte, errStruct error) error {
|
||||
if err := json.Unmarshal(body, &errStruct); err != nil {
|
||||
return fmt.Errorf("%w: %w: %s", ErrJSONUnmarshalBody, err, string(body))
|
||||
}
|
||||
return errStruct
|
||||
}
|
||||
30
vendor/github.com/opensearch-project/opensearch-go/v4/internal/version/version.go
generated
vendored
Normal file
30
vendor/github.com/opensearch-project/opensearch-go/v4/internal/version/version.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package version
|
||||
|
||||
// Client returns the client version as a string.
|
||||
const Client = "4.5.0"
|
||||
332
vendor/github.com/opensearch-project/opensearch-go/v4/opensearch.go
generated
vendored
Normal file
332
vendor/github.com/opensearch-project/opensearch-go/v4/opensearch.go
generated
vendored
Normal file
@@ -0,0 +1,332 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearch
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4/internal/version"
|
||||
"github.com/opensearch-project/opensearch-go/v4/opensearchtransport"
|
||||
"github.com/opensearch-project/opensearch-go/v4/signer"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultURL = "http://localhost:9200"
|
||||
openSearch = "opensearch"
|
||||
unsupportedProduct = "the client noticed that the server is not a supported distribution"
|
||||
envOpenSearchURL = "OPENSEARCH_URL"
|
||||
)
|
||||
|
||||
// Version returns the package version as a string.
|
||||
const Version = version.Client
|
||||
|
||||
// Error vars
|
||||
var (
|
||||
ErrCreateClient = errors.New("cannot create client")
|
||||
ErrCreateTransport = errors.New("error creating transport")
|
||||
ErrParseVersion = errors.New("failed to parse opensearch version")
|
||||
ErrParseURL = errors.New("cannot parse url")
|
||||
ErrTransportMissingMethodMetrics = errors.New("transport is missing method Metrics()")
|
||||
ErrTransportMissingMethodDiscoverNodes = errors.New("transport is missing method DiscoverNodes()")
|
||||
)
|
||||
|
||||
// Config represents the client configuration.
|
||||
type Config struct {
|
||||
Addresses []string // A list of nodes to use.
|
||||
Username string // Username for HTTP Basic Authentication.
|
||||
Password string // Password for HTTP Basic Authentication.
|
||||
|
||||
Header http.Header // Global HTTP request header.
|
||||
|
||||
Signer signer.Signer
|
||||
|
||||
// PEM-encoded certificate authorities.
|
||||
// When set, an empty certificate pool will be created, and the certificates will be appended to it.
|
||||
// The option is only valid when the transport is not specified, or when it's http.Transport.
|
||||
CACert []byte
|
||||
|
||||
RetryOnStatus []int // List of status codes for retry. Default: 502, 503, 504.
|
||||
DisableRetry bool // Default: false.
|
||||
EnableRetryOnTimeout bool // Default: false.
|
||||
MaxRetries int // Default: 3.
|
||||
|
||||
CompressRequestBody bool // Default: false.
|
||||
|
||||
DiscoverNodesOnStart bool // Discover nodes when initializing the client. Default: false.
|
||||
DiscoverNodesInterval time.Duration // Discover nodes periodically. Default: disabled.
|
||||
|
||||
EnableMetrics bool // Enable the metrics collection.
|
||||
EnableDebugLogger bool // Enable the debug logging.
|
||||
|
||||
RetryBackoff func(attempt int) time.Duration // Optional backoff duration. Default: nil.
|
||||
|
||||
Transport http.RoundTripper // The HTTP transport object.
|
||||
Logger opensearchtransport.Logger // The logger object.
|
||||
Selector opensearchtransport.Selector // The selector object.
|
||||
|
||||
// Optional constructor function for a custom ConnectionPool. Default: nil.
|
||||
ConnectionPoolFunc func([]*opensearchtransport.Connection, opensearchtransport.Selector) opensearchtransport.ConnectionPool
|
||||
}
|
||||
|
||||
// Client represents the OpenSearch client.
|
||||
type Client struct {
|
||||
Transport opensearchtransport.Interface
|
||||
}
|
||||
|
||||
// NewDefaultClient creates a new client with default options.
|
||||
//
|
||||
// It will use http://localhost:9200 as the default address.
|
||||
//
|
||||
// It will use the OPENSEARCH_URL/ELASTICSEARCH_URL environment variable, if set,
|
||||
// to configure the addresses; use a comma to separate multiple URLs.
|
||||
//
|
||||
// It's an error to set both OPENSEARCH_URL and ELASTICSEARCH_URL.
|
||||
func NewDefaultClient() (*Client, error) {
|
||||
return NewClient(Config{})
|
||||
}
|
||||
|
||||
// NewClient creates a new client with configuration from cfg.
|
||||
//
|
||||
// It will use http://localhost:9200 as the default address.
|
||||
//
|
||||
// It will use the OPENSEARCH_URL/ELASTICSEARCH_URL environment variable, if set,
|
||||
// to configure the addresses; use a comma to separate multiple URLs.
|
||||
//
|
||||
// It's an error to set both OPENSEARCH_URL and ELASTICSEARCH_URL.
|
||||
func NewClient(cfg Config) (*Client, error) {
|
||||
var addrs []string
|
||||
|
||||
if len(cfg.Addresses) == 0 {
|
||||
envAddress := getAddressFromEnvironment()
|
||||
addrs = envAddress
|
||||
} else {
|
||||
addrs = append(addrs, cfg.Addresses...)
|
||||
}
|
||||
|
||||
urls, err := addrsToURLs(addrs)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrCreateClient, err)
|
||||
}
|
||||
|
||||
if len(urls) == 0 {
|
||||
//nolint:errcheck // errcheck exclude ???
|
||||
u, _ := url.Parse(defaultURL)
|
||||
urls = append(urls, u)
|
||||
}
|
||||
|
||||
// TODO: Refactor
|
||||
if urls[0].User != nil {
|
||||
cfg.Username = urls[0].User.Username()
|
||||
pw, _ := urls[0].User.Password()
|
||||
cfg.Password = pw
|
||||
}
|
||||
|
||||
tp, err := opensearchtransport.New(opensearchtransport.Config{
|
||||
URLs: urls,
|
||||
Username: cfg.Username,
|
||||
Password: cfg.Password,
|
||||
|
||||
Header: cfg.Header,
|
||||
CACert: cfg.CACert,
|
||||
|
||||
Signer: cfg.Signer,
|
||||
|
||||
RetryOnStatus: cfg.RetryOnStatus,
|
||||
DisableRetry: cfg.DisableRetry,
|
||||
EnableRetryOnTimeout: cfg.EnableRetryOnTimeout,
|
||||
MaxRetries: cfg.MaxRetries,
|
||||
RetryBackoff: cfg.RetryBackoff,
|
||||
|
||||
CompressRequestBody: cfg.CompressRequestBody,
|
||||
|
||||
EnableMetrics: cfg.EnableMetrics,
|
||||
EnableDebugLogger: cfg.EnableDebugLogger,
|
||||
|
||||
DiscoverNodesInterval: cfg.DiscoverNodesInterval,
|
||||
|
||||
Transport: cfg.Transport,
|
||||
Logger: cfg.Logger,
|
||||
Selector: cfg.Selector,
|
||||
ConnectionPoolFunc: cfg.ConnectionPoolFunc,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrCreateTransport, err)
|
||||
}
|
||||
|
||||
client := &Client{Transport: tp}
|
||||
|
||||
if cfg.DiscoverNodesOnStart {
|
||||
//nolint:errcheck // goroutine discards return values
|
||||
go client.DiscoverNodes()
|
||||
}
|
||||
|
||||
return client, err
|
||||
}
|
||||
|
||||
func getAddressFromEnvironment() []string {
|
||||
return addrsFromEnvironment(envOpenSearchURL)
|
||||
}
|
||||
|
||||
// ParseVersion returns an int64 representation of version.
|
||||
func ParseVersion(version string) (int64, int64, int64, error) {
|
||||
reVersion := regexp.MustCompile(`^([0-9]+)\.([0-9]+)\.([0-9]+)`)
|
||||
matches := reVersion.FindStringSubmatch(version)
|
||||
//nolint:gomnd // 4 is the minium regexp match length
|
||||
if len(matches) < 4 {
|
||||
return 0, 0, 0, fmt.Errorf("%w: regexp does not match on version string", ErrParseVersion)
|
||||
}
|
||||
|
||||
major, err := strconv.ParseInt(matches[1], 10, 0)
|
||||
if err != nil {
|
||||
return 0, 0, 0, fmt.Errorf("%w: %w", ErrParseVersion, err)
|
||||
}
|
||||
|
||||
minor, err := strconv.ParseInt(matches[2], 10, 0)
|
||||
if err != nil {
|
||||
return 0, 0, 0, fmt.Errorf("%w: %w", ErrParseVersion, err)
|
||||
}
|
||||
|
||||
patch, err := strconv.ParseInt(matches[3], 10, 0)
|
||||
if err != nil {
|
||||
return 0, 0, 0, fmt.Errorf("%w: %w", ErrParseVersion, err)
|
||||
}
|
||||
|
||||
return major, minor, patch, nil
|
||||
}
|
||||
|
||||
// Perform delegates to Transport to execute a request and return a response.
|
||||
func (c *Client) Perform(req *http.Request) (*http.Response, error) {
|
||||
// Perform the original request.
|
||||
return c.Transport.Perform(req)
|
||||
}
|
||||
|
||||
// Do gets and performs the request. It also tries to parse the response into the dataPointer
|
||||
func (c *Client) Do(ctx context.Context, req Request, dataPointer interface{}) (*Response, error) {
|
||||
httpReq, err := req.GetRequest()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if ctx != nil {
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
}
|
||||
|
||||
//nolint:bodyclose // body got already closed by Perform, this is a nopcloser
|
||||
resp, err := c.Perform(httpReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := &Response{
|
||||
StatusCode: resp.StatusCode,
|
||||
Body: resp.Body,
|
||||
Header: resp.Header,
|
||||
}
|
||||
|
||||
if dataPointer != nil && resp.Body != nil && !response.IsError() {
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return response, fmt.Errorf("%w, status: %d, err: %w", ErrReadBody, resp.StatusCode, err)
|
||||
}
|
||||
|
||||
response.Body = io.NopCloser(bytes.NewReader(data))
|
||||
|
||||
if err := json.Unmarshal(data, dataPointer); err != nil {
|
||||
return response, fmt.Errorf("%w, status: %d, body: %s, err: %w", ErrJSONUnmarshalBody, resp.StatusCode, data, err)
|
||||
}
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// Metrics returns the client metrics.
|
||||
func (c *Client) Metrics() (opensearchtransport.Metrics, error) {
|
||||
if mt, ok := c.Transport.(opensearchtransport.Measurable); ok {
|
||||
return mt.Metrics()
|
||||
}
|
||||
|
||||
return opensearchtransport.Metrics{}, ErrTransportMissingMethodMetrics
|
||||
}
|
||||
|
||||
// DiscoverNodes reloads the client connections by fetching information from the cluster.
|
||||
func (c *Client) DiscoverNodes() error {
|
||||
if dt, ok := c.Transport.(opensearchtransport.Discoverable); ok {
|
||||
return dt.DiscoverNodes()
|
||||
}
|
||||
|
||||
return ErrTransportMissingMethodDiscoverNodes
|
||||
}
|
||||
|
||||
// addrsFromEnvironment returns a list of addresses by splitting
|
||||
// the given environment variable with comma, or an empty list.
|
||||
func addrsFromEnvironment(name string) []string {
|
||||
var addrs []string
|
||||
|
||||
if envURLs, ok := os.LookupEnv(name); ok && envURLs != "" {
|
||||
list := strings.Split(envURLs, ",")
|
||||
addrs = make([]string, len(list))
|
||||
|
||||
for idx, u := range list {
|
||||
addrs[idx] = strings.TrimSpace(u)
|
||||
}
|
||||
}
|
||||
|
||||
return addrs
|
||||
}
|
||||
|
||||
// addrsToURLs creates a list of url.URL structures from url list.
|
||||
func addrsToURLs(addrs []string) ([]*url.URL, error) {
|
||||
urls := make([]*url.URL, 0)
|
||||
|
||||
for _, addr := range addrs {
|
||||
u, err := url.Parse(strings.TrimRight(addr, "/"))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrParseURL, err)
|
||||
}
|
||||
|
||||
urls = append(urls, u)
|
||||
}
|
||||
|
||||
return urls, nil
|
||||
}
|
||||
|
||||
// ToPointer converts any value to a pointer, mainly used for request parameters
|
||||
func ToPointer[V any](value V) *V {
|
||||
return &value
|
||||
}
|
||||
78
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_aliases-params.go
generated
vendored
Normal file
78
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_aliases-params.go
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// AliasesParams represents possible parameters for the AliasesReq
|
||||
type AliasesParams struct {
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Timeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r AliasesParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
58
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_aliases.go
generated
vendored
Normal file
58
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_aliases.go
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// Aliases executes an /_aliases request with the required AliasesReq
|
||||
func (c Client) Aliases(ctx context.Context, req AliasesReq) (*AliasesResp, error) {
|
||||
var (
|
||||
data AliasesResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// AliasesReq represents possible options for the / request
|
||||
type AliasesReq struct {
|
||||
Body io.Reader
|
||||
|
||||
Header http.Header
|
||||
Params AliasesParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r AliasesReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"POST",
|
||||
"/_aliases",
|
||||
r.Body,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// AliasesResp represents the returned struct of the / response
|
||||
type AliasesResp struct {
|
||||
Acknowledged bool `json:"acknowledged"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r AliasesResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
118
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_bulk-params.go
generated
vendored
Normal file
118
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_bulk-params.go
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// BulkParams represents possible parameters for the BulkReq
|
||||
type BulkParams struct {
|
||||
Pipeline string
|
||||
Refresh string
|
||||
RequireAlias *bool
|
||||
Routing string
|
||||
Source any
|
||||
SourceExcludes []string
|
||||
SourceIncludes []string
|
||||
Timeout time.Duration
|
||||
WaitForActiveShards string
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r BulkParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Pipeline != "" {
|
||||
params["pipeline"] = r.Pipeline
|
||||
}
|
||||
|
||||
if r.Refresh != "" {
|
||||
params["refresh"] = r.Refresh
|
||||
}
|
||||
|
||||
if r.RequireAlias != nil {
|
||||
params["require_alias"] = strconv.FormatBool(*r.RequireAlias)
|
||||
}
|
||||
|
||||
if r.Routing != "" {
|
||||
params["routing"] = r.Routing
|
||||
}
|
||||
|
||||
switch source := r.Source.(type) {
|
||||
case bool:
|
||||
params["_source"] = strconv.FormatBool(source)
|
||||
case string:
|
||||
if source != "" {
|
||||
params["_source"] = source
|
||||
}
|
||||
case []string:
|
||||
if len(source) > 0 {
|
||||
params["_source"] = strings.Join(source, ",")
|
||||
}
|
||||
}
|
||||
|
||||
if len(r.SourceExcludes) > 0 {
|
||||
params["_source_excludes"] = strings.Join(r.SourceExcludes, ",")
|
||||
}
|
||||
|
||||
if len(r.SourceIncludes) > 0 {
|
||||
params["_source_includes"] = strings.Join(r.SourceIncludes, ",")
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.WaitForActiveShards != "" {
|
||||
params["wait_for_active_shards"] = r.WaitForActiveShards
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
109
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_bulk.go
generated
vendored
Normal file
109
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_bulk.go
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// Bulk executes a /_bulk request with the needed BulkReq
|
||||
func (c Client) Bulk(ctx context.Context, req BulkReq) (*BulkResp, error) {
|
||||
var (
|
||||
data BulkResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// BulkReq represents possible options for the /_bulk request
|
||||
type BulkReq struct {
|
||||
Index string
|
||||
Body io.Reader
|
||||
Header http.Header
|
||||
Params BulkParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r BulkReq) GetRequest() (*http.Request, error) {
|
||||
var path strings.Builder
|
||||
//nolint:gomnd // 7 is the max number of static chars
|
||||
path.Grow(7 + len(r.Index))
|
||||
|
||||
if len(r.Index) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(r.Index)
|
||||
}
|
||||
|
||||
path.WriteString("/_bulk")
|
||||
|
||||
return opensearch.BuildRequest(
|
||||
"POST",
|
||||
path.String(),
|
||||
r.Body,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// BulkResp represents the returned struct of the /_bulk response
|
||||
type BulkResp struct {
|
||||
Took int `json:"took"`
|
||||
Errors bool `json:"errors"`
|
||||
Items []map[string]BulkRespItem `json:"items"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// BulkRespItem represents an item of the BulkResp
|
||||
type BulkRespItem struct {
|
||||
Index string `json:"_index"`
|
||||
ID string `json:"_id"`
|
||||
Version int `json:"_version"`
|
||||
Type string `json:"_type"` // Deprecated field
|
||||
Result string `json:"result"`
|
||||
Shards struct {
|
||||
Total int `json:"total"`
|
||||
Successful int `json:"successful"`
|
||||
Failed int `json:"failed"`
|
||||
} `json:"_shards"`
|
||||
SeqNo int `json:"_seq_no"`
|
||||
PrimaryTerm int `json:"_primary_term"`
|
||||
Status int `json:"status"`
|
||||
Error *struct {
|
||||
Type string `json:"type"`
|
||||
Reason string `json:"reason"`
|
||||
Cause struct {
|
||||
Type string `json:"type"`
|
||||
Reason string `json:"reason"`
|
||||
ScriptStack *[]string `json:"script_stack,omitempty"`
|
||||
Script *string `json:"script,omitempty"`
|
||||
Lang *string `json:"lang,omitempty"`
|
||||
Position *struct {
|
||||
Offset int `json:"offset"`
|
||||
Start int `json:"start"`
|
||||
End int `json:"end"`
|
||||
} `json:"position,omitempty"`
|
||||
Cause *struct {
|
||||
Type string `json:"type"`
|
||||
Reason *string `json:"reason"`
|
||||
} `json:"caused_by"`
|
||||
} `json:"caused_by,omitempty"`
|
||||
} `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r BulkResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
90
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-aliases-params.go
generated
vendored
Normal file
90
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-aliases-params.go
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CatAliasesParams represents possible parameters for the CatAliasesReq
|
||||
type CatAliasesParams struct {
|
||||
ExpandWildcards string
|
||||
H []string
|
||||
Local *bool
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatAliasesParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.ExpandWildcards != "" {
|
||||
params["expand_wildcards"] = r.ExpandWildcards
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
63
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-aliases.go
generated
vendored
Normal file
63
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-aliases.go
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatAliasesReq represent possible options for the /_cat/aliases request
|
||||
type CatAliasesReq struct {
|
||||
Aliases []string
|
||||
Header http.Header
|
||||
Params CatAliasesParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatAliasesReq) GetRequest() (*http.Request, error) {
|
||||
aliases := strings.Join(r.Aliases, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/aliases/") + len(aliases))
|
||||
path.WriteString("/_cat/aliases")
|
||||
if len(r.Aliases) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(aliases)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatAliasesResp represents the returned struct of the /_cat/aliases response
|
||||
type CatAliasesResp struct {
|
||||
Aliases []CatAliasResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatAliasResp represents one index of the CatAliasesResp
|
||||
type CatAliasResp struct {
|
||||
Alias string `json:"alias"`
|
||||
Index string `json:"index"`
|
||||
Filter string `json:"filter"`
|
||||
RoutingIndex string `json:"routing.index"`
|
||||
RoutingSearch string `json:"routing.search"`
|
||||
IsWriteIndex string `json:"is_write_index"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatAliasesResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
106
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-allocation-params.go
generated
vendored
Normal file
106
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-allocation-params.go
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatAllocationParams represents possible parameters for the CatAllocationReq
|
||||
type CatAllocationParams struct {
|
||||
Bytes string
|
||||
ExpandWildcards string
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatAllocationParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Bytes != "" {
|
||||
params["bytes"] = r.Bytes
|
||||
}
|
||||
|
||||
if r.ExpandWildcards != "" {
|
||||
params["expand_wildcards"] = r.ExpandWildcards
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
67
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-allocation.go
generated
vendored
Normal file
67
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-allocation.go
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatAllocationReq represent possible options for the /_cat/allocation request
|
||||
type CatAllocationReq struct {
|
||||
NodeIDs []string
|
||||
Header http.Header
|
||||
Params CatAllocationParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatAllocationReq) GetRequest() (*http.Request, error) {
|
||||
nodes := strings.Join(r.NodeIDs, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/allocation/") + len(nodes))
|
||||
path.WriteString("/_cat/allocation")
|
||||
if len(r.NodeIDs) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(nodes)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatAllocationsResp represents the returned struct of the /_cat/allocation response
|
||||
type CatAllocationsResp struct {
|
||||
Allocations []CatAllocationResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatAllocationResp represents one index of the CatAllocationResp
|
||||
type CatAllocationResp struct {
|
||||
Shards int `json:"shards,string"`
|
||||
// Pointer of string as the api can returns null for those fileds with Node set to "UNASSIGNED"
|
||||
DiskIndices *string `json:"disk.indices"`
|
||||
DiskUsed *string `json:"disk.used"`
|
||||
DiskAvail *string `json:"disk.avail"`
|
||||
DiskTotal *string `json:"disk.total"`
|
||||
DiskPercent *int `json:"disk.percent,string"`
|
||||
Host *string `json:"host"`
|
||||
IP *string `json:"ip"`
|
||||
Node string `json:"node"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatAllocationsResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-cluster_manager-params.go
generated
vendored
Normal file
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-cluster_manager-params.go
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatClusterManagerParams represents possible parameters for the CatClusterManagerReq
|
||||
type CatClusterManagerParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatClusterManagerParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
51
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-cluster_manager.go
generated
vendored
Normal file
51
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-cluster_manager.go
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatClusterManagerReq represent possible options for the /_cat/cluster_manager request
|
||||
type CatClusterManagerReq struct {
|
||||
Header http.Header
|
||||
Params CatClusterManagerParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatClusterManagerReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/cluster_manager",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatClusterManagersResp represents the returned struct of the /_cat/cluster_manager response
|
||||
type CatClusterManagersResp struct {
|
||||
ClusterManagers []CatClusterManagerResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatClusterManagerResp represents one index of the CatClusterManagerResp
|
||||
type CatClusterManagerResp struct {
|
||||
ID string `json:"id"`
|
||||
Host string `json:"host"`
|
||||
IP string `json:"ip"`
|
||||
Node string `json:"node"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatClusterManagersResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
80
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-count-params.go
generated
vendored
Normal file
80
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-count-params.go
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CatCountParams represents possible parameters for the CatCountReq
|
||||
type CatCountParams struct {
|
||||
H []string
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatCountParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
60
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-count.go
generated
vendored
Normal file
60
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-count.go
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatCountReq represent possible options for the /_cat/count request
|
||||
type CatCountReq struct {
|
||||
Indices []string
|
||||
Header http.Header
|
||||
Params CatCountParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatCountReq) GetRequest() (*http.Request, error) {
|
||||
indices := strings.Join(r.Indices, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/count/") + len(indices))
|
||||
path.WriteString("/_cat/count")
|
||||
if len(r.Indices) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(indices)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatCountsResp represents the returned struct of the /_cat/count response
|
||||
type CatCountsResp struct {
|
||||
Counts []CatCountResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatCountResp represents one index of the CatCountResp
|
||||
type CatCountResp struct {
|
||||
Epoch int `json:"epoch,string"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
Count int `json:"count,string"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatCountsResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
85
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-fielddata-params.go
generated
vendored
Normal file
85
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-fielddata-params.go
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CatFieldDataParams represents possible parameters for the CatFieldDataReq
|
||||
type CatFieldDataParams struct {
|
||||
Bytes string
|
||||
H []string
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatFieldDataParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Bytes != "" {
|
||||
params["bytes"] = r.Bytes
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
63
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-fielddata.go
generated
vendored
Normal file
63
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-fielddata.go
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatFieldDataReq represent possible options for the /_cat/fielddata request
|
||||
type CatFieldDataReq struct {
|
||||
FieldData []string
|
||||
Header http.Header
|
||||
Params CatFieldDataParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatFieldDataReq) GetRequest() (*http.Request, error) {
|
||||
fielddata := strings.Join(r.FieldData, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/fielddata/") + len(fielddata))
|
||||
path.WriteString("/_cat/fielddata")
|
||||
if len(r.FieldData) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(fielddata)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatFieldDataResp represents the returned struct of the /_cat/fielddata response
|
||||
type CatFieldDataResp struct {
|
||||
FieldData []CatFieldDataItemResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatFieldDataItemResp represents one index of the CatFieldDataResp
|
||||
type CatFieldDataItemResp struct {
|
||||
ID string `json:"id"`
|
||||
Host string `json:"host"`
|
||||
IP string `json:"ip"`
|
||||
Node string `json:"node"`
|
||||
Field string `json:"field"`
|
||||
Size string `json:"size"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatFieldDataResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
90
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-health-params.go
generated
vendored
Normal file
90
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-health-params.go
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CatHealthParams represents possible parameters for the CatHealthReq
|
||||
type CatHealthParams struct {
|
||||
H []string
|
||||
Sort []string
|
||||
Time string
|
||||
TS *bool
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatHealthParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.Time != "" {
|
||||
params["time"] = r.Time
|
||||
}
|
||||
|
||||
if r.TS != nil {
|
||||
params["ts"] = strconv.FormatBool(*r.TS)
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
63
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-health.go
generated
vendored
Normal file
63
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-health.go
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatHealthReq represent possible options for the /_cat/health request
|
||||
type CatHealthReq struct {
|
||||
Header http.Header
|
||||
Params CatHealthParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatHealthReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/health",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatHealthResp represents the returned struct of the /_cat/health response
|
||||
type CatHealthResp struct {
|
||||
Health []CatHealthItemResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatHealthItemResp represents one index of the CatHealthResp
|
||||
type CatHealthItemResp struct {
|
||||
Epoch int `json:"epoch,string"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
Cluster string `json:"cluster"`
|
||||
Status string `json:"status"`
|
||||
NodeTotal int `json:"node.total,string"`
|
||||
NodeData int `json:"node.data,string"`
|
||||
DiscoveredMaster bool `json:"discovered_master,string"`
|
||||
DiscoveredClusterManager bool `json:"discovered_cluster_manager,string"`
|
||||
Shards int `json:"shards,string"`
|
||||
Primary int `json:"pri,string"`
|
||||
Relocating int `json:"relo,string"`
|
||||
Initializing int `json:"init,string"`
|
||||
Unassigned int `json:"unassign,string"`
|
||||
PendingTasks int `json:"pending_tasks,string"`
|
||||
MaxTaskWaitTime string `json:"max_task_wait_time"`
|
||||
ActiveShardsPercent string `json:"active_shards_percent"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatHealthResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
126
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-indices-params.go
generated
vendored
Normal file
126
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-indices-params.go
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatIndicesParams represents possible parameters for the CatIndicesReq
|
||||
type CatIndicesParams struct {
|
||||
Bytes string
|
||||
ExpandWildcards string
|
||||
H []string
|
||||
Health string
|
||||
IncludeUnloadedSegments *bool
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Primary *bool
|
||||
Sort []string
|
||||
Time string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatIndicesParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Bytes != "" {
|
||||
params["bytes"] = r.Bytes
|
||||
}
|
||||
|
||||
if r.ExpandWildcards != "" {
|
||||
params["expand_wildcards"] = r.ExpandWildcards
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Health != "" {
|
||||
params["health"] = r.Health
|
||||
}
|
||||
|
||||
if r.IncludeUnloadedSegments != nil {
|
||||
params["include_unloaded_segments"] = strconv.FormatBool(*r.IncludeUnloadedSegments)
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Primary != nil {
|
||||
params["pri"] = strconv.FormatBool(*r.Primary)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.Time != "" {
|
||||
params["time"] = r.Time
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
203
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-indices.go
generated
vendored
Normal file
203
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-indices.go
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatIndicesReq represent possible options for the /_cat/indices request
|
||||
type CatIndicesReq struct {
|
||||
Indices []string
|
||||
Header http.Header
|
||||
Params CatIndicesParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatIndicesReq) GetRequest() (*http.Request, error) {
|
||||
indices := strings.Join(r.Indices, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/indices/") + len(indices))
|
||||
path.WriteString("/_cat/indices")
|
||||
if len(r.Indices) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(indices)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatIndicesResp represents the returned struct of the /_cat/indices response
|
||||
type CatIndicesResp struct {
|
||||
Indices []CatIndexResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatIndexResp represents one index of the CatIndicesResp
|
||||
type CatIndexResp struct {
|
||||
Health string `json:"health"`
|
||||
Status string `json:"status"`
|
||||
Index string `json:"index"`
|
||||
UUID string `json:"uuid"`
|
||||
Primary *int `json:"pri,string"`
|
||||
Replica *int `json:"rep,string"`
|
||||
DocsCount *int `json:"docs.count,string"`
|
||||
DocDeleted *int `json:"docs.deleted,string"`
|
||||
CreationDate int `json:"creation.date,string"`
|
||||
CreationDateString string `json:"creation.date.string"`
|
||||
// Pointer as newly created indices can return null
|
||||
StoreSize *string `json:"store.size"`
|
||||
PrimaryStoreSize *string `json:"pri.store.size"`
|
||||
CompletionSize *string `json:"completion.size"`
|
||||
PrimaryCompletionSize *string `json:"pri.completion.size"`
|
||||
FieldDataMemorySize *string `json:"fielddata.memory_size"`
|
||||
PrimaryFieldDataMemorySize *string `json:"pri.fielddata.memory_size"`
|
||||
FieldDataEvictions *int `json:"fielddata.evictions,string"`
|
||||
PrimaryFieldDataEvictions *int `json:"pri.fielddata.evictions,string"`
|
||||
QueryCacheMemorySize *string `json:"query_cache.memory_size"`
|
||||
PrimaryQueryCacheMemorySize *string `json:"pri.query_cache.memory_size"`
|
||||
QueryCacheEvictions *int `json:"query_cache.evictions,string"`
|
||||
PrimaryQueryCacheEvictions *int `json:"pri.query_cache.evictions,string"`
|
||||
RequestCacheMemorySize *string `json:"request_cache.memory_size"`
|
||||
PrimaryRequestCacheMemorySize *string `json:"pri.request_cache.memory_size"`
|
||||
RequestCacheEvictions *int `json:"request_cache.evictions,string"`
|
||||
PrimaryRequestCacheEvictions *int `json:"pri.request_cache.evictions,string"`
|
||||
RequestCacheHitCount *int `json:"request_cache.hit_count,string"`
|
||||
PrimaryRequestCacheHitCount *int `json:"pri.request_cache.hit_count,string"`
|
||||
RequestCacheMissCount *int `json:"request_cache.miss_count,string"`
|
||||
PrimaryRequestCacheMissCount *int `json:"pri.request_cache.miss_count,string"`
|
||||
FlushTotal *int `json:"flush.total,string"`
|
||||
PrimaryFlushTotal *int `json:"pri.flush.total,string"`
|
||||
FlushTime *string `json:"flush.total_time"`
|
||||
PrimaryFlushTime *string `json:"pri.flush.total_time"`
|
||||
GetCurrent *int `json:"get.current,string"`
|
||||
PrimaryGetCurrent *int `json:"pri.get.current,string"`
|
||||
GetTime *string `json:"get.time"`
|
||||
PrimaryGetTime *string `json:"pri.get.time"`
|
||||
GetTotal *int `json:"get.total,string"`
|
||||
PrimaryGetTotal *int `json:"pri.get.total,string"`
|
||||
GetExistsTime *string `json:"get.exists_time"`
|
||||
PrimaryGetExistsTime *string `json:"pri.get.exists_time"`
|
||||
GetExistsTotal *int `json:"get.exists_total,string"`
|
||||
PrimaryGetExistsTotal *int `json:"pri.get.exists_total,string"`
|
||||
GetMissingTime *string `json:"get.missing_time"`
|
||||
PrimaryGetMissingTime *string `json:"pri.get.missing_time"`
|
||||
GetMissingTotal *int `json:"get.missing_total,string"`
|
||||
PrimaryGetMissingTotal *int `json:"pri.get.missing_total,string"`
|
||||
IndexingDeleteCurrent *int `json:"indexing.delete_current,string"`
|
||||
PrimaryIndexingDeleteCurrent *int `json:"pri.indexing.delete_current,string"`
|
||||
IndexingDeleteTime *string `json:"indexing.delete_time"`
|
||||
PrimaryIndexingDeleteTime *string `json:"pri.indexing.delete_time"`
|
||||
IndexingDeleteTotal *int `json:"indexing.delete_total,string"`
|
||||
PrimaryIndexingDeleteTotal *int `json:"pri.indexing.delete_total,string"`
|
||||
IndexingIndexCurrent *int `json:"indexing.index_current,string"`
|
||||
PrimaryIndexingIndexCurrent *int `json:"pri.indexing.index_current,string"`
|
||||
IndexingIndexTime *string `json:"indexing.index_time"`
|
||||
PrimaryIndexingIndexTime *string `json:"pri.indexing.index_time"`
|
||||
IndexingIndexTotal *int `json:"indexing.index_total,string"`
|
||||
PrimaryIndexingIndexTotal *int `json:"pri.indexing.index_total,string"`
|
||||
IndexingIndexFailed *int `json:"indexing.index_failed,string"`
|
||||
PrimaryIndexingIndexFailed *int `json:"pri.indexing.index_failed,string"`
|
||||
MergesCurrent *int `json:"merges.current,string"`
|
||||
PrimaryMergesCurrent *int `json:"pri.merges.current,string"`
|
||||
MergesCurrentDocs *int `json:"merges.current_docs,string"`
|
||||
PrimaryMergesCurrentDocs *int `json:"pri.merges.current_docs,string"`
|
||||
MergesCurrentSize *string `json:"merges.current_size"`
|
||||
PrimaryMergesCurrentSize *string `json:"pri.merges.current_size"`
|
||||
MergesTotal *int `json:"merges.total,string"`
|
||||
PrimaryMergesTotal *int `json:"pri.merges.total,string"`
|
||||
MergesTotalDocs *int `json:"merges.total_docs,string"`
|
||||
PrimaryMergesTotalDocs *int `json:"pri.merges.total_docs,string"`
|
||||
MergesTotalSize *string `json:"merges.total_size"`
|
||||
PrimaryMergesTotalSize *string `json:"pri.merges.total_size"`
|
||||
MergesTotalTime *string `json:"merges.total_time"`
|
||||
PrimaryMergesTotalTime *string `json:"pri.merges.total_time"`
|
||||
RefreshTotal *int `json:"refresh.total,string"`
|
||||
PrimaryRefreshTotal *int `json:"pri.refresh.total,string"`
|
||||
RefreshTime *string `json:"refresh.time"`
|
||||
PrimaryRefreshTime *string `json:"pri.refresh.time"`
|
||||
RefreshExternalTotal *int `json:"refresh.external_total,string"`
|
||||
PrimaryRefreshExternalTotal *int `json:"pri.refresh.external_total,string"`
|
||||
RefreshExternalTime *string `json:"refresh.external_time"`
|
||||
PrimaryRefreshExternalTime *string `json:"pri.refresh.external_time"`
|
||||
RefreshListeners *int `json:"refresh.listeners,string"`
|
||||
PrimaryRefreshListeners *int `json:"pri.refresh.listeners,string"`
|
||||
SearchFetchCurrent *int `json:"search.fetch_current,string"`
|
||||
PrimarySearchFetchCurrent *int `json:"pri.search.fetch_current,string"`
|
||||
SearchFetchTime *string `json:"search.fetch_time"`
|
||||
PrimarySearchFetchTime *string `json:"pri.search.fetch_time"`
|
||||
SearchFetchTotal *int `json:"search.fetch_total,string"`
|
||||
PrimarySearchFetchTotal *int `json:"pri.search.fetch_total,string"`
|
||||
SearchOpenContexts *int `json:"search.open_contexts,string"`
|
||||
PrimarySearchOpenContexts *int `json:"pri.search.open_contexts,string"`
|
||||
SearchQueryCurrent *int `json:"search.query_current,string"`
|
||||
PrimarySearchQueryCurrent *int `json:"pri.search.query_current,string"`
|
||||
SearchQueryTime *string `json:"search.query_time"`
|
||||
PrimarySearchQueryTime *string `json:"pri.search.query_time"`
|
||||
SearchQueryTotal *int `json:"search.query_total,string"`
|
||||
PrimarySearchQueryTotal *int `json:"pri.search.query_total,string"`
|
||||
SearchConcurrentQueryCurrent *int `json:"search.concurrent_query_current,string"`
|
||||
PrimarySearchConcurrentQueryCurrent *int `json:"pri.search.concurrent_query_current,string"`
|
||||
SearchConcurrentQueryTime *string `json:"search.concurrent_query_time"`
|
||||
PrimarySearchConcurrentQueryTime *string `json:"pri.search.concurrent_query_time"`
|
||||
SearchConcurrentQueryTotal *int `json:"search.concurrent_query_total,string"`
|
||||
PrimarySearchConcurrentQueryTotal *int `json:"pri.search.concurrent_query_total,string"`
|
||||
SearchConcurrentAvgSliceCount *string `json:"search.concurrent_avg_slice_count"`
|
||||
PrimarySearchConcurrentAvgSliceCount *string `json:"pri.search.concurrent_avg_slice_count"`
|
||||
SearchScrollCurrent *int `json:"search.scroll_current,string"`
|
||||
PrimarySearchScrollCurrent *int `json:"pri.search.scroll_current,string"`
|
||||
SearchScrollTime *string `json:"search.scroll_time"`
|
||||
PrimarySearchScrollTime *string `json:"pri.search.scroll_time"`
|
||||
SearchScrollTotal *int `json:"search.scroll_total,string"`
|
||||
PrimarySearchScrollTotal *int `json:"pri.search.scroll_total,string"`
|
||||
SearchPointInTimeCurrent *string `json:"search.point_in_time_current"`
|
||||
PrimarySearchPointInTimeCurrent *string `json:"pri.search.point_in_time_current"`
|
||||
SearchPointInTimeTime *string `json:"search.point_in_time_time"`
|
||||
PrimarySearchPointInTimeTime *string `json:"pri.search.point_in_time_time"`
|
||||
SearchPointInTimeTotal *int `json:"search.point_in_time_total,string"`
|
||||
PrimarySearchPointInTimeTotal *int `json:"pri.search.point_in_time_total,string"`
|
||||
SegmentsCount *int `json:"segments.count,string"`
|
||||
PrimarySegmentsCount *int `json:"pri.segments.count,string"`
|
||||
SegmentsMemory *string `json:"segments.memory"`
|
||||
PrimarySegmentsMemory *string `json:"pri.segments.memory"`
|
||||
SegmentsIndexWriteMemory *string `json:"segments.index_writer_memory"`
|
||||
PrimarySegmentsIndexWriteMemory *string `json:"pri.segments.index_writer_memory"`
|
||||
SegmentsVersionMapMemory *string `json:"segments.version_map_memory"`
|
||||
PrimarySegmentsVersionMapMemory *string `json:"pri.segments.version_map_memory"`
|
||||
SegmentsFixedBitsetMemory *string `json:"segments.fixed_bitset_memory"`
|
||||
PrimarySegmentsFixedBitsetMemory *string `json:"pri.segments.fixed_bitset_memory"`
|
||||
WarmerCurrent *int `json:"warmer.current,string"`
|
||||
PrimaryWarmerCurrent *int `json:"pri.warmer.current,string"`
|
||||
WarmerTotal *int `json:"warmer.total,string"`
|
||||
PrimaryWarmerTotal *int `json:"pri.warmer.total,string"`
|
||||
WarmerTotalTime *string `json:"warmer.total_time"`
|
||||
PrimaryWarmerTotalTime *string `json:"pri.warmer.total_time"`
|
||||
SuggestCurrent *int `json:"suggest.current,string"`
|
||||
PrimarySuggestCurrent *int `json:"pri.suggest.current,string"`
|
||||
SuggestTime *string `json:"suggest.time"`
|
||||
PrimarySuggestTime *string `json:"pri.suggest.time"`
|
||||
SuggestTotal *int `json:"suggest.total,string"`
|
||||
PrimarySuggestTotal *int `json:"pri.suggest.total,string"`
|
||||
MemoryTotal string `json:"memory.total"`
|
||||
PrimaryMemoryTotal string `json:"pri.memory.total"`
|
||||
SearchThrottled bool `json:"search.throttled,string"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatIndicesResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-master-params.go
generated
vendored
Normal file
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-master-params.go
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatMasterParams represents possible parameters for the CatMasterReq
|
||||
type CatMasterParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatMasterParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
51
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-master.go
generated
vendored
Normal file
51
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-master.go
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatMasterReq represent possible options for the /_cat/master request
|
||||
type CatMasterReq struct {
|
||||
Header http.Header
|
||||
Params CatMasterParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatMasterReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/master",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatMasterResp represents the returned struct of the /_cat/master response
|
||||
type CatMasterResp struct {
|
||||
Master []CatMasterItemResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatMasterItemResp represents one index of the CatMasterResp
|
||||
type CatMasterItemResp struct {
|
||||
ID string `json:"id"`
|
||||
Host string `json:"host"`
|
||||
IP string `json:"ip"`
|
||||
Node string `json:"node"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatMasterResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-nodeattrs-params.go
generated
vendored
Normal file
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-nodeattrs-params.go
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatNodeAttrsParams represents possible parameters for the CatNodeAttrsReq
|
||||
type CatNodeAttrsParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatNodeAttrsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
55
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-nodeattrs.go
generated
vendored
Normal file
55
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-nodeattrs.go
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatNodeAttrsReq represent possible options for the /_cat/nodeattrs request
|
||||
type CatNodeAttrsReq struct {
|
||||
Header http.Header
|
||||
Params CatNodeAttrsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatNodeAttrsReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/nodeattrs",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatNodeAttrsResp represents the returned struct of the /_cat/nodeattrs response
|
||||
type CatNodeAttrsResp struct {
|
||||
NodeAttrs []CatNodeAttrsItemResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatNodeAttrsItemResp represents one index of the CatNodeAttrsResp
|
||||
type CatNodeAttrsItemResp struct {
|
||||
Node string `json:"node"`
|
||||
ID string `json:"id"`
|
||||
PID *int `json:"pid,string"`
|
||||
Host string `json:"host"`
|
||||
IP string `json:"ip"`
|
||||
Port int `json:"port,string"`
|
||||
Attr string `json:"attr"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatNodeAttrsResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
116
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-nodes-params.go
generated
vendored
Normal file
116
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-nodes-params.go
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatNodesParams represents possible parameters for the CatNodesReq
|
||||
type CatNodesParams struct {
|
||||
Bytes string
|
||||
FullID *bool
|
||||
H []string
|
||||
IncludeUnloadedSegments *bool
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
Time string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatNodesParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Bytes != "" {
|
||||
params["bytes"] = r.Bytes
|
||||
}
|
||||
|
||||
if r.FullID != nil {
|
||||
params["full_id"] = strconv.FormatBool(*r.FullID)
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.IncludeUnloadedSegments != nil {
|
||||
params["include_unloaded_segments"] = strconv.FormatBool(*r.IncludeUnloadedSegments)
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.Time != "" {
|
||||
params["time"] = r.Time
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
146
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-nodes.go
generated
vendored
Normal file
146
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-nodes.go
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatNodesReq represent possible options for the /_cat/nodes request
|
||||
type CatNodesReq struct {
|
||||
Header http.Header
|
||||
Params CatNodesParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatNodesReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/nodes",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatNodesResp represents the returned struct of the /_cat/nodes response
|
||||
type CatNodesResp struct {
|
||||
Nodes []CatNodesItemResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatNodesItemResp represents one index of the CatNodesResp
|
||||
type CatNodesItemResp struct {
|
||||
ID string `json:"id"`
|
||||
PID *string `json:"pid"`
|
||||
IP string `json:"ip"`
|
||||
Port int `json:"port,string"`
|
||||
HTTPAddress string `json:"http_address"`
|
||||
Version string `json:"version"`
|
||||
Type *string `json:"type"`
|
||||
Build *string `json:"build"`
|
||||
JDK *string `json:"jdk"`
|
||||
DiskTotal *string `json:"disk.total"`
|
||||
DiskUsed *string `json:"disk.used"`
|
||||
DiskAvail *string `json:"disk.avail"`
|
||||
DiskUsedPercent *string `json:"disk.used_percent"`
|
||||
HeapCurrent *string `json:"heap.current"`
|
||||
HeapPercent *int `json:"heap.percent,string"`
|
||||
HeapMax *string `json:"heap.max"`
|
||||
RAMCurrent *string `json:"ram.current"`
|
||||
RAMPercent *int `json:"ram.percent,string"`
|
||||
RAMMax *string `json:"ram.max"`
|
||||
FileDescCurrent *int `json:"file_desc.current,string"`
|
||||
FileDescPercent *int `json:"file_desc.percent,string"`
|
||||
FileDescMax *int `json:"file_desc.max,string"`
|
||||
CPU *int `json:"cpu,string"`
|
||||
Load1M *string `json:"load_1m"`
|
||||
Load5M *string `json:"load_5m"`
|
||||
Load15M *string `json:"load_15m"`
|
||||
Uptime *string `json:"uptime"`
|
||||
Role string `json:"node.role"`
|
||||
Roles string `json:"node.roles"`
|
||||
Master string `json:"master"`
|
||||
ClusterManager string `json:"cluster_manager"`
|
||||
Name string `json:"name"`
|
||||
CompletionSize *string `json:"completion.size"`
|
||||
FieldDataMemorySize *string `json:"fielddata.memory_size"`
|
||||
FileldDataEvictions *int `json:"fielddata.evictions,string"`
|
||||
QueryCacheMemorySize *string `json:"query_cache.memory_size"`
|
||||
QueryCacheEvictions *int `json:"query_cache.evictions,string"`
|
||||
QueryCacheHitCount *int `json:"query_cache.hit_count,string"`
|
||||
QueryCacheMissCount *int `json:"query_cache.miss_count,string"`
|
||||
RequestCacheMemorySize *string `json:"request_cache.memory_size"`
|
||||
RequestCacheEvictions *int `json:"request_cache.evictions,string"`
|
||||
RequestCacheHitCount *int `json:"request_cache.hit_count,string"`
|
||||
RequestCacheMissCount *int `json:"request_cache.miss_count,string"`
|
||||
FlushTotal *int `json:"flush.total,string"`
|
||||
FlushTotalTime *string `json:"flush.total_time"`
|
||||
GetCurrent *int `json:"get.current,string"`
|
||||
GetTime *string `json:"get.time"`
|
||||
GetTotal *int `json:"get.total,string"`
|
||||
GetExistsTime *string `json:"get.exists_time"`
|
||||
GetExistsTotal *int `json:"get.exists_total,string"`
|
||||
GetMissingTime *string `json:"get.missing_time"`
|
||||
GetMissingTotal *int `json:"get.missing_total,string"`
|
||||
IndexingDeleteCurrent *int `json:"indexing.delete_current,string"`
|
||||
IndexingDeleteTime *string `json:"indexing.delete_time"`
|
||||
IndexingDeleteTotal *int `json:"indexing.delete_total,string"`
|
||||
IndexingIndexCurrent *int `json:"indexing.index_current,string"`
|
||||
IndexingIndexTime *string `json:"indexing.index_time"`
|
||||
IndexingIndexTotal *int `json:"indexing.index_total,string"`
|
||||
IndexingIndexFailed *int `json:"indexing.index_failed,string"`
|
||||
MergesCurrent *int `json:"merges.current,string"`
|
||||
MergesCurrentDoc *int `json:"merges.current_docs,string"`
|
||||
MergesCurrentSize *string `json:"merges.current_size"`
|
||||
MergesTotal *int `json:"merges.total,string"`
|
||||
MergesTotalDocs *int `json:"merges.total_docs,string"`
|
||||
MergesTotalSize *string `json:"merges.total_size"`
|
||||
MergesTotalTime *string `json:"merges.total_time"`
|
||||
RefreshTotal *int `json:"refresh.total,string"`
|
||||
RefreshTime *string `json:"refresh.time"`
|
||||
RefreshExternalTotal *int `json:"refresh.external_total,string"`
|
||||
RefreshExternalTime *string `json:"refresh.external_time"`
|
||||
RefreshListeners *int `json:"refresh.listeners,string"`
|
||||
ScriptCompilations *int `json:"script.compilations,string"`
|
||||
ScriptCacheEvictions *int `json:"script.cache_evictions,string"`
|
||||
ScriptCompilationLimitTriggered *int `json:"script.compilation_limit_triggered,string"`
|
||||
SearchFetchCurrent *int `json:"search.fetch_current,string"`
|
||||
SearchFetchTime *string `json:"search.fetch_time"`
|
||||
SearchFetchTotal *int `json:"search.fetch_total,string"`
|
||||
SearchOpenContexts *int `json:"search.open_contexts,string"`
|
||||
SearchQueryCurrent *int `json:"search.query_current,string"`
|
||||
SearchQueryTime *string `json:"search.query_time"`
|
||||
SearchQueryTotal *int `json:"search.query_total,string"`
|
||||
SearchConcurrentQueryCurrent *int `json:"search.concurrent_query_current,string"`
|
||||
SearchConcurrentQueryTime *string `json:"search.concurrent_query_time"`
|
||||
SearchConcurrentQueryTotal *int `json:"search.concurrent_query_total,string"`
|
||||
SearchConcurrentAvgSliceCount *string `json:"search.concurrent_avg_slice_count"`
|
||||
SearchScrollCurrent *int `json:"search.scroll_current,string"`
|
||||
SearchScrollTime *string `json:"search.scroll_time"`
|
||||
SearchScrollTotal *int `json:"search.scroll_total,string"`
|
||||
SearchPointInTimeCurrent *int `json:"search.point_in_time_current,string"`
|
||||
SearchPointInTimeTime *string `json:"search.point_in_time_time"`
|
||||
SearchPointInTimeTotal *int `json:"search.point_in_time_total,string"`
|
||||
SegmentsCount *int `json:"segments.count,string"`
|
||||
SegmentsMemory *string `json:"segments.memory"`
|
||||
SegmentsIndexWriteMemory *string `json:"segments.index_writer_memory"`
|
||||
SegmentsVersionMapMemory *string `json:"segments.version_map_memory"`
|
||||
SegmentsFixedBitsetMemory *string `json:"segments.fixed_bitset_memory"`
|
||||
SuggestCurrent *int `json:"suggest.current,string"`
|
||||
SuggestTime *string `json:"suggest.time"`
|
||||
SuggestTotal *int `json:"suggest.total,string"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatNodesResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
101
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-pending_tasks-params.go
generated
vendored
Normal file
101
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-pending_tasks-params.go
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatPendingTasksParams represents possible parameters for the CatPendingTasksReq
|
||||
type CatPendingTasksParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
Time string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatPendingTasksParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.Time != "" {
|
||||
params["time"] = r.Time
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
51
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-pending_tasks.go
generated
vendored
Normal file
51
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-pending_tasks.go
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatPendingTasksReq represent possible options for the /_cat/pending_tasks request
|
||||
type CatPendingTasksReq struct {
|
||||
Header http.Header
|
||||
Params CatPendingTasksParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatPendingTasksReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/pending_tasks",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatPendingTasksResp represents the returned struct of the /_cat/pending_tasks response
|
||||
type CatPendingTasksResp struct {
|
||||
PendingTasks []CatPendingTaskResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatPendingTaskResp represents one index of the CatPendingTasksResp
|
||||
type CatPendingTaskResp struct {
|
||||
InsertOrder string `json:"insertOrder"`
|
||||
TimeInQueue string `json:"timeInQueue"`
|
||||
Priority string `json:"priority"`
|
||||
Source string `json:"source"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatPendingTasksResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-plugins-params.go
generated
vendored
Normal file
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-plugins-params.go
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatPluginsParams represents possible parameters for the CatPluginsReq
|
||||
type CatPluginsParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatPluginsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
52
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-plugins.go
generated
vendored
Normal file
52
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-plugins.go
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatPluginsReq represent possible options for the /_cat/plugins request
|
||||
type CatPluginsReq struct {
|
||||
Header http.Header
|
||||
Params CatPluginsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatPluginsReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/plugins",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatPluginsResp represents the returned struct of the /_cat/plugins response
|
||||
type CatPluginsResp struct {
|
||||
Plugins []CatPluginResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatPluginResp represents one index of the CatPluginsResp
|
||||
type CatPluginResp struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Component string `json:"component,omitempty"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatPluginsResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
100
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-recovery-params.go
generated
vendored
Normal file
100
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-recovery-params.go
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CatRecoveryParams represents possible parameters for the CatRecoveryReq
|
||||
type CatRecoveryParams struct {
|
||||
ActiveOnly *bool
|
||||
Bytes string
|
||||
Detailed *bool
|
||||
H []string
|
||||
Sort []string
|
||||
Time string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatRecoveryParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.ActiveOnly != nil {
|
||||
params["active_only"] = strconv.FormatBool(*r.ActiveOnly)
|
||||
}
|
||||
|
||||
if r.Bytes != "" {
|
||||
params["bytes"] = r.Bytes
|
||||
}
|
||||
|
||||
if r.Detailed != nil {
|
||||
params["detailed"] = strconv.FormatBool(*r.Detailed)
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.Time != "" {
|
||||
params["time"] = r.Time
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
83
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-recovery.go
generated
vendored
Normal file
83
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-recovery.go
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatRecoveryReq represent possible options for the /_cat/recovery request
|
||||
type CatRecoveryReq struct {
|
||||
Indices []string
|
||||
Header http.Header
|
||||
Params CatRecoveryParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatRecoveryReq) GetRequest() (*http.Request, error) {
|
||||
indices := strings.Join(r.Indices, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/recovery/") + len(indices))
|
||||
path.WriteString("/_cat/recovery")
|
||||
if len(r.Indices) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(indices)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatRecoveryResp represents the returned struct of the /_cat/recovery response
|
||||
type CatRecoveryResp struct {
|
||||
Recovery []CatRecoveryItemResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatRecoveryItemResp represents one index of the CatRecoveryResp
|
||||
type CatRecoveryItemResp struct {
|
||||
Index string `json:"index"`
|
||||
Shard int `json:"shard,string"`
|
||||
StartTime string `json:"start_time"`
|
||||
StartTimeMillis int `json:"start_time_millis,string"`
|
||||
StopTime string `json:"stop_time"`
|
||||
StopTimeMillis int `json:"stop_time_millis,string"`
|
||||
Time string `json:"time"`
|
||||
Type string `json:"type"`
|
||||
Stage string `json:"stage"`
|
||||
SourceHost string `json:"source_host"`
|
||||
SourceNode string `json:"source_node"`
|
||||
TargetHost string `json:"target_host"`
|
||||
TargetNode string `json:"target_node"`
|
||||
Repository string `json:"repository"`
|
||||
Snapshot string `json:"snapshot"`
|
||||
Files int `json:"files,string"`
|
||||
FilesRecovered int `json:"files_recovered,string"`
|
||||
FilesPercent string `json:"files_percent"`
|
||||
FilesTotal int `json:"files_total,string"`
|
||||
Bytes string `json:"bytes"`
|
||||
BytesRecovered string `json:"bytes_recovered"`
|
||||
BytesPercent string `json:"bytes_percent"`
|
||||
BytesTotal string `json:"bytes_total"`
|
||||
TranslogOps int `json:"translog_ops,string"`
|
||||
TranslogOpsRecovered int `json:"translog_ops_recovered,string"`
|
||||
TranslogOpsPercent string `json:"translog_ops_percent"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatRecoveryResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-repositories-params.go
generated
vendored
Normal file
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-repositories-params.go
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatRepositoriesParams represents possible parameters for the CatRepositoriesReq
|
||||
type CatRepositoriesParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatRepositoriesParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
49
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-repositories.go
generated
vendored
Normal file
49
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-repositories.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatRepositoriesReq represent possible options for the /_cat/repositories request
|
||||
type CatRepositoriesReq struct {
|
||||
Header http.Header
|
||||
Params CatRepositoriesParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatRepositoriesReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/repositories",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatRepositoriesResp represents the returned struct of the /_cat/repositories response
|
||||
type CatRepositoriesResp struct {
|
||||
Repositories []CatRepositorieResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatRepositorieResp represents one index of the CatRepositoriesResp
|
||||
type CatRepositorieResp struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatRepositoriesResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
101
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-segments-params.go
generated
vendored
Normal file
101
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-segments-params.go
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatSegmentsParams represents possible parameters for the CatSegmentsReq
|
||||
type CatSegmentsParams struct {
|
||||
Bytes string
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatSegmentsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Bytes != "" {
|
||||
params["bytes"] = r.Bytes
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
72
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-segments.go
generated
vendored
Normal file
72
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-segments.go
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatSegmentsReq represent possible options for the /_cat/segments request
|
||||
type CatSegmentsReq struct {
|
||||
Indices []string
|
||||
Header http.Header
|
||||
Params CatSegmentsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatSegmentsReq) GetRequest() (*http.Request, error) {
|
||||
indices := strings.Join(r.Indices, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/segments/") + len(indices))
|
||||
path.WriteString("/_cat/segments")
|
||||
if len(r.Indices) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(indices)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatSegmentsResp represents the returned struct of the /_cat/segments response
|
||||
type CatSegmentsResp struct {
|
||||
Segments []CatSegmentResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatSegmentResp represents one index of the CatSegmentsResp
|
||||
type CatSegmentResp struct {
|
||||
Index string `json:"index"`
|
||||
Shard int `json:"shard,string"`
|
||||
Prirep string `json:"prirep"`
|
||||
IP string `json:"ip"`
|
||||
ID string `json:"id"`
|
||||
Segment string `json:"segment"`
|
||||
Generation int `json:"generation,string"`
|
||||
DocsCount int `json:"docs.count,string"`
|
||||
DocsDeleted int `json:"docs.deleted,string"`
|
||||
Size string `json:"size"`
|
||||
SizeMemory string `json:"size.memory"`
|
||||
Committed bool `json:"committed,string"`
|
||||
Searchable bool `json:"searchable,string"`
|
||||
Version string `json:"version"`
|
||||
Compound bool `json:"compound,string"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatSegmentsResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
106
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-shards-params.go
generated
vendored
Normal file
106
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-shards-params.go
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatShardsParams represents possible parameters for the CatShardsReq
|
||||
type CatShardsParams struct {
|
||||
Bytes string
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
Time string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatShardsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Bytes != "" {
|
||||
params["bytes"] = r.Bytes
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.Time != "" {
|
||||
params["time"] = r.Time
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
137
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-shards.go
generated
vendored
Normal file
137
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-shards.go
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatShardsReq represent possible options for the /_cat/shards request
|
||||
type CatShardsReq struct {
|
||||
Indices []string
|
||||
Header http.Header
|
||||
Params CatShardsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatShardsReq) GetRequest() (*http.Request, error) {
|
||||
indices := strings.Join(r.Indices, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/shards/") + len(indices))
|
||||
path.WriteString("/_cat/shards")
|
||||
if len(r.Indices) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(indices)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatShardsResp represents the returned struct of the /_cat/shards response
|
||||
type CatShardsResp struct {
|
||||
Shards []CatShardResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatShardResp represents one index of the CatShardsResp
|
||||
type CatShardResp struct {
|
||||
Index string `json:"index"`
|
||||
Shard int `json:"shard,string"`
|
||||
Prirep string `json:"prirep"`
|
||||
State string `json:"state"`
|
||||
Docs *string `json:"docs"`
|
||||
Store *string `json:"store"`
|
||||
IP *string `json:"ip"`
|
||||
ID *string `json:"id"`
|
||||
Node *string `json:"node"`
|
||||
SyncID *string `json:"sync_id"`
|
||||
UnassignedReason *string `json:"unassigned.reason"`
|
||||
UnassignedAt *string `json:"unassigned.at"`
|
||||
UnassignedFor *string `json:"unassigned.for"`
|
||||
UnassignedDetails *string `json:"unassigned.details"`
|
||||
RecoverysourceType *string `json:"recoverysource.type"`
|
||||
CompletionSize *string `json:"completion.size"`
|
||||
FielddataMemorySize *string `json:"fielddata.memory_size"`
|
||||
FielddataEvictions *int `json:"fielddata.evictions,string"`
|
||||
QueryCacheMemorySize *string `json:"query_cache.memory_size"`
|
||||
QueryCacheEvictions *int `json:"query_cache.evictions,string"`
|
||||
FlushTotal *int `json:"flush.total,string"`
|
||||
FlushTotalTime *string `json:"flush.total_time"`
|
||||
GetCurrent *int `json:"get.current,string"`
|
||||
GetTime *string `json:"get.time"`
|
||||
GetTotal *int `json:"get.total,string"`
|
||||
GetExistsTime *string `json:"get.exists_time"`
|
||||
GetExistsTotal *int `json:"get.exists_total,string"`
|
||||
GetMissingTime *string `json:"get.missing_time"`
|
||||
GetMissingTotal *int `json:"get.missing_total,string"`
|
||||
IndexingDeleteCurrent *int `json:"indexing.delete_current,string"`
|
||||
IndexingDeleteTime *string `json:"indexing.delete_time"`
|
||||
IndexingDeleteTotal *string `json:"indexing.delete_total"`
|
||||
IndexingIndexCurrent *int `json:"indexing.index_current,string"`
|
||||
IndexingIndexTime *string `json:"indexing.index_time"`
|
||||
IndexingIndexTotal *int `json:"indexing.index_total,string"`
|
||||
IndexingIndexFailed *int `json:"indexing.index_failed,string"`
|
||||
MergesCurrent *int `json:"merges.current,string"`
|
||||
MergesCurrentDocs *int `json:"merges.current_docs,string"`
|
||||
MergesCurrentSize *string `json:"merges.current_size"`
|
||||
MergesTotal *int `json:"merges.total,string"`
|
||||
MergesTotalDocs *int `json:"merges.total_docs,string"`
|
||||
MergesTotalSize *string `json:"merges.total_size"`
|
||||
MergesTotalTime *string `json:"merges.total_time"`
|
||||
RefreshTotal *int `json:"refresh.total,string"`
|
||||
RefreshTime *string `json:"refresh.time"`
|
||||
RefreshExternalTotal *int `json:"refresh.external_total,string"`
|
||||
RefreshExternalTime *string `json:"refresh.external_time"`
|
||||
RefreshListeners *int `json:"refresh.listeners,string"`
|
||||
SearchFetchCurrent *int `json:"search.fetch_current,string"`
|
||||
SearchFetchTime *string `json:"search.fetch_time"`
|
||||
SearchFetchTotal *int `json:"search.fetch_total,string"`
|
||||
SearchOpenContexts *int `json:"search.open_contexts,string"`
|
||||
SearchQueryCurrent *int `json:"search.query_current,string"`
|
||||
SearchQueryTime *string `json:"search.query_time"`
|
||||
SearchQueryTotal *int `json:"search.query_total,string"`
|
||||
SearchConcurrentQueryCurrent *int `json:"search.concurrent_query_current,string"`
|
||||
SearchConcurrentQueryTime *string `json:"search.concurrent_query_time"`
|
||||
SearchConcurrentQueryTotal *int `json:"search.concurrent_query_total,string"`
|
||||
SearchConcurrentAvgSliceCount *string `json:"search.concurrent_avg_slice_count"`
|
||||
SearchScrollCurrent *int `json:"search.scroll_current,string"`
|
||||
SearchScrollTime *string `json:"search.scroll_time"`
|
||||
SearchScrollTotal *int `json:"search.scroll_total,string"`
|
||||
SearchPointInTimeCurrent *int `json:"search.point_in_time_current,string"`
|
||||
SearchPointInTimeTime *string `json:"search.point_in_time_time"`
|
||||
SearchPointInTimeTotal *int `json:"search.point_in_time_total,string"`
|
||||
SearchIdleReactivateCountTotal *int `json:"search.search_idle_reactivate_count_total,string"`
|
||||
SegmentsCount *int `json:"segments.count,string"`
|
||||
SegmentsMemory *string `json:"segments.memory"`
|
||||
SegmentsIndexWriterMemory *string `json:"segments.index_writer_memory"`
|
||||
SegmentsVersionMapMemory *string `json:"segments.version_map_memory"`
|
||||
SegmentsFixedBitsetMemory *string `json:"segments.fixed_bitset_memory"`
|
||||
SeqNoMax *int `json:"seq_no.max,string"`
|
||||
SeqNoLocalCheckpoint *int `json:"seq_no.local_checkpoint,string"`
|
||||
SeqNoGlobalCheckpoint *int `json:"seq_no.global_checkpoint,string"`
|
||||
WarmerCurrent *int `json:"warmer.current,string"`
|
||||
WarmerTotal *int `json:"warmer.total,string"`
|
||||
WarmerTotalTime *string `json:"warmer.total_time"`
|
||||
PathData *string `json:"path.data"`
|
||||
PathState *string `json:"path.state"`
|
||||
DocsDeleted *int `json:"docs.deleted,string"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatShardsResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
101
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-snapshots-params.go
generated
vendored
Normal file
101
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-snapshots-params.go
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatSnapshotsParams represents possible parameters for the CatSnapshotsReq
|
||||
type CatSnapshotsParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
Time string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatSnapshotsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.Time != "" {
|
||||
params["time"] = r.Time
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
61
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-snapshots.go
generated
vendored
Normal file
61
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-snapshots.go
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatSnapshotsReq represent possible options for the /_cat/snapshots request
|
||||
type CatSnapshotsReq struct {
|
||||
Repository string
|
||||
Header http.Header
|
||||
Params CatSnapshotsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatSnapshotsReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
fmt.Sprintf("%s%s", "/_cat/snapshots/", r.Repository),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatSnapshotsResp represents the returned struct of the /_cat/snapshots response
|
||||
type CatSnapshotsResp struct {
|
||||
Snapshots []CatSnapshotResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatSnapshotResp represents one index of the CatSnapshotsResp
|
||||
type CatSnapshotResp struct {
|
||||
ID string `json:"id"`
|
||||
Status string `json:"status"`
|
||||
StartEpoch int `json:"start_epoch,string"`
|
||||
StartTime string `json:"start_time"`
|
||||
EndEpoch int `json:"end_epoch,string"`
|
||||
EndTime string `json:"end_time"`
|
||||
Duration string `json:"duration"`
|
||||
Indices int `json:"indices,string"`
|
||||
SuccessfulShards int `json:"successful_shards,string"`
|
||||
FailedShards int `json:"failed_shards,string"`
|
||||
TotalShards int `json:"total_shards,string"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatSnapshotsResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
110
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-tasks-params.go
generated
vendored
Normal file
110
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-tasks-params.go
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CatTasksParams represents possible parameters for the CatTasksReq
|
||||
type CatTasksParams struct {
|
||||
Actions []string
|
||||
Detailed *bool
|
||||
H []string
|
||||
Nodes []string
|
||||
ParentTaskID string
|
||||
Local *bool
|
||||
Sort []string
|
||||
Time string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatTasksParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.Actions) > 0 {
|
||||
params["actions"] = strings.Join(r.Actions, ",")
|
||||
}
|
||||
|
||||
if r.Detailed != nil {
|
||||
params["detailed"] = strconv.FormatBool(*r.Detailed)
|
||||
}
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if len(r.Nodes) > 0 {
|
||||
params["nodes"] = strings.Join(r.Nodes, ",")
|
||||
}
|
||||
|
||||
if r.ParentTaskID != "" {
|
||||
params["parent_task_id"] = r.ParentTaskID
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.Time != "" {
|
||||
params["time"] = r.Time
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
62
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-tasks.go
generated
vendored
Normal file
62
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-tasks.go
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatTasksReq represent possible options for the /_cat/tasks request
|
||||
type CatTasksReq struct {
|
||||
Header http.Header
|
||||
Params CatTasksParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatTasksReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cat/tasks",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatTasksResp represents the returned struct of the /_cat/tasks response
|
||||
type CatTasksResp struct {
|
||||
Tasks []CatTaskResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatTaskResp represents one index of the CatTasksResp
|
||||
type CatTaskResp struct {
|
||||
ID string `json:"id"`
|
||||
Action string `json:"action"`
|
||||
TaskID string `json:"task_id"`
|
||||
ParentTaskID string `json:"parent_task_id"`
|
||||
Type string `json:"type"`
|
||||
StartTime int `json:"start_time,string"`
|
||||
Timestamp string `json:"timestamp"`
|
||||
RunningTimeNs int `json:"running_time_ns,string"`
|
||||
RunningTime string `json:"running_time"`
|
||||
NodeID string `json:"node_id"`
|
||||
IP string `json:"ip"`
|
||||
Port int `json:"port,string"`
|
||||
Node string `json:"node"`
|
||||
Version string `json:"version"`
|
||||
XOpaqueID string `json:"x_opaque_id"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatTasksResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-templates-params.go
generated
vendored
Normal file
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-templates-params.go
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatTemplatesParams represents possible parameters for the CatTemplatesReq
|
||||
type CatTemplatesParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatTemplatesParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
62
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-templates.go
generated
vendored
Normal file
62
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-templates.go
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatTemplatesReq represent possible options for the /_cat/templates request
|
||||
type CatTemplatesReq struct {
|
||||
Templates []string
|
||||
Header http.Header
|
||||
Params CatTemplatesParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatTemplatesReq) GetRequest() (*http.Request, error) {
|
||||
templates := strings.Join(r.Templates, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/templates/") + len(templates))
|
||||
path.WriteString("/_cat/templates")
|
||||
if len(r.Templates) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(templates)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatTemplatesResp represents the returned struct of the /_cat/templates response
|
||||
type CatTemplatesResp struct {
|
||||
Templates []CatTemplateResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatTemplateResp represents one index of the CatTemplatesResp
|
||||
type CatTemplateResp struct {
|
||||
Name string `json:"name"`
|
||||
IndexPatterns string `json:"index_patterns"`
|
||||
Order int `json:"order,string"`
|
||||
Version *string `json:"version"`
|
||||
ComposedOf string `json:"composed_of"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatTemplatesResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-thread_pool-params.go
generated
vendored
Normal file
96
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-thread_pool-params.go
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// CatThreadPoolParams represents possible parameters for the CatThreadPoolReq
|
||||
type CatThreadPoolParams struct {
|
||||
H []string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Sort []string
|
||||
V *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r CatThreadPoolParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if len(r.H) > 0 {
|
||||
params["h"] = strings.Join(r.H, ",")
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Sort) > 0 {
|
||||
params["s"] = strings.Join(r.Sort, ",")
|
||||
}
|
||||
|
||||
if r.V != nil {
|
||||
params["v"] = strconv.FormatBool(*r.V)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
params["format"] = "json"
|
||||
|
||||
return params
|
||||
}
|
||||
78
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-thread_pool.go
generated
vendored
Normal file
78
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat-thread_pool.go
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// CatThreadPoolReq represent possible options for the /_cat/thread_pool request
|
||||
type CatThreadPoolReq struct {
|
||||
Pools []string
|
||||
Header http.Header
|
||||
Params CatThreadPoolParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r CatThreadPoolReq) GetRequest() (*http.Request, error) {
|
||||
pools := strings.Join(r.Pools, ",")
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_cat/thread_pool/") + len(pools))
|
||||
path.WriteString("/_cat/thread_pool")
|
||||
if len(r.Pools) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(pools)
|
||||
}
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// CatThreadPoolResp represents the returned struct of the /_cat/thread_pool response
|
||||
type CatThreadPoolResp struct {
|
||||
ThreadPool []CatThreadPoolItemResp
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// CatThreadPoolItemResp represents one index of the CatThreadPoolResp
|
||||
type CatThreadPoolItemResp struct {
|
||||
NodeName string `json:"node_name"`
|
||||
NodeID string `json:"node_id"`
|
||||
EphemeralNodeID string `json:"ephemeral_node_id"`
|
||||
PID int `json:"pid,string"`
|
||||
Host string `json:"host"`
|
||||
IP string `json:"ip"`
|
||||
Port int `json:"port,string"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Active int `json:"active,string"`
|
||||
PoolSize int `json:"pool_size,string"`
|
||||
Queue int `json:"queue,string"`
|
||||
QueueSize int `json:"queue_size,string"`
|
||||
Rejected int `json:"rejected,string"`
|
||||
Largest int `json:"largest,string"`
|
||||
Completed int `json:"completed,string"`
|
||||
Core *int `json:"core,string"`
|
||||
Max *int `json:"max,string"`
|
||||
Size *int `json:"size,string"`
|
||||
KeepAlive *string `json:"keep_alive"`
|
||||
TotalWaitTime string `json:"total_wait_time"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r CatThreadPoolResp) Inspect() Inspect {
|
||||
return Inspect{
|
||||
Response: r.response,
|
||||
}
|
||||
}
|
||||
351
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat.go
generated
vendored
Normal file
351
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cat.go
generated
vendored
Normal file
@@ -0,0 +1,351 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type catClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
// Aliases executes a /_cat/aliases request with the optional CatAliasesReq
|
||||
func (c catClient) Aliases(ctx context.Context, req *CatAliasesReq) (*CatAliasesResp, error) {
|
||||
if req == nil {
|
||||
req = &CatAliasesReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatAliasesResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Aliases); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Allocation executes a /_cat/allocation request with the optional CatAllocationReq
|
||||
func (c catClient) Allocation(ctx context.Context, req *CatAllocationReq) (*CatAllocationsResp, error) {
|
||||
if req == nil {
|
||||
req = &CatAllocationReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatAllocationsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Allocations); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// ClusterManager executes a /_cat/cluster_manager request with the optional CatClusterManagerReq
|
||||
func (c catClient) ClusterManager(ctx context.Context, req *CatClusterManagerReq) (*CatClusterManagersResp, error) {
|
||||
if req == nil {
|
||||
req = &CatClusterManagerReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatClusterManagersResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.ClusterManagers); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Count executes a /_cat/count request with the optional CatCountReq
|
||||
func (c catClient) Count(ctx context.Context, req *CatCountReq) (*CatCountsResp, error) {
|
||||
if req == nil {
|
||||
req = &CatCountReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatCountsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Counts); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// FieldData executes a /_cat/fielddata request with the optional CatFieldDataReq
|
||||
func (c catClient) FieldData(ctx context.Context, req *CatFieldDataReq) (*CatFieldDataResp, error) {
|
||||
if req == nil {
|
||||
req = &CatFieldDataReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatFieldDataResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.FieldData); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Health executes a /_cat/health request with the optional CatHealthReq
|
||||
func (c catClient) Health(ctx context.Context, req *CatHealthReq) (*CatHealthResp, error) {
|
||||
if req == nil {
|
||||
req = &CatHealthReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatHealthResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Health); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Indices executes a /_cat/indices request with the optional CatIndicesReq
|
||||
func (c catClient) Indices(ctx context.Context, req *CatIndicesReq) (*CatIndicesResp, error) {
|
||||
if req == nil {
|
||||
req = &CatIndicesReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatIndicesResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Indices); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Master executes a /_cat/master request with the optional CatMasterReq
|
||||
func (c catClient) Master(ctx context.Context, req *CatMasterReq) (*CatMasterResp, error) {
|
||||
if req == nil {
|
||||
req = &CatMasterReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatMasterResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Master); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// NodeAttrs executes a /_cat/nodeattrs request with the optional CatNodeAttrsReq
|
||||
func (c catClient) NodeAttrs(ctx context.Context, req *CatNodeAttrsReq) (*CatNodeAttrsResp, error) {
|
||||
if req == nil {
|
||||
req = &CatNodeAttrsReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatNodeAttrsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.NodeAttrs); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Nodes executes a /_cat/nodes request with the optional CatNodesReq
|
||||
func (c catClient) Nodes(ctx context.Context, req *CatNodesReq) (*CatNodesResp, error) {
|
||||
if req == nil {
|
||||
req = &CatNodesReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatNodesResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Nodes); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// PendingTasks executes a /_cat/pending_tasks request with the optional CatPendingTasksReq
|
||||
func (c catClient) PendingTasks(ctx context.Context, req *CatPendingTasksReq) (*CatPendingTasksResp, error) {
|
||||
if req == nil {
|
||||
req = &CatPendingTasksReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatPendingTasksResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.PendingTasks); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Plugins executes a /_cat/plugins request with the optional CatPluginsReq
|
||||
func (c catClient) Plugins(ctx context.Context, req *CatPluginsReq) (*CatPluginsResp, error) {
|
||||
if req == nil {
|
||||
req = &CatPluginsReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatPluginsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Plugins); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Recovery executes a /_cat/recovery request with the optional CatRecoveryReq
|
||||
func (c catClient) Recovery(ctx context.Context, req *CatRecoveryReq) (*CatRecoveryResp, error) {
|
||||
if req == nil {
|
||||
req = &CatRecoveryReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatRecoveryResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Recovery); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Repositories executes a /_cat/repositories request with the optional CatRepositoriesReq
|
||||
func (c catClient) Repositories(ctx context.Context, req *CatRepositoriesReq) (*CatRepositoriesResp, error) {
|
||||
if req == nil {
|
||||
req = &CatRepositoriesReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatRepositoriesResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Repositories); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Segments executes a /_cat/segments request with the optional CatSegmentsReq
|
||||
func (c catClient) Segments(ctx context.Context, req *CatSegmentsReq) (*CatSegmentsResp, error) {
|
||||
if req == nil {
|
||||
req = &CatSegmentsReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatSegmentsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Segments); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Shards executes a /_cat/shards request with the optional CatShardsReq
|
||||
func (c catClient) Shards(ctx context.Context, req *CatShardsReq) (*CatShardsResp, error) {
|
||||
if req == nil {
|
||||
req = &CatShardsReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatShardsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Shards); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Snapshots executes a /_cat/snapshots request with the required CatSnapshotsReq
|
||||
func (c catClient) Snapshots(ctx context.Context, req CatSnapshotsReq) (*CatSnapshotsResp, error) {
|
||||
var (
|
||||
data CatSnapshotsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Snapshots); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Tasks executes a /_cat/tasks request with the optional CatTasksReq
|
||||
func (c catClient) Tasks(ctx context.Context, req *CatTasksReq) (*CatTasksResp, error) {
|
||||
if req == nil {
|
||||
req = &CatTasksReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatTasksResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Tasks); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Templates executes a /_cat/templates request with the optional CatTemplatesReq
|
||||
func (c catClient) Templates(ctx context.Context, req *CatTemplatesReq) (*CatTemplatesResp, error) {
|
||||
if req == nil {
|
||||
req = &CatTemplatesReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatTemplatesResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Templates); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// ThreadPool executes a /_cat/thread_pool request with the optional CatThreadPoolReq
|
||||
func (c catClient) ThreadPool(ctx context.Context, req *CatThreadPoolReq) (*CatThreadPoolResp, error) {
|
||||
if req == nil {
|
||||
req = &CatThreadPoolReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data CatThreadPoolResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.ThreadPool); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
73
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-allocation_explain-params.go
generated
vendored
Normal file
73
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-allocation_explain-params.go
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ClusterAllocationExplainParams represents possible parameters for the ClusterAllocationExplainReq
|
||||
type ClusterAllocationExplainParams struct {
|
||||
IncludeDiskInfo *bool
|
||||
IncludeYesDecisions *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterAllocationExplainParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.IncludeDiskInfo != nil {
|
||||
params["include_disk_info"] = strconv.FormatBool(*r.IncludeDiskInfo)
|
||||
}
|
||||
|
||||
if r.IncludeYesDecisions != nil {
|
||||
params["include_yes_decisions"] = strconv.FormatBool(*r.IncludeYesDecisions)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
112
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-allocation_explain.go
generated
vendored
Normal file
112
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-allocation_explain.go
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterAllocationExplainReq represents possible options for the /_nodes request
|
||||
type ClusterAllocationExplainReq struct {
|
||||
Body *ClusterAllocationExplainBody
|
||||
Header http.Header
|
||||
Params ClusterAllocationExplainParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterAllocationExplainReq) GetRequest() (*http.Request, error) {
|
||||
var reader io.Reader
|
||||
|
||||
if r.Body != nil {
|
||||
body, err := json.Marshal(r.Body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
reader = bytes.NewReader(body)
|
||||
}
|
||||
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cluster/allocation/explain",
|
||||
reader,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterAllocationExplainBody represents the optional Body for the ClusterAllocationExplainReq
|
||||
type ClusterAllocationExplainBody struct {
|
||||
Index string `json:"index"`
|
||||
Shard int `json:"shard"`
|
||||
Primary bool `json:"primary"`
|
||||
}
|
||||
|
||||
// ClusterAllocationExplainResp represents the returned struct of the /_nodes response
|
||||
type ClusterAllocationExplainResp struct {
|
||||
Index string `json:"index"`
|
||||
Shard int `json:"shard"`
|
||||
Primary bool `json:"primary"`
|
||||
CurrentState string `json:"current_state"`
|
||||
CurrentNode ClusterAllocationCurrentNode `json:"current_node"`
|
||||
UnassignedInfo struct {
|
||||
Reason string `json:"reason"`
|
||||
At string `json:"at"`
|
||||
LastAllocationStatus string `json:"last_allocation_status"`
|
||||
} `json:"unassigned_info"`
|
||||
CanAllocate string `json:"can_allocate"`
|
||||
CanRemainOnCurrentNode string `json:"can_remain_on_current_node"`
|
||||
CanRebalanceCluster string `json:"can_rebalance_cluster"`
|
||||
CanRebalanceToOtherNode string `json:"can_rebalance_to_other_node"`
|
||||
RebalanceExplanation string `json:"rebalance_explanation"`
|
||||
AllocateExplanation string `json:"allocate_explanation"`
|
||||
NodeAllocationDecisions []ClusterAllocationNodeDecisions `json:"node_allocation_decisions"`
|
||||
CanRebalanceClusterDecisions []ClusterAllocationExplainDeciders `json:"can_rebalance_cluster_decisions"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterAllocationExplainResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterAllocationCurrentNode is a sub type of ClusterAllocationExplainResp containing information of the node the shard is on
|
||||
type ClusterAllocationCurrentNode struct {
|
||||
NodeID string `json:"id"`
|
||||
NodeName string `json:"name"`
|
||||
TransportAddress string `json:"transport_address"`
|
||||
NodeAttributes struct {
|
||||
ShardIndexingPressureEnabled string `json:"shard_indexing_pressure_enabled"`
|
||||
} `json:"attributes"`
|
||||
WeightRanking int `json:"weight_ranking"`
|
||||
}
|
||||
|
||||
// ClusterAllocationNodeDecisions is a sub type of ClusterAllocationExplainResp containing information of a node allocation decission
|
||||
type ClusterAllocationNodeDecisions struct {
|
||||
NodeID string `json:"node_id"`
|
||||
NodeName string `json:"node_name"`
|
||||
TransportAddress string `json:"transport_address"`
|
||||
NodeAttributes struct {
|
||||
ShardIndexingPressureEnabled string `json:"shard_indexing_pressure_enabled"`
|
||||
} `json:"node_attributes"`
|
||||
NodeDecision string `json:"node_decision"`
|
||||
WeightRanking int `json:"weight_ranking"`
|
||||
Deciders []ClusterAllocationExplainDeciders `json:"deciders"`
|
||||
}
|
||||
|
||||
// ClusterAllocationExplainDeciders is a sub type of ClusterAllocationExplainResp and
|
||||
// ClusterAllocationNodeDecisions containing inforamtion about Deciders decissions
|
||||
type ClusterAllocationExplainDeciders struct {
|
||||
Decider string `json:"decider"`
|
||||
Decision string `json:"decision"`
|
||||
Explanation string `json:"explanation"`
|
||||
}
|
||||
119
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-decommission-params.go
generated
vendored
Normal file
119
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-decommission-params.go
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import "strings"
|
||||
|
||||
// ClusterPutDecommissionParams represents possible parameters for the ClusterPutDecommissionReq
|
||||
type ClusterPutDecommissionParams struct {
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterPutDecommissionParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
// ClusterGetDecommissionParams represents possible parameters for the ClusterGetDecommissionReq
|
||||
type ClusterGetDecommissionParams struct {
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterGetDecommissionParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
// ClusterDeleteDecommissionParams represents possible parameters for the ClusterDeleteDecommissionReq
|
||||
type ClusterDeleteDecommissionParams struct {
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterDeleteDecommissionParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
116
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-decommission.go
generated
vendored
Normal file
116
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-decommission.go
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterPutDecommissionReq represents possible options for the /_cluster/decommission/awareness request
|
||||
type ClusterPutDecommissionReq struct {
|
||||
AwarenessAttrName string
|
||||
AwarenessAttrValue string
|
||||
|
||||
Header http.Header
|
||||
Params ClusterPutDecommissionParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterPutDecommissionReq) GetRequest() (*http.Request, error) {
|
||||
var path strings.Builder
|
||||
path.Grow(34 + len(r.AwarenessAttrName) + len(r.AwarenessAttrValue))
|
||||
path.WriteString("/_cluster/decommission/awareness/")
|
||||
path.WriteString(r.AwarenessAttrName)
|
||||
path.WriteString("/")
|
||||
path.WriteString(r.AwarenessAttrValue)
|
||||
|
||||
return opensearch.BuildRequest(
|
||||
"PUT",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterPutDecommissionResp represents the returned struct of the /_cluster/decommission/awareness response
|
||||
type ClusterPutDecommissionResp struct {
|
||||
Acknowledged bool `json:"acknowledged"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterPutDecommissionResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterDeleteDecommissionReq represents possible options for the /_cluster/decommission/awareness request
|
||||
type ClusterDeleteDecommissionReq struct {
|
||||
Header http.Header
|
||||
Params ClusterDeleteDecommissionParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterDeleteDecommissionReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"DELETE",
|
||||
"/_cluster/decommission/awareness",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterDeleteDecommissionResp represents the returned struct of the /_cluster/decommission/awareness response
|
||||
type ClusterDeleteDecommissionResp struct {
|
||||
Acknowledged bool `json:"acknowledged"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterDeleteDecommissionResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterGetDecommissionReq represents possible options for the /_cluster/decommission/awareness request
|
||||
type ClusterGetDecommissionReq struct {
|
||||
AwarenessAttrName string
|
||||
|
||||
Header http.Header
|
||||
Params ClusterGetDecommissionParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterGetDecommissionReq) GetRequest() (*http.Request, error) {
|
||||
var path strings.Builder
|
||||
path.Grow(41 + len(r.AwarenessAttrName))
|
||||
path.WriteString("/_cluster/decommission/awareness/")
|
||||
path.WriteString(r.AwarenessAttrName)
|
||||
path.WriteString("/_status")
|
||||
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterGetDecommissionResp represents the returned struct of the /_cluster/decommission/awareness response
|
||||
type ClusterGetDecommissionResp struct {
|
||||
Values map[string]string
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterGetDecommissionResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
124
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-health-params.go
generated
vendored
Normal file
124
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-health-params.go
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClusterHealthParams represents possible parameters for the ClusterHealthReq
|
||||
type ClusterHealthParams struct {
|
||||
ExpandWildcards string
|
||||
Level string
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Timeout time.Duration
|
||||
WaitForActiveShards string
|
||||
WaitForEvents string
|
||||
WaitForNoInitializingShards *bool
|
||||
WaitForNoRelocatingShards *bool
|
||||
WaitForNodes string
|
||||
WaitForStatus string
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterHealthParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.ExpandWildcards != "" {
|
||||
params["expand_wildcards"] = r.ExpandWildcards
|
||||
}
|
||||
|
||||
if r.Level != "" {
|
||||
params["level"] = r.Level
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.WaitForActiveShards != "" {
|
||||
params["wait_for_active_shards"] = r.WaitForActiveShards
|
||||
}
|
||||
|
||||
if r.WaitForEvents != "" {
|
||||
params["wait_for_events"] = r.WaitForEvents
|
||||
}
|
||||
|
||||
if r.WaitForNoInitializingShards != nil {
|
||||
params["wait_for_no_initializing_shards"] = strconv.FormatBool(*r.WaitForNoInitializingShards)
|
||||
}
|
||||
|
||||
if r.WaitForNoRelocatingShards != nil {
|
||||
params["wait_for_no_relocating_shards"] = strconv.FormatBool(*r.WaitForNoRelocatingShards)
|
||||
}
|
||||
|
||||
if r.WaitForNodes != "" {
|
||||
params["wait_for_nodes"] = r.WaitForNodes
|
||||
}
|
||||
|
||||
if r.WaitForStatus != "" {
|
||||
params["wait_for_status"] = r.WaitForStatus
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
69
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-health.go
generated
vendored
Normal file
69
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-health.go
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterHealthReq represents possible options for the /_cluster/health request
|
||||
type ClusterHealthReq struct {
|
||||
Indices []string
|
||||
Header http.Header
|
||||
Params ClusterHealthParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterHealthReq) GetRequest() (*http.Request, error) {
|
||||
indices := strings.Join(r.Indices, ",")
|
||||
|
||||
var path strings.Builder
|
||||
path.Grow(17 + len(indices))
|
||||
path.WriteString("/_cluster/health")
|
||||
if len(indices) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(indices)
|
||||
}
|
||||
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterHealthResp represents the returned struct of the ClusterHealthReq response
|
||||
type ClusterHealthResp struct {
|
||||
ClusterName string `json:"cluster_name"`
|
||||
Status string `json:"status"`
|
||||
TimedOut bool `json:"timed_out"`
|
||||
NumberOfNodes int `json:"number_of_nodes"`
|
||||
NumberOfDataNodes int `json:"number_of_data_nodes"`
|
||||
DiscoveredMaster bool `json:"discovered_master"`
|
||||
DiscoveredClusterManager bool `json:"discovered_cluster_manager"`
|
||||
ActivePrimaryShards int `json:"active_primary_shards"`
|
||||
ActiveShards int `json:"active_shards"`
|
||||
RelocatingShards int `json:"relocating_shards"`
|
||||
InitializingShards int `json:"initializing_shards"`
|
||||
UnassignedShards int `json:"unassigned_shards"`
|
||||
DelayedUnassignedShards int `json:"delayed_unassigned_shards"`
|
||||
NumberOfPendingTasks int `json:"number_of_pending_tasks"`
|
||||
NumberOfInFlightFetch int `json:"number_of_in_flight_fetch"`
|
||||
TaskMaxWaitingInQueueMillis int `json:"task_max_waiting_in_queue_millis"`
|
||||
ActiveShardsPercentAsNumber float64 `json:"active_shards_percent_as_number"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterHealthResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
78
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-pending_tasks-params.go
generated
vendored
Normal file
78
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-pending_tasks-params.go
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClusterPendingTasksParams represents possible parameters for the ClusterPendingTasksReq
|
||||
type ClusterPendingTasksParams struct {
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterPendingTasksParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
51
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-pending_tasks.go
generated
vendored
Normal file
51
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-pending_tasks.go
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterPendingTasksReq represents possible options for the /_cluster/pending_tasks request
|
||||
type ClusterPendingTasksReq struct {
|
||||
Header http.Header
|
||||
Params ClusterPendingTasksParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterPendingTasksReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cluster/pending_tasks",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterPendingTasksResp represents the returned struct of the ClusterPendingTasksReq response
|
||||
type ClusterPendingTasksResp struct {
|
||||
Tasks []ClusterPendingTasksItem `json:"tasks"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterPendingTasksResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterPendingTasksItem is a sub type if ClusterPendingTasksResp containing information about a task
|
||||
type ClusterPendingTasksItem struct {
|
||||
InsertOrder int `json:"insert_order"`
|
||||
Priority string `json:"priority"`
|
||||
Source string `json:"source"`
|
||||
TimeInQueueMillis int `json:"time_in_queue_millis"`
|
||||
TimeInQueue string `json:"time_in_queue"`
|
||||
Executing bool `json:"executing"`
|
||||
}
|
||||
59
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-remote_info-params.go
generated
vendored
Normal file
59
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-remote_info-params.go
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import "strings"
|
||||
|
||||
// ClusterRemoteInfoParams represents possible parameters for the ClusterRemoteInfoReq
|
||||
type ClusterRemoteInfoParams struct {
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterRemoteInfoParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
52
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-remote_info.go
generated
vendored
Normal file
52
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-remote_info.go
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterRemoteInfoReq represents possible options for the /_remote/info request
|
||||
type ClusterRemoteInfoReq struct {
|
||||
Header http.Header
|
||||
Params ClusterRemoteInfoParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterRemoteInfoReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_remote/info",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterRemoteInfoResp represents the returned struct of the ClusterRemoteInfoReq response
|
||||
type ClusterRemoteInfoResp struct {
|
||||
Clusters map[string]ClusterRemoteInfoDetails
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterRemoteInfoResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterRemoteInfoDetails is a sub type of ClusterRemoteInfoResp contains information about a remote connection
|
||||
type ClusterRemoteInfoDetails struct {
|
||||
Connected bool `json:"connected"`
|
||||
Mode string `json:"mode"`
|
||||
Seeds []string `json:"seeds"`
|
||||
NumNodesConnected int `json:"num_nodes_connected"`
|
||||
MaxConnectionsPerCluster int `json:"max_connections_per_cluster"`
|
||||
InitialConnectTimeout string `json:"initial_connect_timeout"`
|
||||
SkipUnavailable bool `json:"skip_unavailable"`
|
||||
}
|
||||
99
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-reroute-params.go
generated
vendored
Normal file
99
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-reroute-params.go
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClusterRerouteParams represents possible parameters for the ClusterRerouteReq
|
||||
type ClusterRerouteParams struct {
|
||||
DryRun *bool
|
||||
Explain *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Metric []string
|
||||
RetryFailed *bool
|
||||
Timeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterRerouteParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.DryRun != nil {
|
||||
params["dry_run"] = strconv.FormatBool(*r.DryRun)
|
||||
}
|
||||
|
||||
if r.Explain != nil {
|
||||
params["explain"] = strconv.FormatBool(*r.Explain)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if len(r.Metric) > 0 {
|
||||
params["metric"] = strings.Join(r.Metric, ",")
|
||||
}
|
||||
|
||||
if r.RetryFailed != nil {
|
||||
params["retry_failed"] = strconv.FormatBool(*r.RetryFailed)
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
75
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-reroute.go
generated
vendored
Normal file
75
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-reroute.go
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterRerouteReq represents possible options for the /_cluster/reroute request
|
||||
type ClusterRerouteReq struct {
|
||||
Body io.Reader
|
||||
|
||||
Header http.Header
|
||||
Params ClusterRerouteParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterRerouteReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"POST",
|
||||
"/_cluster/reroute",
|
||||
r.Body,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterRerouteResp represents the returned struct of the ClusterRerouteReq response
|
||||
type ClusterRerouteResp struct {
|
||||
Acknowledged bool `json:"acknowledged"`
|
||||
State ClusterRerouteState `json:"state"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterRerouteResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterRerouteState is a sub type of ClusterRerouteResp containing information about the cluster and cluster routing
|
||||
type ClusterRerouteState struct {
|
||||
ClusterUUID string `json:"cluster_uuid"`
|
||||
Version int `json:"version"`
|
||||
StateUUID string `json:"state_uuid"`
|
||||
MasterNode string `json:"master_node"`
|
||||
ClusterManagerNode string `json:"cluster_manager_node"`
|
||||
Blocks json.RawMessage `json:"blocks"`
|
||||
Nodes map[string]ClusterStateNodes `json:"nodes"`
|
||||
RoutingTable struct {
|
||||
Indices map[string]struct {
|
||||
Shards map[string][]ClusterStateRoutingIndex `json:"shards"`
|
||||
} `json:"indices"`
|
||||
} `json:"routing_table"`
|
||||
RoutingNodes ClusterStateRoutingNodes `json:"routing_nodes"`
|
||||
RepositoryCleanup struct {
|
||||
RepositoryCleanup []json.RawMessage `json:"repository_cleanup"`
|
||||
} `json:"repository_cleanup"`
|
||||
SnapshotDeletions struct {
|
||||
SnapshotDeletions []json.RawMessage `json:"snapshot_deletions"`
|
||||
} `json:"snapshot_deletions"`
|
||||
Snapshots struct {
|
||||
Snapshots []json.RawMessage `json:"snapshots"`
|
||||
} `json:"snapshots"`
|
||||
Restore struct {
|
||||
Snapshots []json.RawMessage `json:"snapshots"`
|
||||
} `json:"restore"`
|
||||
}
|
||||
140
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-settings-params.go
generated
vendored
Normal file
140
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-settings-params.go
generated
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClusterGetSettingsParams represents possible parameters for the ClusterGetSettingsReq
|
||||
type ClusterGetSettingsParams struct {
|
||||
FlatSettings *bool
|
||||
IncludeDefaults *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Timeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterGetSettingsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.FlatSettings != nil {
|
||||
params["flat_settings"] = strconv.FormatBool(*r.FlatSettings)
|
||||
}
|
||||
|
||||
if r.IncludeDefaults != nil {
|
||||
params["include_defaults"] = strconv.FormatBool(*r.IncludeDefaults)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
// ClusterPutSettingsParams represents possible parameters for the ClusterGetSettingsReq
|
||||
type ClusterPutSettingsParams struct {
|
||||
FlatSettings *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Timeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterPutSettingsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.FlatSettings != nil {
|
||||
params["flat_settings"] = strconv.FormatBool(*r.FlatSettings)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
76
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-settings.go
generated
vendored
Normal file
76
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-settings.go
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterGetSettingsReq represents possible options for the /_cluster/settings request
|
||||
type ClusterGetSettingsReq struct {
|
||||
Header http.Header
|
||||
Params ClusterGetSettingsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterGetSettingsReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
"/_cluster/settings",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterGetSettingsResp represents the returned struct of the ClusterGetSettingsReq response
|
||||
type ClusterGetSettingsResp struct {
|
||||
Persistent json.RawMessage `json:"persistent"`
|
||||
Transient json.RawMessage `json:"transient"`
|
||||
Defaults json.RawMessage `json:"defaults"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterGetSettingsResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterPutSettingsReq represents possible options for the /_cluster/settings request
|
||||
type ClusterPutSettingsReq struct {
|
||||
Body io.Reader
|
||||
Header http.Header
|
||||
Params ClusterPutSettingsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterPutSettingsReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"PUT",
|
||||
"/_cluster/settings",
|
||||
r.Body,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterPutSettingsResp represents the returned struct of the /_cluster/settings response
|
||||
type ClusterPutSettingsResp struct {
|
||||
Acknowledged bool `json:"acknowledged"`
|
||||
Persistent json.RawMessage `json:"persistent"`
|
||||
Transient json.RawMessage `json:"transient"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterPutSettingsResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
109
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-state-params.go
generated
vendored
Normal file
109
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-state-params.go
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClusterStateParams represents possible parameters for the ClusterStateReq
|
||||
type ClusterStateParams struct {
|
||||
AllowNoIndices *bool
|
||||
ExpandWildcards string
|
||||
FlatSettings *bool
|
||||
IgnoreUnavailable *bool
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
WaitForMetadataVersion *int
|
||||
WaitForTimeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterStateParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.AllowNoIndices != nil {
|
||||
params["allow_no_indices"] = strconv.FormatBool(*r.AllowNoIndices)
|
||||
}
|
||||
|
||||
if r.ExpandWildcards != "" {
|
||||
params["expand_wildcards"] = r.ExpandWildcards
|
||||
}
|
||||
|
||||
if r.FlatSettings != nil {
|
||||
params["flat_settings"] = strconv.FormatBool(*r.FlatSettings)
|
||||
}
|
||||
|
||||
if r.IgnoreUnavailable != nil {
|
||||
params["ignore_unavailable"] = strconv.FormatBool(*r.IgnoreUnavailable)
|
||||
}
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.WaitForMetadataVersion != nil {
|
||||
params["wait_for_metadata_version"] = strconv.FormatInt(int64(*r.WaitForMetadataVersion), 10)
|
||||
}
|
||||
|
||||
if r.WaitForTimeout != 0 {
|
||||
params["wait_for_timeout"] = formatDuration(r.WaitForTimeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
221
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-state.go
generated
vendored
Normal file
221
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-state.go
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterStateReq represents possible options for the /_cluster/state request
|
||||
type ClusterStateReq struct {
|
||||
Metrics []string
|
||||
Indices []string
|
||||
|
||||
Header http.Header
|
||||
Params ClusterStateParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterStateReq) GetRequest() (*http.Request, error) {
|
||||
indices := strings.Join(r.Indices, ",")
|
||||
metrics := strings.Join(r.Metrics, ",")
|
||||
|
||||
var path strings.Builder
|
||||
path.Grow(17 + len(indices) + len(metrics))
|
||||
path.WriteString("/_cluster/state")
|
||||
if len(metrics) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(metrics)
|
||||
if len(indices) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(indices)
|
||||
}
|
||||
}
|
||||
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterStateResp represents the returned struct of the ClusterStateReq response
|
||||
type ClusterStateResp struct {
|
||||
ClusterName string `json:"cluster_name"`
|
||||
ClusterUUID string `json:"cluster_uuid"`
|
||||
Version int `json:"version"`
|
||||
StateUUID string `json:"state_uuid"`
|
||||
MasterNode string `json:"master_node"`
|
||||
ClusterManagerNode string `json:"cluster_manager_node"`
|
||||
Blocks struct {
|
||||
Indices map[string]map[string]ClusterStateBlocksIndex `json:"indices"`
|
||||
} `json:"blocks"`
|
||||
Nodes map[string]ClusterStateNodes `json:"nodes"`
|
||||
Metadata ClusterStateMetaData `json:"metadata"`
|
||||
response *opensearch.Response
|
||||
RoutingTable struct {
|
||||
Indices map[string]struct {
|
||||
Shards map[string][]ClusterStateRoutingIndex `json:"shards"`
|
||||
} `json:"indices"`
|
||||
} `json:"routing_table"`
|
||||
RoutingNodes ClusterStateRoutingNodes `json:"routing_nodes"`
|
||||
Snapshots struct {
|
||||
Snapshots []json.RawMessage `json:"snapshots"`
|
||||
} `json:"snapshots"`
|
||||
SnapshotDeletions struct {
|
||||
SnapshotDeletions []json.RawMessage `json:"snapshot_deletions"`
|
||||
} `json:"snapshot_deletions"`
|
||||
RepositoryCleanup struct {
|
||||
RepositoryCleanup []json.RawMessage `json:"repository_cleanup"`
|
||||
} `json:"repository_cleanup"`
|
||||
Restore struct {
|
||||
Snapshots []json.RawMessage `json:"snapshots"`
|
||||
} `json:"restore"`
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterStateResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterStateBlocksIndex is a sub type of ClusterStateResp
|
||||
type ClusterStateBlocksIndex struct {
|
||||
Description string `json:"description"`
|
||||
Retryable bool `json:"retryable"`
|
||||
Levels []string `json:"levels"`
|
||||
}
|
||||
|
||||
// ClusterStateNodes is a sub type of ClusterStateResp
|
||||
type ClusterStateNodes struct {
|
||||
Name string `json:"name"`
|
||||
EphemeralID string `json:"ephemeral_id"`
|
||||
TransportAddress string `json:"transport_address"`
|
||||
Attributes map[string]string `json:"attributes"`
|
||||
}
|
||||
|
||||
// ClusterStateMetaData is a sub type if ClusterStateResp containing metadata of the cluster
|
||||
type ClusterStateMetaData struct {
|
||||
ClusterUUID string `json:"cluster_uuid"`
|
||||
ClusterUUIDCommitted bool `json:"cluster_uuid_committed"`
|
||||
ClusterCoordination struct {
|
||||
Term int `json:"term"`
|
||||
LastCommittedConfig []string `json:"last_committed_config"`
|
||||
LastAcceptedConfig []string `json:"last_accepted_config"`
|
||||
VotingConfigExclusions []struct {
|
||||
NodeID string `json:"node_id"`
|
||||
NodeName string `json:"node_name"`
|
||||
} `json:"voting_config_exclusions"`
|
||||
} `json:"cluster_coordination"`
|
||||
Templates map[string]json.RawMessage `json:"templates"`
|
||||
Indices map[string]ClusterStateMetaDataIndex `json:"indices"`
|
||||
IndexGraveyard struct {
|
||||
Tombstones []struct {
|
||||
Index struct {
|
||||
IndexName string `json:"index_name"`
|
||||
IndexUUID string `json:"index_uuid"`
|
||||
} `json:"index"`
|
||||
DeleteDateInMillis int `json:"delete_date_in_millis"`
|
||||
} `json:"tombstones"`
|
||||
} `json:"index-graveyard"`
|
||||
Repositories map[string]struct {
|
||||
Type string `json:"type"`
|
||||
Settings map[string]string `json:"settings"`
|
||||
Generation int `json:"generation"`
|
||||
PendingGeneration int `json:"pending_generation"`
|
||||
} `json:"repositories"`
|
||||
ComponentTemplate struct {
|
||||
ComponentTemplate map[string]json.RawMessage `json:"component_template"`
|
||||
} `json:"component_template"`
|
||||
IndexTemplate struct {
|
||||
IndexTemplate map[string]json.RawMessage `json:"index_template"`
|
||||
} `json:"index_template"`
|
||||
StoredScripts map[string]struct {
|
||||
Lang string `json:"lang"`
|
||||
Source string `json:"source"`
|
||||
} `json:"stored_scripts"`
|
||||
Ingest struct {
|
||||
Pipeline []struct {
|
||||
ID string `json:"id"`
|
||||
Config struct {
|
||||
Description string `json:"description"`
|
||||
Processors json.RawMessage `json:"processors"`
|
||||
} `json:"config"`
|
||||
} `json:"pipeline"`
|
||||
} `json:"ingest"`
|
||||
DataStream struct {
|
||||
DataStream map[string]ClusterStateMetaDataStream `json:"data_stream"`
|
||||
} `json:"data_stream"`
|
||||
}
|
||||
|
||||
// ClusterStateMetaDataIndex is a sub type of ClusterStateMetaData containing information about an index
|
||||
type ClusterStateMetaDataIndex struct {
|
||||
Version int `json:"version"`
|
||||
MappingVersion int `json:"mapping_version"`
|
||||
SettingsVersion int `json:"settings_version"`
|
||||
AliasesVersion int `json:"aliases_version"`
|
||||
RoutingNumShards int `json:"routing_num_shards"`
|
||||
State string `json:"state"`
|
||||
Settings json.RawMessage `json:"settings"`
|
||||
Mappings json.RawMessage `json:"mappings"`
|
||||
Aliases []string `json:"aliases"`
|
||||
PrimaryTerms map[string]int `json:"primary_terms"`
|
||||
InSyncAllocations map[string][]string `json:"in_sync_allocations"`
|
||||
RolloverInfo map[string]struct {
|
||||
MetConditions map[string]string `json:"met_conditions"`
|
||||
Time int `json:"time"`
|
||||
} `json:"rollover_info"`
|
||||
System bool `json:"system"`
|
||||
}
|
||||
|
||||
// ClusterStateMetaDataStream is a sub type of ClusterStateMetaData containing information about a data stream
|
||||
type ClusterStateMetaDataStream struct {
|
||||
Name string `json:"name"`
|
||||
TimestampField struct {
|
||||
Name string `json:"name"`
|
||||
} `json:"timestamp_field"`
|
||||
Indices []struct {
|
||||
IndexName string `json:"index_name"`
|
||||
IndexUUID string `json:"index_uuid"`
|
||||
} `json:"indices"`
|
||||
Generation int `json:"generation"`
|
||||
}
|
||||
|
||||
// ClusterStateRoutingIndex is a sub type of ClusterStateResp and ClusterStateRoutingNodes containing information about shard routing
|
||||
type ClusterStateRoutingIndex struct {
|
||||
State string `json:"state"`
|
||||
Primary bool `json:"primary"`
|
||||
Node *string `json:"node"`
|
||||
RelocatingNode *string `json:"relocating_node"`
|
||||
Shard int `json:"shard"`
|
||||
Index string `json:"index"`
|
||||
ExpectedShardSizeInBytes int `json:"expected_shard_size_in_bytes"`
|
||||
AllocationID *struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"allocation_id,omitempty"`
|
||||
RecoverySource *struct {
|
||||
Type string `json:"type"`
|
||||
} `json:"recovery_source,omitempty"`
|
||||
UnassignedInfo *struct {
|
||||
Reason string `json:"reason"`
|
||||
At string `json:"at"`
|
||||
Delayed bool `json:"delayed"`
|
||||
AllocationStatus string `json:"allocation_status"`
|
||||
Details string `json:"details"`
|
||||
} `json:"unassigned_info,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterStateRoutingNodes is a sub type of ClusterStateResp containing information about shard assigned to nodes
|
||||
type ClusterStateRoutingNodes struct {
|
||||
Unassigned []ClusterStateRoutingIndex `json:"unassigned"`
|
||||
Nodes map[string][]ClusterStateRoutingIndex `json:"nodes"`
|
||||
}
|
||||
68
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-stats-params.go
generated
vendored
Normal file
68
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-stats-params.go
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClusterStatsParams represents possible parameters for the ClusterStatsReq
|
||||
type ClusterStatsParams struct {
|
||||
Timeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterStatsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
276
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-stats.go
generated
vendored
Normal file
276
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-stats.go
generated
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterStatsReq represents possible options for the /_cluster/stats request
|
||||
type ClusterStatsReq struct {
|
||||
NodeFilters []string
|
||||
|
||||
Header http.Header
|
||||
Params ClusterStatsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterStatsReq) GetRequest() (*http.Request, error) {
|
||||
filters := strings.Join(r.NodeFilters, ",")
|
||||
|
||||
var path strings.Builder
|
||||
path.Grow(22 + len(filters))
|
||||
path.WriteString("/_cluster/stats")
|
||||
if len(filters) > 0 {
|
||||
path.WriteString("/nodes/")
|
||||
path.WriteString(filters)
|
||||
}
|
||||
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterStatsResp represents the returned struct of the ClusterStatsReq response
|
||||
type ClusterStatsResp struct {
|
||||
NodesInfo struct {
|
||||
Total int `json:"total"`
|
||||
Successful int `json:"successful"`
|
||||
Failed int `json:"failed"`
|
||||
Failures []FailuresCause `json:"failures"`
|
||||
} `json:"_nodes"`
|
||||
ClusterName string `json:"cluster_name"`
|
||||
ClusterUUID string `json:"cluster_uuid"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Status string `json:"status"`
|
||||
Indices ClusterStatsIndices `json:"indices"`
|
||||
Nodes ClusterStatsNodes `json:"nodes"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ClusterStatsResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ClusterStatsIndices is a sub type of ClusterStatsResp containing cluster information about indices
|
||||
type ClusterStatsIndices struct {
|
||||
Count int `json:"count"`
|
||||
Shards struct {
|
||||
Total int `json:"total"`
|
||||
Primaries int `json:"primaries"`
|
||||
Replication float64 `json:"replication"`
|
||||
Index struct {
|
||||
Shards struct {
|
||||
Min float64 `json:"min"`
|
||||
Max float64 `json:"max"`
|
||||
Avg float64 `json:"avg"`
|
||||
} `json:"shards"`
|
||||
Primaries struct {
|
||||
Min float64 `json:"min"`
|
||||
Max float64 `json:"max"`
|
||||
Avg float64 `json:"avg"`
|
||||
} `json:"primaries"`
|
||||
Replication struct {
|
||||
Min float64 `json:"min"`
|
||||
Max float64 `json:"max"`
|
||||
Avg float64 `json:"avg"`
|
||||
} `json:"replication"`
|
||||
} `json:"index"`
|
||||
} `json:"shards"`
|
||||
Docs struct {
|
||||
Count int64 `json:"count"`
|
||||
Deleted int `json:"deleted"`
|
||||
} `json:"docs"`
|
||||
Store struct {
|
||||
SizeInBytes int64 `json:"size_in_bytes"`
|
||||
ReservedInBytes int `json:"reserved_in_bytes"`
|
||||
} `json:"store"`
|
||||
Fielddata struct {
|
||||
MemorySizeInBytes int `json:"memory_size_in_bytes"`
|
||||
Evictions int `json:"evictions"`
|
||||
} `json:"fielddata"`
|
||||
QueryCache struct {
|
||||
MemorySizeInBytes int `json:"memory_size_in_bytes"`
|
||||
TotalCount int `json:"total_count"`
|
||||
HitCount int `json:"hit_count"`
|
||||
MissCount int `json:"miss_count"`
|
||||
CacheSize int `json:"cache_size"`
|
||||
CacheCount int `json:"cache_count"`
|
||||
Evictions int `json:"evictions"`
|
||||
} `json:"query_cache"`
|
||||
Completion struct {
|
||||
SizeInBytes int `json:"size_in_bytes"`
|
||||
} `json:"completion"`
|
||||
Segments struct {
|
||||
Count int `json:"count"`
|
||||
MemoryInBytes int `json:"memory_in_bytes"`
|
||||
TermsMemoryInBytes int `json:"terms_memory_in_bytes"`
|
||||
StoredFieldsMemoryInBytes int `json:"stored_fields_memory_in_bytes"`
|
||||
TermVectorsMemoryInBytes int `json:"term_vectors_memory_in_bytes"`
|
||||
NormsMemoryInBytes int `json:"norms_memory_in_bytes"`
|
||||
PointsMemoryInBytes int `json:"points_memory_in_bytes"`
|
||||
DocValuesMemoryInBytes int `json:"doc_values_memory_in_bytes"`
|
||||
IndexWriterMemoryInBytes int `json:"index_writer_memory_in_bytes"`
|
||||
VersionMapMemoryInBytes int `json:"version_map_memory_in_bytes"`
|
||||
FixedBitSetMemoryInBytes int64 `json:"fixed_bit_set_memory_in_bytes"`
|
||||
MaxUnsafeAutoIDTimestamp int64 `json:"max_unsafe_auto_id_timestamp"`
|
||||
RemoteStore struct {
|
||||
Upload struct {
|
||||
TotalUploadSize struct {
|
||||
StartedBytes int `json:"started_bytes"`
|
||||
SucceededBytes int `json:"succeeded_bytes"`
|
||||
FailedBytes int `json:"failed_bytes"`
|
||||
} `json:"total_upload_size"`
|
||||
RefreshSizeLag struct {
|
||||
TotalBytes int `json:"total_bytes"`
|
||||
MaxBytes int `json:"max_bytes"`
|
||||
} `json:"refresh_size_lag"`
|
||||
MaxRefreshTimeLagInMillis int `json:"max_refresh_time_lag_in_millis"`
|
||||
TotalTimeSpentInMillis int `json:"total_time_spent_in_millis"`
|
||||
Pressure struct {
|
||||
TotalRejections int `json:"total_rejections"`
|
||||
} `json:"pressure"`
|
||||
} `json:"upload"`
|
||||
Download struct {
|
||||
TotalDownloadSize struct {
|
||||
StartedBytes int `json:"started_bytes"`
|
||||
SucceededBytes int `json:"succeeded_bytes"`
|
||||
FailedBytes int `json:"failed_bytes"`
|
||||
} `json:"total_download_size"`
|
||||
TotalTimeSpentInMillis int `json:"total_time_spent_in_millis"`
|
||||
} `json:"download"`
|
||||
} `json:"remote_store"`
|
||||
SegmentReplication struct {
|
||||
// Type is json.RawMessage due to difference in opensearch versions from string to int
|
||||
MaxBytesBehind json.RawMessage `json:"max_bytes_behind"`
|
||||
TotalBytesBehind json.RawMessage `json:"total_bytes_behind"`
|
||||
MaxReplicationLag json.RawMessage `json:"max_replication_lag"`
|
||||
} `json:"segment_replication"`
|
||||
FileSizes json.RawMessage `json:"file_sizes"`
|
||||
} `json:"segments"`
|
||||
Mappings struct {
|
||||
FieldTypes []struct {
|
||||
Name string `json:"name"`
|
||||
Count int `json:"count"`
|
||||
IndexCount int `json:"index_count"`
|
||||
} `json:"field_types"`
|
||||
} `json:"mappings"`
|
||||
Analysis struct {
|
||||
CharFilterTypes []json.RawMessage `json:"char_filter_types"`
|
||||
TokenizerTypes []json.RawMessage `json:"tokenizer_types"`
|
||||
FilterTypes []json.RawMessage `json:"filter_types"`
|
||||
AnalyzerTypes []json.RawMessage `json:"analyzer_types"`
|
||||
BuiltInCharFilters []json.RawMessage `json:"built_in_char_filters"`
|
||||
BuiltInTokenizers []json.RawMessage `json:"built_in_tokenizers"`
|
||||
BuiltInFilters []json.RawMessage `json:"built_in_filters"`
|
||||
BuiltInAnalyzers []json.RawMessage `json:"built_in_analyzers"`
|
||||
} `json:"analysis"`
|
||||
RepositoryCleanup struct {
|
||||
RepositoryCleanup []json.RawMessage `json:"repository_cleanup"`
|
||||
} `json:"repository_cleanup"`
|
||||
}
|
||||
|
||||
// ClusterStatsNodes is a sub type of ClusterStatsResp containing information about node stats
|
||||
type ClusterStatsNodes struct {
|
||||
Count struct {
|
||||
Total int `json:"total"`
|
||||
ClusterManager int `json:"cluster_manager"`
|
||||
CoordinatingOnly int `json:"coordinating_only"`
|
||||
Data int `json:"data"`
|
||||
Ingest int `json:"ingest"`
|
||||
Master int `json:"master"`
|
||||
RemoteClusterClient int `json:"remote_cluster_client"`
|
||||
Search int `json:"search"`
|
||||
} `json:"count"`
|
||||
Versions []string `json:"versions"`
|
||||
Os struct {
|
||||
AvailableProcessors int `json:"available_processors"`
|
||||
AllocatedProcessors int `json:"allocated_processors"`
|
||||
Names []struct {
|
||||
Name string `json:"name"`
|
||||
Count int `json:"count"`
|
||||
} `json:"names"`
|
||||
PrettyNames []struct {
|
||||
PrettyName string `json:"pretty_name"`
|
||||
Count int `json:"count"`
|
||||
} `json:"pretty_names"`
|
||||
Mem struct {
|
||||
TotalInBytes int64 `json:"total_in_bytes"`
|
||||
FreeInBytes int64 `json:"free_in_bytes"`
|
||||
UsedInBytes int64 `json:"used_in_bytes"`
|
||||
FreePercent int `json:"free_percent"`
|
||||
UsedPercent int `json:"used_percent"`
|
||||
} `json:"mem"`
|
||||
} `json:"os"`
|
||||
Process struct {
|
||||
CPU struct {
|
||||
Percent int `json:"percent"`
|
||||
} `json:"cpu"`
|
||||
OpenFileDescriptors struct {
|
||||
Min int `json:"min"`
|
||||
Max int `json:"max"`
|
||||
Avg int `json:"avg"`
|
||||
} `json:"open_file_descriptors"`
|
||||
} `json:"process"`
|
||||
Jvm struct {
|
||||
MaxUptimeInMillis int64 `json:"max_uptime_in_millis"`
|
||||
Versions []struct {
|
||||
Version string `json:"version"`
|
||||
VMName string `json:"vm_name"`
|
||||
VMVersion string `json:"vm_version"`
|
||||
VMVendor string `json:"vm_vendor"`
|
||||
BundledJdk bool `json:"bundled_jdk"`
|
||||
UsingBundledJdk bool `json:"using_bundled_jdk"`
|
||||
Count int `json:"count"`
|
||||
} `json:"versions"`
|
||||
Mem struct {
|
||||
HeapUsedInBytes int64 `json:"heap_used_in_bytes"`
|
||||
HeapMaxInBytes int64 `json:"heap_max_in_bytes"`
|
||||
} `json:"mem"`
|
||||
Threads int `json:"threads"`
|
||||
} `json:"jvm"`
|
||||
Fs struct {
|
||||
TotalInBytes int64 `json:"total_in_bytes"`
|
||||
FreeInBytes int64 `json:"free_in_bytes"`
|
||||
AvailableInBytes int64 `json:"available_in_bytes"`
|
||||
CacheReservedInBytes int `json:"cache_reserved_in_bytes"`
|
||||
} `json:"fs"`
|
||||
Plugins []struct {
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
OpensearchVersion string `json:"opensearch_version"`
|
||||
JavaVersion string `json:"java_version"`
|
||||
Description string `json:"description"`
|
||||
Classname string `json:"classname"`
|
||||
CustomFoldername *string `json:"custom_foldername"`
|
||||
ExtendedPlugins []string `json:"extended_plugins"`
|
||||
OptionalExtendedPlugins []string `json:"optional_extended_plugins"`
|
||||
HasNativeController bool `json:"has_native_controller"`
|
||||
} `json:"plugins"`
|
||||
NetworkTypes struct {
|
||||
TransportTypes map[string]int `json:"transport_types"`
|
||||
HTTPTypes map[string]int `json:"http_types"`
|
||||
} `json:"network_types"`
|
||||
DiscoveryTypes map[string]int `json:"discovery_types"`
|
||||
PackagingTypes []struct {
|
||||
Type string `json:"type"`
|
||||
Count int `json:"count"`
|
||||
} `json:"packaging_types"`
|
||||
Ingest struct {
|
||||
NumberOfPipelines int `json:"number_of_pipelines"`
|
||||
ProcessorStats json.RawMessage `json:"processor_stats"`
|
||||
} `json:"ingest"`
|
||||
}
|
||||
115
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-voting_config_exclusions-params.go
generated
vendored
Normal file
115
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-voting_config_exclusions-params.go
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ClusterPostVotingConfigExclusionsParams represents possible parameters for the ClusterVotingConfigExclusionsReq
|
||||
type ClusterPostVotingConfigExclusionsParams struct {
|
||||
NodeIds string
|
||||
NodeNames string
|
||||
Timeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterPostVotingConfigExclusionsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.NodeIds != "" {
|
||||
params["node_ids"] = r.NodeIds
|
||||
}
|
||||
|
||||
if r.NodeNames != "" {
|
||||
params["node_names"] = r.NodeNames
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
// ClusterDeleteVotingConfigExclusionsParams represents possible parameters for the ClusterVotingConfigExclusionsReq
|
||||
type ClusterDeleteVotingConfigExclusionsParams struct {
|
||||
WaitForRemoval *bool
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ClusterDeleteVotingConfigExclusionsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.WaitForRemoval != nil {
|
||||
params["wait_for_removal"] = strconv.FormatBool(*r.WaitForRemoval)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
47
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-voting_config_exclusions.go
generated
vendored
Normal file
47
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster-voting_config_exclusions.go
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ClusterPostVotingConfigExclusionsReq represents possible options for the /_cluster/voting_config_exclusions request
|
||||
type ClusterPostVotingConfigExclusionsReq struct {
|
||||
Header http.Header
|
||||
Params ClusterPostVotingConfigExclusionsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterPostVotingConfigExclusionsReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"POST",
|
||||
"/_cluster/voting_config_exclusions",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ClusterDeleteVotingConfigExclusionsReq represents possible options for the /_cluster/voting_config_exclusions request
|
||||
type ClusterDeleteVotingConfigExclusionsReq struct {
|
||||
Header http.Header
|
||||
Params ClusterDeleteVotingConfigExclusionsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ClusterDeleteVotingConfigExclusionsReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"DELETE",
|
||||
"/_cluster/voting_config_exclusions",
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
241
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster.go
generated
vendored
Normal file
241
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_cluster.go
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
type clusterClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
// AllocationExplain executes a /_cluster/allocation/explain request with the optional ClusterAllocationExplainReq
|
||||
func (c clusterClient) AllocationExplain(ctx context.Context, req *ClusterAllocationExplainReq) (*ClusterAllocationExplainResp, error) {
|
||||
if req == nil {
|
||||
req = &ClusterAllocationExplainReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ClusterAllocationExplainResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Health executes a /_cluster/health request with the optional ClusterHealthReq
|
||||
func (c clusterClient) Health(ctx context.Context, req *ClusterHealthReq) (*ClusterHealthResp, error) {
|
||||
if req == nil {
|
||||
req = &ClusterHealthReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ClusterHealthResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// PendingTasks executes a /_cluster/pending_tasks request with the optional ClusterPendingTasksReq
|
||||
func (c clusterClient) PendingTasks(ctx context.Context, req *ClusterPendingTasksReq) (*ClusterPendingTasksResp, error) {
|
||||
if req == nil {
|
||||
req = &ClusterPendingTasksReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ClusterPendingTasksResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// GetSettings executes a /_cluster/settings request with the optional ClusterGetSettingsReq
|
||||
func (c clusterClient) GetSettings(ctx context.Context, req *ClusterGetSettingsReq) (*ClusterGetSettingsResp, error) {
|
||||
if req == nil {
|
||||
req = &ClusterGetSettingsReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ClusterGetSettingsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// PutSettings executes a /_cluster/settings request with the required ClusterPutSettingsReq
|
||||
func (c clusterClient) PutSettings(ctx context.Context, req ClusterPutSettingsReq) (*ClusterPutSettingsResp, error) {
|
||||
var (
|
||||
data ClusterPutSettingsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// State executes a /_cluster/state request with the optional ClusterStateReq
|
||||
func (c clusterClient) State(ctx context.Context, req *ClusterStateReq) (*ClusterStateResp, error) {
|
||||
if req == nil {
|
||||
req = &ClusterStateReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ClusterStateResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Stats executes a /_cluster/stats request with the optional ClusterStatsReq
|
||||
func (c clusterClient) Stats(ctx context.Context, req *ClusterStatsReq) (*ClusterStatsResp, error) {
|
||||
if req == nil {
|
||||
req = &ClusterStatsReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ClusterStatsResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Reroute executes a /_cluster/reroute request with the required ClusterRerouteReq
|
||||
func (c clusterClient) Reroute(ctx context.Context, req ClusterRerouteReq) (*ClusterRerouteResp, error) {
|
||||
var (
|
||||
data ClusterRerouteResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// PostVotingConfigExclusions executes a /_cluster/voting_config_exclusions request with the optional ClusterPostVotingConfigExclusionsReq
|
||||
func (c clusterClient) PostVotingConfigExclusions(
|
||||
ctx context.Context,
|
||||
req ClusterPostVotingConfigExclusionsReq,
|
||||
) (*opensearch.Response, error) {
|
||||
var (
|
||||
resp *opensearch.Response
|
||||
err error
|
||||
)
|
||||
if resp, err = c.apiClient.do(ctx, req, nil); err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// DeleteVotingConfigExclusions executes a /_cluster/voting_config_exclusions request
|
||||
// with the optional ClusterDeleteVotingConfigExclusionsReq
|
||||
func (c clusterClient) DeleteVotingConfigExclusions(
|
||||
ctx context.Context,
|
||||
req ClusterDeleteVotingConfigExclusionsReq,
|
||||
) (*opensearch.Response, error) {
|
||||
var (
|
||||
resp *opensearch.Response
|
||||
err error
|
||||
)
|
||||
if resp, err = c.apiClient.do(ctx, req, nil); err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// PutDecommission executes a /_cluster/decommission/awareness request with the optional ClusterPutDecommissionReq
|
||||
func (c clusterClient) PutDecommission(ctx context.Context, req ClusterPutDecommissionReq) (*ClusterPutDecommissionResp, error) {
|
||||
var (
|
||||
data ClusterPutDecommissionResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// DeleteDecommission executes a /_cluster/decommission/awareness request with the optional ClusterDeleteDecommissionReq
|
||||
func (c clusterClient) DeleteDecommission(
|
||||
ctx context.Context,
|
||||
req *ClusterDeleteDecommissionReq,
|
||||
) (*ClusterDeleteDecommissionResp, error) {
|
||||
if req == nil {
|
||||
req = &ClusterDeleteDecommissionReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ClusterDeleteDecommissionResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// GetDecommission executes a /_cluster/decommission/awareness request with the optional ClusterGetDecommissionReq
|
||||
func (c clusterClient) GetDecommission(ctx context.Context, req ClusterGetDecommissionReq) (*ClusterGetDecommissionResp, error) {
|
||||
var (
|
||||
data ClusterGetDecommissionResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Values); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// RemoteInfo executes a /_remote/info request with the optional ClusterRemoteInfoReq
|
||||
func (c clusterClient) RemoteInfo(ctx context.Context, req *ClusterRemoteInfoReq) (*ClusterRemoteInfoResp, error) {
|
||||
if req == nil {
|
||||
req = &ClusterRemoteInfoReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ClusterRemoteInfoResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data.Clusters); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
84
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-create-params.go
generated
vendored
Normal file
84
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-create-params.go
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ComponentTemplateCreateParams represents possible parameters for the ComponentTemplateCreateReq
|
||||
type ComponentTemplateCreateParams struct {
|
||||
Create *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Timeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ComponentTemplateCreateParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Create != nil {
|
||||
params["create"] = strconv.FormatBool(*r.Create)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
47
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-create.go
generated
vendored
Normal file
47
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-create.go
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ComponentTemplateCreateReq represents possible options for the _component_template create request
|
||||
type ComponentTemplateCreateReq struct {
|
||||
ComponentTemplate string
|
||||
|
||||
Body io.Reader
|
||||
|
||||
Header http.Header
|
||||
Params ComponentTemplateCreateParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ComponentTemplateCreateReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"PUT",
|
||||
fmt.Sprintf("/_component_template/%s", r.ComponentTemplate),
|
||||
r.Body,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ComponentTemplateCreateResp represents the returned struct of the index create response
|
||||
type ComponentTemplateCreateResp struct {
|
||||
Acknowledged bool `json:"acknowledged"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ComponentTemplateCreateResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
78
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-delete-params.go
generated
vendored
Normal file
78
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-delete-params.go
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ComponentTemplateDeleteParams represents possible parameters for the ComponentTemplateDeleteReq
|
||||
type ComponentTemplateDeleteParams struct {
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
Timeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ComponentTemplateDeleteParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Timeout != 0 {
|
||||
params["timeout"] = formatDuration(r.Timeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
44
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-delete.go
generated
vendored
Normal file
44
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-delete.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ComponentTemplateDeleteReq represents possible options for the _component_template delete request
|
||||
type ComponentTemplateDeleteReq struct {
|
||||
ComponentTemplate string
|
||||
|
||||
Header http.Header
|
||||
Params ComponentTemplateDeleteParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ComponentTemplateDeleteReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"DELETE",
|
||||
fmt.Sprintf("/_component_template/%s", r.ComponentTemplate),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ComponentTemplateDeleteResp represents the returned struct of the _component_template delete response
|
||||
type ComponentTemplateDeleteResp struct {
|
||||
Acknowledged bool `json:"acknowledged"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ComponentTemplateDeleteResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
79
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-exists-params.go
generated
vendored
Normal file
79
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-exists-params.go
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ComponentTemplateExistsParams represents possible parameters for the ComponentTemplateExistsReq
|
||||
type ComponentTemplateExistsParams struct {
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ComponentTemplateExistsParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
33
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-exists.go
generated
vendored
Normal file
33
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-exists.go
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ComponentTemplateExistsReq represents possible options for the _component_template exists request
|
||||
type ComponentTemplateExistsReq struct {
|
||||
ComponentTemplate string
|
||||
|
||||
Header http.Header
|
||||
Params ComponentTemplateExistsParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ComponentTemplateExistsReq) GetRequest() (*http.Request, error) {
|
||||
return opensearch.BuildRequest(
|
||||
"HEAD",
|
||||
fmt.Sprintf("/_component_template/%s", r.ComponentTemplate),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
79
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-get-params.go
generated
vendored
Normal file
79
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-get-params.go
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
//
|
||||
// Modifications Copyright OpenSearch Contributors. See
|
||||
// GitHub history for details.
|
||||
|
||||
// Licensed to Elasticsearch B.V. under one or more contributor
|
||||
// license agreements. See the NOTICE file distributed with
|
||||
// this work for additional information regarding copyright
|
||||
// ownership. Elasticsearch B.V. licenses this file to you under
|
||||
// the Apache License, Version 2.0 (the "License"); you may
|
||||
// not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// ComponentTemplateGetParams represents possible parameters for the ComponentTemplateGetReq
|
||||
type ComponentTemplateGetParams struct {
|
||||
Local *bool
|
||||
MasterTimeout time.Duration
|
||||
ClusterManagerTimeout time.Duration
|
||||
|
||||
Pretty bool
|
||||
Human bool
|
||||
ErrorTrace bool
|
||||
FilterPath []string
|
||||
}
|
||||
|
||||
func (r ComponentTemplateGetParams) get() map[string]string {
|
||||
params := make(map[string]string)
|
||||
|
||||
if r.Local != nil {
|
||||
params["local"] = strconv.FormatBool(*r.Local)
|
||||
}
|
||||
|
||||
if r.MasterTimeout != 0 {
|
||||
params["master_timeout"] = formatDuration(r.MasterTimeout)
|
||||
}
|
||||
|
||||
if r.ClusterManagerTimeout != 0 {
|
||||
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
|
||||
}
|
||||
|
||||
if r.Pretty {
|
||||
params["pretty"] = "true"
|
||||
}
|
||||
|
||||
if r.Human {
|
||||
params["human"] = "true"
|
||||
}
|
||||
|
||||
if r.ErrorTrace {
|
||||
params["error_trace"] = "true"
|
||||
}
|
||||
|
||||
if len(r.FilterPath) > 0 {
|
||||
params["filter_path"] = strings.Join(r.FilterPath, ",")
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
65
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-get.go
generated
vendored
Normal file
65
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template-get.go
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
// ComponentTemplateGetReq represents possible options for the _component_template get request
|
||||
type ComponentTemplateGetReq struct {
|
||||
ComponentTemplate string
|
||||
|
||||
Header http.Header
|
||||
Params ComponentTemplateGetParams
|
||||
}
|
||||
|
||||
// GetRequest returns the *http.Request that gets executed by the client
|
||||
func (r ComponentTemplateGetReq) GetRequest() (*http.Request, error) {
|
||||
var path strings.Builder
|
||||
path.Grow(len("/_component_template/") + len(r.ComponentTemplate))
|
||||
path.WriteString("/_component_template")
|
||||
if len(r.ComponentTemplate) > 0 {
|
||||
path.WriteString("/")
|
||||
path.WriteString(r.ComponentTemplate)
|
||||
}
|
||||
|
||||
return opensearch.BuildRequest(
|
||||
"GET",
|
||||
path.String(),
|
||||
nil,
|
||||
r.Params.get(),
|
||||
r.Header,
|
||||
)
|
||||
}
|
||||
|
||||
// ComponentTemplateGetResp represents the returned struct of the index create response
|
||||
type ComponentTemplateGetResp struct {
|
||||
ComponentTemplates []ComponentTemplateGetDetails `json:"component_templates"`
|
||||
response *opensearch.Response
|
||||
}
|
||||
|
||||
// Inspect returns the Inspect type containing the raw *opensearch.Reponse
|
||||
func (r ComponentTemplateGetResp) Inspect() Inspect {
|
||||
return Inspect{Response: r.response}
|
||||
}
|
||||
|
||||
// ComponentTemplateGetDetails is a sub type of ComponentTemplateGetResp containing information about component template
|
||||
type ComponentTemplateGetDetails struct {
|
||||
Name string `json:"name"`
|
||||
ComponentTemplate struct {
|
||||
Template struct {
|
||||
Mappings json.RawMessage `json:"mappings"`
|
||||
Settings json.RawMessage `json:"settings"`
|
||||
Aliases json.RawMessage `json:"aliases"`
|
||||
} `json:"template"`
|
||||
} `json:"component_template"`
|
||||
}
|
||||
65
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template.go
generated
vendored
Normal file
65
vendor/github.com/opensearch-project/opensearch-go/v4/opensearchapi/api_component_template.go
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// The OpenSearch Contributors require contributions made to
|
||||
// this file be licensed under the Apache-2.0 license or a
|
||||
// compatible open source license.
|
||||
|
||||
package opensearchapi
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/opensearch-project/opensearch-go/v4"
|
||||
)
|
||||
|
||||
type componentTemplateClient struct {
|
||||
apiClient *Client
|
||||
}
|
||||
|
||||
// Create executes a creade componentTemplate request with the required ComponentTemplateCreateReq
|
||||
func (c componentTemplateClient) Create(ctx context.Context, req ComponentTemplateCreateReq) (*ComponentTemplateCreateResp, error) {
|
||||
var (
|
||||
data ComponentTemplateCreateResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Delete executes a delete componentTemplate request with the required ComponentTemplateDeleteReq
|
||||
func (c componentTemplateClient) Delete(ctx context.Context, req ComponentTemplateDeleteReq) (*ComponentTemplateDeleteResp, error) {
|
||||
var (
|
||||
data ComponentTemplateDeleteResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Get executes a get componentTemplate request with the optional ComponentTemplateGetReq
|
||||
func (c componentTemplateClient) Get(ctx context.Context, req *ComponentTemplateGetReq) (*ComponentTemplateGetResp, error) {
|
||||
if req == nil {
|
||||
req = &ComponentTemplateGetReq{}
|
||||
}
|
||||
|
||||
var (
|
||||
data ComponentTemplateGetResp
|
||||
err error
|
||||
)
|
||||
if data.response, err = c.apiClient.do(ctx, req, &data); err != nil {
|
||||
return &data, err
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
// Exists executes a exists componentTemplate request with the required ComponentTemplatExistsReq
|
||||
func (c componentTemplateClient) Exists(ctx context.Context, req ComponentTemplateExistsReq) (*opensearch.Response, error) {
|
||||
return c.apiClient.do(ctx, req, nil)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user