Skip to content

Commit

Permalink
Add support for inclusive naming (#156)
Browse files Browse the repository at this point in the history
* Support cluster_manager in discovery logic

Signed-off-by: Thomas Farr <[email protected]>

* Update WithLocal comments

Signed-off-by: Thomas Farr <[email protected]>

* Add ClusterManagerTimeout

Signed-off-by: Thomas Farr <[email protected]>

* Add CatClusterManager

Signed-off-by: Thomas Farr <[email protected]>

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Oct 11, 2022
1 parent dba374d commit cd6193e
Show file tree
Hide file tree
Showing 81 changed files with 1,830 additions and 417 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ lint: ## Run lint on the package
}


backport: ## Backport one or more commits from master into version branches
backport: ## Backport one or more commits from main into version branches
ifeq ($(origin commits), undefined)
@echo "Missing commit(s), exiting..."
@exit 2
Expand Down
2 changes: 1 addition & 1 deletion internal/build/cmd/tools/commands/spec/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestBuild_zipfileUrl(t *testing.T) {
"build_id": "1.0.0-ab7cd914",
"projects": {
"opensearch": {
"branch": "master",
"branch": "main",
"commit_hash": "d3be79018b5b70a118ea5a897a539428b728df5a",
"Packages": {
"rest-resources-zip-8.0.0-SNAPSHOT.zip": {
Expand Down
85 changes: 44 additions & 41 deletions opensearchapi/api._.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,29 @@ type API struct {

// Cat contains the Cat APIs
type Cat struct {
Aliases CatAliases
Allocation CatAllocation
Count CatCount
Fielddata CatFielddata
Health CatHealth
Help CatHelp
Indices CatIndices
Master CatMaster
Nodeattrs CatNodeattrs
Nodes CatNodes
PendingTasks CatPendingTasks
Plugins CatPlugins
Recovery CatRecovery
Repositories CatRepositories
Segments CatSegments
Shards CatShards
Snapshots CatSnapshots
Tasks CatTasks
Templates CatTemplates
ThreadPool CatThreadPool
Aliases CatAliases
Allocation CatAllocation
ClusterManager CatClusterManager
Count CatCount
Fielddata CatFielddata
Health CatHealth
Help CatHelp
Indices CatIndices
Nodeattrs CatNodeattrs
Nodes CatNodes
PendingTasks CatPendingTasks
Plugins CatPlugins
Recovery CatRecovery
Repositories CatRepositories
Segments CatSegments
Shards CatShards
Snapshots CatSnapshots
Tasks CatTasks
Templates CatTemplates
ThreadPool CatThreadPool

// Deprecated: To promote inclusive language, please use ClusterManager instead.
Master CatMaster
}

// Cluster contains the Cluster APIs
Expand Down Expand Up @@ -220,7 +223,6 @@ type Tasks struct {
}

// New creates new API
//
func New(t Transport) *API {
return &API{
Bulk: newBulkFunc(t),
Expand Down Expand Up @@ -266,26 +268,27 @@ func New(t Transport) *API {
UpdateByQueryRethrottle: newUpdateByQueryRethrottleFunc(t),
Update: newUpdateFunc(t),
Cat: &Cat{
Aliases: newCatAliasesFunc(t),
Allocation: newCatAllocationFunc(t),
Count: newCatCountFunc(t),
Fielddata: newCatFielddataFunc(t),
Health: newCatHealthFunc(t),
Help: newCatHelpFunc(t),
Indices: newCatIndicesFunc(t),
Master: newCatMasterFunc(t),
Nodeattrs: newCatNodeattrsFunc(t),
Nodes: newCatNodesFunc(t),
PendingTasks: newCatPendingTasksFunc(t),
Plugins: newCatPluginsFunc(t),
Recovery: newCatRecoveryFunc(t),
Repositories: newCatRepositoriesFunc(t),
Segments: newCatSegmentsFunc(t),
Shards: newCatShardsFunc(t),
Snapshots: newCatSnapshotsFunc(t),
Tasks: newCatTasksFunc(t),
Templates: newCatTemplatesFunc(t),
ThreadPool: newCatThreadPoolFunc(t),
Aliases: newCatAliasesFunc(t),
Allocation: newCatAllocationFunc(t),
ClusterManager: newCatClusterManagerFunc(t),
Count: newCatCountFunc(t),
Fielddata: newCatFielddataFunc(t),
Health: newCatHealthFunc(t),
Help: newCatHelpFunc(t),
Indices: newCatIndicesFunc(t),
Master: newCatMasterFunc(t),
Nodeattrs: newCatNodeattrsFunc(t),
Nodes: newCatNodesFunc(t),
PendingTasks: newCatPendingTasksFunc(t),
Plugins: newCatPluginsFunc(t),
Recovery: newCatRecoveryFunc(t),
Repositories: newCatRepositoriesFunc(t),
Segments: newCatSegmentsFunc(t),
Shards: newCatShardsFunc(t),
Snapshots: newCatSnapshotsFunc(t),
Tasks: newCatTasksFunc(t),
Templates: newCatTemplatesFunc(t),
ThreadPool: newCatThreadPoolFunc(t),
},
Cluster: &Cluster{
AllocationExplain: newClusterAllocationExplainFunc(t),
Expand Down
2 changes: 1 addition & 1 deletion opensearchapi/api.cat.aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ func (f CatAliases) WithHelp(v bool) func(*CatAliasesRequest) {
}
}

// WithLocal - return local information, do not retrieve the state from master node (default: false).
// WithLocal - return local information, do not retrieve the state from cluster-manager node (default: false).
//
func (f CatAliases) WithLocal(v bool) func(*CatAliasesRequest) {
return func(r *CatAliasesRequest) {
Expand Down
35 changes: 25 additions & 10 deletions opensearchapi/api.cat.allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ type CatAllocation func(o ...func(*CatAllocationRequest)) (*Response, error)
type CatAllocationRequest struct {
NodeID []string

Bytes string
Format string
H []string
Help *bool
Local *bool
MasterTimeout time.Duration
S []string
V *bool
Bytes string
Format string
H []string
Help *bool
Local *bool
MasterTimeout time.Duration
ClusterManagerTimeout time.Duration
S []string
V *bool

Pretty bool
Human bool
Expand Down Expand Up @@ -123,6 +124,10 @@ func (r CatAllocationRequest) Do(ctx context.Context, transport Transport) (*Res
params["master_timeout"] = formatDuration(r.MasterTimeout)
}

if r.ClusterManagerTimeout != 0 {
params["cluster_manager_timeout"] = formatDuration(r.ClusterManagerTimeout)
}

if len(r.S) > 0 {
params["s"] = strings.Join(r.S, ",")
}
Expand Down Expand Up @@ -238,22 +243,32 @@ func (f CatAllocation) WithHelp(v bool) func(*CatAllocationRequest) {
}
}

// WithLocal - return local information, do not retrieve the state from master node (default: false).
// WithLocal - return local information, do not retrieve the state from cluster-manager node (default: false).
//
func (f CatAllocation) WithLocal(v bool) func(*CatAllocationRequest) {
return func(r *CatAllocationRequest) {
r.Local = &v
}
}

// WithMasterTimeout - explicit operation timeout for connection to master node.
// WithMasterTimeout - explicit operation timeout for connection to cluster-manager node.
//
// Deprecated: To promote inclusive language, use WithClusterManagerTimeout instead.
//
func (f CatAllocation) WithMasterTimeout(v time.Duration) func(*CatAllocationRequest) {
return func(r *CatAllocationRequest) {
r.MasterTimeout = v
}
}

// WithClusterManagerTimeout - explicit operation timeout for connection to cluster-manager node.
//
func (f CatAllocation) WithClusterManagerTimeout(v time.Duration) func(*CatAllocationRequest) {
return func(r *CatAllocationRequest) {
r.ClusterManagerTimeout = v
}
}

// WithS - comma-separated list of column names or column aliases to sort by.
//
func (f CatAllocation) WithS(v ...string) func(*CatAllocationRequest) {
Expand Down
Loading

0 comments on commit cd6193e

Please sign in to comment.