Documentation
¶
Index ¶
- Constants
- Variables
- func ActionGroupExists(ctx context.Context, service *OsClusterClient, actionGroupName string) (bool, error)
- func AppendExcludeNodeHost(service *OsClusterClient, nodeNameToExclude string) (bool, error)
- func CheckClusterStatusForRestart(service *OsClusterClient, drainNodes bool) (bool, error)
- func CreateIndex(clusterClient *OsClusterClient, indexName string, mapping *strings.Reader) (int, error)
- func CreateOrUpdateActionGroup(ctx context.Context, service *OsClusterClient, actionGroupName string, ...) error
- func CreateOrUpdateRole(ctx context.Context, service *OsClusterClient, rolename string, ...) error
- func CreateOrUpdateRoleMapping(ctx context.Context, service *OsClusterClient, rolename string, ...) error
- func CreateOrUpdateTenant(ctx context.Context, service *OsClusterClient, tenantName string, ...) error
- func CreateOrUpdateUser(ctx context.Context, service *OsClusterClient, username string, ...) error
- func DeleteActionGroup(ctx context.Context, service *OsClusterClient, actionGroupName string) error
- func DeleteIndex(clusterClient *OsClusterClient, indexName string) (int, error)
- func DeleteRole(ctx context.Context, service *OsClusterClient, rolename string) error
- func DeleteRoleMapping(ctx context.Context, service *OsClusterClient, rolename string) error
- func DeleteTenant(ctx context.Context, service *OsClusterClient, tenantName string) error
- func DeleteUser(ctx context.Context, service *OsClusterClient, username string) error
- func ErrCatIndicesFailed(resp string) error
- func ErrClusterHealthGetFailed(resp string) error
- func ErrClusterSettingsGetFailed(resp string) error
- func FetchExistingRoleMapping(ctx context.Context, service *OsClusterClient, rolename string) (requests.RoleMapping, error)
- func GetExistingSystemIndices(service *OsClusterClient) ([]string, error)
- func HasIndexPrimariesOnNode(service *OsClusterClient, nodeName string, indices []string) (bool, error)
- func HasIndicesWithNoReplica(service *OsClusterClient) (bool, error)
- func HasShardsOnNode(service *OsClusterClient, nodeName string) (bool, error)
- func MainPage(client *opensearch.Client) (responses.MainResponse, error)
- func PreparePodForDelete(service *OsClusterClient, podName string, drainNode bool, nodeCount int32) (bool, error)
- func ReactivateShardAllocation(service *OsClusterClient) error
- func RemoveExcludeNodeHost(service *OsClusterClient, nodeNameToExclude string) (bool, error)
- func RoleExists(ctx context.Context, service *OsClusterClient, rolename string) (bool, error)
- func RoleMappingExists(ctx context.Context, service *OsClusterClient, rolename string) (bool, error)
- func SetClusterShardAllocation(service *OsClusterClient, enableType ClusterSettingsAllocation) error
- func ShouldUpdateActionGroup(ctx context.Context, service *OsClusterClient, actionGroupName string, ...) (bool, error)
- func ShouldUpdateRole(ctx context.Context, service *OsClusterClient, rolename string, ...) (bool, error)
- func ShouldUpdateTenant(ctx context.Context, service *OsClusterClient, tenantName string, ...) (bool, error)
- func ShouldUpdateUser(ctx context.Context, service *OsClusterClient, username string, ...) (bool, error)
- func TenantExists(ctx context.Context, service *OsClusterClient, tenantName string) (bool, error)
- func UpdateIndexSettings(clusterClient *OsClusterClient, indexName string, mapping *strings.Reader)
- func UserExists(ctx context.Context, service *OsClusterClient, username string) (bool, error)
- func UserUIDMatches(ctx context.Context, service *OsClusterClient, username string, uid string) (bool, error)
- type ClusterSettingsAllocation
- type OsClusterClient
- func (client *OsClusterClient) CatIndices() ([]responses.CatIndicesResponse, error)
- func (client *OsClusterClient) CatNamedIndicesShards(headers []string, indices []string) ([]responses.CatShardsResponse, error)
- func (client *OsClusterClient) CatNodes() ([]responses.CatNodesResponse, error)
- func (client *OsClusterClient) CatShards(headers []string) ([]responses.CatShardsResponse, error)
- func (client *OsClusterClient) DeleteSecurityResource(ctx context.Context, resource, name string) (*opensearchapi.Response, error)
- func (client *OsClusterClient) GetClusterHealth() (responses.ClusterHealthResponse, error)
- func (client *OsClusterClient) GetClusterSettings() (responses.ClusterSettingsResponse, error)
- func (client *OsClusterClient) GetFlatClusterSettings() (responses.FlatClusterSettingsResponse, error)
- func (client *OsClusterClient) GetHealth() (responses.CatHealthResponse, error)
- func (client *OsClusterClient) GetSecurityResource(ctx context.Context, resource, name string) (*opensearchapi.Response, error)
- func (client *OsClusterClient) IndexExists(indexName string) (bool, error)
- func (client *OsClusterClient) NodesStats() (responses.NodesStatsResponse, error)
- func (client *OsClusterClient) PutClusterSettings(settings responses.ClusterSettingsResponse) (responses.ClusterSettingsResponse, error)
- func (client *OsClusterClient) PutSecurityResource(ctx context.Context, resource, name string, body io.Reader) (*opensearchapi.Response, error)
- func (client *OsClusterClient) ReRouteShard(rerouteJson string) (responses.ClusterRerouteResponse, error)
- type OsClusterClientOption
- type OsClusterClientOptions
Constants ¶
const ( K8sAttributeField = "k8s-uid" ROLES = "roles" INTERNALUSERS = "internalusers" ROLESMAPPING = "rolesmapping" ACTIONGROUPS = "actiongroups" TENANTS = "tenants" )
Variables ¶
var ( ErrClusterHealthOperation = errors.New("cluster health failed") ErrClusterSettingsOperation = errors.New("cluster settings failed") ErrCatIndicesOperation = errors.New("cat indices failed") )
var (
AdditionalSystemIndices = []string{
".opendistro-alerting-config",
".opendistro-alerting-alert*",
".opendistro-anomaly-results*",
".opendistro-anomaly-detector*",
".opendistro-anomaly-checkpoints",
".opendistro-anomaly-detection-state",
".opendistro-reports-*",
".opendistro-notifications-*",
".opendistro-notebooks",
".opensearch-observability",
".opendistro-asynchronous-search-response*",
".replication-metadata-store",
}
)
var ClusterSettingsExcludeBrokenPath = []string{"cluster", "routing", "allocation", "exclude", "_name"}
Functions ¶
func ActionGroupExists ¶
func ActionGroupExists(ctx context.Context, service *OsClusterClient, actionGroupName string) (bool, error)
ActionGroupExists checks if the passed actionGroup already exists or not
func AppendExcludeNodeHost ¶
func AppendExcludeNodeHost(service *OsClusterClient, nodeNameToExclude string) (bool, error)
func CheckClusterStatusForRestart ¶
func CheckClusterStatusForRestart(service *OsClusterClient, drainNodes bool) (bool, error)
func CreateIndex ¶
func CreateOrUpdateActionGroup ¶
func CreateOrUpdateActionGroup( ctx context.Context, service *OsClusterClient, actionGroupName string, actionGroup requests.ActionGroup, ) error
CreateOrUpdateActionGroup creates a new action group or updates a previously created action group
func CreateOrUpdateRole ¶
func CreateOrUpdateRoleMapping ¶
func CreateOrUpdateRoleMapping( ctx context.Context, service *OsClusterClient, rolename string, mapping requests.RoleMapping, ) error
func CreateOrUpdateTenant ¶
func CreateOrUpdateTenant( ctx context.Context, service *OsClusterClient, tenantName string, tenant requests.Tenant, ) error
CreateOrUpdateTenant creates a new tenant or updates a previously created tenant
func CreateOrUpdateUser ¶
func DeleteActionGroup ¶
func DeleteActionGroup(ctx context.Context, service *OsClusterClient, actionGroupName string) error
DeleteActionGroup deletes a previously created action group
func DeleteIndex ¶
func DeleteIndex(clusterClient *OsClusterClient, indexName string) (int, error)
func DeleteRole ¶
func DeleteRole(ctx context.Context, service *OsClusterClient, rolename string) error
func DeleteRoleMapping ¶
func DeleteRoleMapping(ctx context.Context, service *OsClusterClient, rolename string) error
func DeleteTenant ¶
func DeleteTenant(ctx context.Context, service *OsClusterClient, tenantName string) error
DeleteTenant deletes a previously created tenant
func DeleteUser ¶
func DeleteUser(ctx context.Context, service *OsClusterClient, username string) error
func ErrCatIndicesFailed ¶
func FetchExistingRoleMapping ¶
func FetchExistingRoleMapping( ctx context.Context, service *OsClusterClient, rolename string, ) (requests.RoleMapping, error)
func GetExistingSystemIndices ¶
func GetExistingSystemIndices(service *OsClusterClient) ([]string, error)
func HasIndexPrimariesOnNode ¶
func HasIndexPrimariesOnNode(service *OsClusterClient, nodeName string, indices []string) (bool, error)
func HasIndicesWithNoReplica ¶
func HasIndicesWithNoReplica(service *OsClusterClient) (bool, error)
func HasShardsOnNode ¶
func HasShardsOnNode(service *OsClusterClient, nodeName string) (bool, error)
func MainPage ¶
func MainPage(client *opensearch.Client) (responses.MainResponse, error)
func PreparePodForDelete ¶
func ReactivateShardAllocation ¶
func ReactivateShardAllocation(service *OsClusterClient) error
func RemoveExcludeNodeHost ¶
func RemoveExcludeNodeHost(service *OsClusterClient, nodeNameToExclude string) (bool, error)
func RoleExists ¶
func RoleMappingExists ¶
func SetClusterShardAllocation ¶
func SetClusterShardAllocation(service *OsClusterClient, enableType ClusterSettingsAllocation) error
func ShouldUpdateActionGroup ¶
func ShouldUpdateActionGroup( ctx context.Context, service *OsClusterClient, actionGroupName string, actionGroup requests.ActionGroup, ) (bool, error)
ShouldUpdateActionGroup checks whether a previously created actiongroup needs an update or not
func ShouldUpdateRole ¶
func ShouldUpdateTenant ¶
func ShouldUpdateTenant( ctx context.Context, service *OsClusterClient, tenantName string, tenant requests.Tenant, ) (bool, error)
ShouldUpdateTenant checks whether a previously created tenant needs an update or not
func ShouldUpdateUser ¶
func TenantExists ¶
TenantExists checks if the passed tenant already exists or not
func UpdateIndexSettings ¶
func UpdateIndexSettings(clusterClient *OsClusterClient, indexName string, mapping *strings.Reader)
func UserExists ¶
func UserUIDMatches ¶
Types ¶
type ClusterSettingsAllocation ¶
type ClusterSettingsAllocation string
const ( ClusterSettingsAllocationPrimaries ClusterSettingsAllocation = "primaries" ClusterSettingsAllocationAll ClusterSettingsAllocation = "all" ClusterSettingsAllocationNone ClusterSettingsAllocation = "none" )
type OsClusterClient ¶
type OsClusterClient struct { OsClusterClientOptions MainPage responses.MainResponse // contains filtered or unexported fields }
func NewOsClusterClient ¶
func NewOsClusterClient(clusterUrl string, username string, password string, opts ...OsClusterClientOption) (*OsClusterClient, error)
func NewOsClusterClientFromConfig ¶
func NewOsClusterClientFromConfig(config opensearch.Config) (*OsClusterClient, error)
func (*OsClusterClient) CatIndices ¶
func (client *OsClusterClient) CatIndices() ([]responses.CatIndicesResponse, error)
func (*OsClusterClient) CatNamedIndicesShards ¶
func (client *OsClusterClient) CatNamedIndicesShards(headers []string, indices []string) ([]responses.CatShardsResponse, error)
func (*OsClusterClient) CatNodes ¶
func (client *OsClusterClient) CatNodes() ([]responses.CatNodesResponse, error)
func (*OsClusterClient) CatShards ¶
func (client *OsClusterClient) CatShards(headers []string) ([]responses.CatShardsResponse, error)
func (*OsClusterClient) DeleteSecurityResource ¶
func (client *OsClusterClient) DeleteSecurityResource(ctx context.Context, resource, name string) (*opensearchapi.Response, error)
DeleteSecurityResource performs an HTTP DELETE request to OS to delete the security resource specified by name
func (*OsClusterClient) GetClusterHealth ¶
func (client *OsClusterClient) GetClusterHealth() (responses.ClusterHealthResponse, error)
func (*OsClusterClient) GetClusterSettings ¶
func (client *OsClusterClient) GetClusterSettings() (responses.ClusterSettingsResponse, error)
func (*OsClusterClient) GetFlatClusterSettings ¶
func (client *OsClusterClient) GetFlatClusterSettings() (responses.FlatClusterSettingsResponse, error)
func (*OsClusterClient) GetHealth ¶
func (client *OsClusterClient) GetHealth() (responses.CatHealthResponse, error)
func (*OsClusterClient) GetSecurityResource ¶
func (client *OsClusterClient) GetSecurityResource(ctx context.Context, resource, name string) (*opensearchapi.Response, error)
GetSecurityResource performs an HTTP GET request to OS to fetch the security resource specified by name
func (*OsClusterClient) IndexExists ¶
func (client *OsClusterClient) IndexExists(indexName string) (bool, error)
func (*OsClusterClient) NodesStats ¶
func (client *OsClusterClient) NodesStats() (responses.NodesStatsResponse, error)
func (*OsClusterClient) PutClusterSettings ¶
func (client *OsClusterClient) PutClusterSettings(settings responses.ClusterSettingsResponse) (responses.ClusterSettingsResponse, error)
func (*OsClusterClient) PutSecurityResource ¶
func (client *OsClusterClient) PutSecurityResource(ctx context.Context, resource, name string, body io.Reader) (*opensearchapi.Response, error)
PutSecurityResource performs an HTTP PUT request to OS to create/update the security resource specified by name
func (*OsClusterClient) ReRouteShard ¶
func (client *OsClusterClient) ReRouteShard(rerouteJson string) (responses.ClusterRerouteResponse, error)
type OsClusterClientOption ¶
type OsClusterClientOption func(*OsClusterClientOptions)
func WithTransport ¶
func WithTransport(transport http.RoundTripper) OsClusterClientOption
type OsClusterClientOptions ¶
type OsClusterClientOptions struct {
// contains filtered or unexported fields
}