create

package
v8.14.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Creates a snapshot in a repository.

Index

Constants

This section is empty.

Variables

View Source
var ErrBuildPath = errors.New("cannot build path, check for missing path parameters")

ErrBuildPath is returned in case of missing parameters within the build of the request.

Functions

This section is empty.

Types

type Create

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

func (Create) Do

func (r Create) Do(providedCtx context.Context) (*Response, error)

Do runs the request through the transport, handle the response and returns a create.Response

func (*Create) FeatureStates

func (r *Create) FeatureStates(featurestates ...string) *Create

FeatureStates Feature states to include in the snapshot. Each feature state includes one or more system indices containing related data. You can view a list of eligible features using the get features API. If `include_global_state` is `true`, all current feature states are included by default. If `include_global_state` is `false`, no feature states are included by default. API name: feature_states

func (*Create) Header

func (r *Create) Header(key, value string) *Create

Header set a key, value pair in the Create headers map.

func (*Create) HttpRequest

func (r *Create) HttpRequest(ctx context.Context) (*http.Request, error)

HttpRequest returns the http.Request object built from the given parameters.

func (*Create) IgnoreUnavailable

func (r *Create) IgnoreUnavailable(ignoreunavailable bool) *Create

IgnoreUnavailable If `true`, the request ignores data streams and indices in `indices` that are missing or closed. If `false`, the request returns an error for any data stream or index that is missing or closed. API name: ignore_unavailable

func (*Create) IncludeGlobalState

func (r *Create) IncludeGlobalState(includeglobalstate bool) *Create

IncludeGlobalState If `true`, the current cluster state is included in the snapshot. The cluster state includes persistent cluster settings, composable index templates, legacy index templates, ingest pipelines, and ILM policies. It also includes data stored in system indices, such as Watches and task records (configurable via `feature_states`). API name: include_global_state

func (*Create) Indices

func (r *Create) Indices(indices ...string) *Create

Indices Data streams and indices to include in the snapshot. Supports multi-target syntax. Includes all data streams and indices by default. API name: indices

func (*Create) MasterTimeout

func (r *Create) MasterTimeout(duration string) *Create

MasterTimeout Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. API name: master_timeout

func (*Create) Metadata

func (r *Create) Metadata(metadata types.Metadata) *Create

Metadata Optional metadata for the snapshot. May have any contents. Must be less than 1024 bytes. This map is not automatically generated by Elasticsearch. API name: metadata

func (*Create) Partial

func (r *Create) Partial(partial bool) *Create

Partial If `true`, allows restoring a partial snapshot of indices with unavailable shards. Only shards that were successfully included in the snapshot will be restored. All missing shards will be recreated as empty. If `false`, the entire restore operation will fail if one or more indices included in the snapshot do not have all primary shards available. API name: partial

func (Create) Perform

func (r Create) Perform(providedCtx context.Context) (*http.Response, error)

Perform runs the http.Request through the provided transport and returns an http.Response.

func (*Create) Raw

func (r *Create) Raw(raw io.Reader) *Create

Raw takes a json payload as input which is then passed to the http.Request If specified Raw takes precedence on Request method.

func (*Create) Request

func (r *Create) Request(req *Request) *Create

Request allows to set the request property with the appropriate payload.

func (*Create) WaitForCompletion

func (r *Create) WaitForCompletion(waitforcompletion bool) *Create

WaitForCompletion If `true`, the request returns a response when the snapshot is complete. If `false`, the request returns a response when the snapshot initializes. API name: wait_for_completion

type NewCreate

type NewCreate func(repository, snapshot string) *Create

NewCreate type alias for index.

func NewCreateFunc

func NewCreateFunc(tp elastictransport.Interface) NewCreate

NewCreateFunc returns a new instance of Create with the provided transport. Used in the index of the library this allows to retrieve every apis in once place.

type Request

type Request struct {

	// FeatureStates Feature states to include in the snapshot. Each feature state includes one or
	// more system indices containing related data. You can view a list of eligible
	// features using the get features API. If `include_global_state` is `true`, all
	// current feature states are included by default. If `include_global_state` is
	// `false`, no feature states are included by default.
	FeatureStates []string `json:"feature_states,omitempty"`
	// IgnoreUnavailable If `true`, the request ignores data streams and indices in `indices` that are
	// missing or closed. If `false`, the request returns an error for any data
	// stream or index that is missing or closed.
	IgnoreUnavailable *bool `json:"ignore_unavailable,omitempty"`
	// IncludeGlobalState If `true`, the current cluster state is included in the snapshot. The cluster
	// state includes persistent cluster settings, composable index templates,
	// legacy index templates, ingest pipelines, and ILM policies. It also includes
	// data stored in system indices, such as Watches and task records (configurable
	// via `feature_states`).
	IncludeGlobalState *bool `json:"include_global_state,omitempty"`
	// Indices Data streams and indices to include in the snapshot. Supports multi-target
	// syntax. Includes all data streams and indices by default.
	Indices []string `json:"indices,omitempty"`
	// Metadata Optional metadata for the snapshot. May have any contents. Must be less than
	// 1024 bytes. This map is not automatically generated by Elasticsearch.
	Metadata types.Metadata `json:"metadata,omitempty"`
	// Partial If `true`, allows restoring a partial snapshot of indices with unavailable
	// shards. Only shards that were successfully included in the snapshot will be
	// restored. All missing shards will be recreated as empty. If `false`, the
	// entire restore operation will fail if one or more indices included in the
	// snapshot do not have all primary shards available.
	Partial *bool `json:"partial,omitempty"`
}

Request holds the request body struct for the package create

https://github.com/elastic/elasticsearch-specification/blob/5fb8f1ce9c4605abcaa44aa0f17dbfc60497a757/specification/snapshot/create/SnapshotCreateRequest.ts#L24-L81

func NewRequest

func NewRequest() *Request

NewRequest returns a Request

func (*Request) FromJSON

func (r *Request) FromJSON(data string) (*Request, error)

FromJSON allows to load an arbitrary json into the request structure

func (*Request) UnmarshalJSON

func (s *Request) UnmarshalJSON(data []byte) error

type Response

type Response struct {

	// Accepted Equals `true` if the snapshot was accepted. Present when the request had
	// `wait_for_completion` set to `false`
	Accepted *bool `json:"accepted,omitempty"`
	// Snapshot Snapshot information. Present when the request had `wait_for_completion` set
	// to `true`
	Snapshot *types.SnapshotInfo `json:"snapshot,omitempty"`
}

Response holds the response body struct for the package create

https://github.com/elastic/elasticsearch-specification/blob/5fb8f1ce9c4605abcaa44aa0f17dbfc60497a757/specification/snapshot/create/SnapshotCreateResponse.ts#L22-L35

func NewResponse

func NewResponse() *Response

NewResponse returns a Response

Jump to

Keyboard shortcuts

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