opensearch

package
v1.21.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterStatusGreen  = "green"
	ClusterStatusYellow = "yellow"
	ClusterStatusRed    = "red"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a wrapper on top of the official opensearch client, implementing a custom transport that modifies the request in two ways:

  • Requests are signed using AWS Signature Version 4 before passing them to the underlying transport
  • The transport is tunneled through the provided SSH client using its Dial function

func New

func New(esEndpoint string, sshc *ssh.Client, awsProfile, awsRegion string) (*Client, error)

New builds a new Client for the AWS OpenSearch Domain pointed to by esEndoint, using the AWS profile to sign requests and tunneling those requests through the SSH connection provided by the SSH client.

func (*Client) CloseIndices

func (c *Client) CloseIndices(indices []string) error

CloseIndices close the indices specified. This is used so that a snapshot containing indices with the same names as the ones provided can be restored; otherwise, the restored indices would need to be renamed.

func (*Client) ClusterHealth

func (c *Client) ClusterHealth() (ClusterHealthResponse, error)

func (*Client) ListIndices

func (c *Client) ListIndices() ([]string, error)

ListIndices returns the names of the indices already present in the server as a plain slice of strings

func (*Client) ListRepositories

func (c *Client) ListRepositories() ([]Repository, error)

ListRepositories returns the list of repositories registered in the server

func (*Client) ListSnapshots

func (c *Client) ListSnapshots(repositoryName string) ([]Snapshot, error)

ListSnapshots returns the list of snapshots included in the repository specified by repositoryName

func (*Client) RegisterS3Repository

func (c *Client) RegisterS3Repository(name, arn string) error

RegisterS3Repository registers a repository of type S3, identified by its name, using the role ARN provided

func (*Client) RestoreSnapshot

func (c *Client) RestoreSnapshot(repositoryName, snapshotName string, opts RestoreSnapshotOpts) error

RestoreSnapshot restores a snapshot from a repository using the options provided.

func (*Client) SnapshotIndicesRecovery

func (c *Client) SnapshotIndicesRecovery(indices []string) ([]SnapshotIndexShardRecovery, error)

SnapshotIndicesRecovery returns status information for each index shard in the server of type SNAPSHOT. This is useful to track the completion of a snapshot restoration process.

type ClusterHealthResponse

type ClusterHealthResponse struct {
	Status             string `json:"status"`
	InitializingShards int    `json:"initializing_shards"`
	UnassignedShards   int    `json:"unassigned_shards"`
}

type DialContextF

type DialContextF func(context.Context, string, string) (net.Conn, error)

type Repository

type Repository struct {
	Name string
	Type string
}

Repository represents a snapshot repository, with a Name and a Type (for now only S3 is supported)

type RestoreSnapshotOpts

type RestoreSnapshotOpts struct {
	WithIndices      []string
	WithoutIndices   []string
	NumberOfReplicas int
}

RestoreSnapshotOpts exposes three options for configuring the RestoreSnapshot request:

  • WithIndices, a list of the indices from the snapshot that need to be restored.
  • WithoutIndices, a list of the indices from the snapshot that need to be skipped.
  • NumberOfReplicas, the number of replicas each primary shard has. Defaults to 1.

func (RestoreSnapshotOpts) IsValid

func (r RestoreSnapshotOpts) IsValid() error

func (RestoreSnapshotOpts) MarshalJSON

func (r RestoreSnapshotOpts) MarshalJSON() ([]byte, error)

MarshalJSON implements the Marshaler interface so that RestoreSnapshotOpts can be easily marshalled.

type Snapshot

type Snapshot struct {
	Name        string
	Indices     []string
	TotalShards int
}

Snapshot represents a snapshot in one of the repositories registered in the server, identified by its name, specifying the list of indices within it and the total number of shards shared among them.

type SnapshotIndexShardRecovery

type SnapshotIndexShardRecovery struct {
	Index   string
	Stage   string
	Percent string
}

SnapshotIndexShardRecovery represents the information returned by the IndicesRecovery request for a single index shard, specifying:

  • Index: the name of the index where this shard lives.
  • Type: the type of the shard, normally "SNAPSHOT" for shards that are being restored from a snapshot.
  • Stage: the current status of the shard. For SNAPSHOT shards, this is either "INDEX", meaning the shard is still being restored, or "DONE", meaning the shard has already been restored.
  • Percent: the percentage of bytes already restored. Note this is not the percentage of files already restored.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL