Class CreateSnapshotRequest
- java.lang.Object
-
- org.elasticsearch.transport.TransportMessage
-
- org.elasticsearch.transport.TransportRequest
-
- org.elasticsearch.action.ActionRequest
-
- org.elasticsearch.action.support.master.MasterNodeRequest<CreateSnapshotRequest>
-
- org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest
-
- All Implemented Interfaces:
IndicesRequest
,IndicesRequest.Replaceable
,Streamable
,Writeable
,ToXContent
,ToXContentObject
,TaskAwareRequest
public class CreateSnapshotRequest extends MasterNodeRequest<CreateSnapshotRequest> implements IndicesRequest.Replaceable, ToXContentObject
Create snapshot requestThe only mandatory parameter is repository name. The repository name has to satisfy the following requirements
- be a non-empty string
- must not contain whitespace (tabs or spaces)
- must not contain comma (',')
- must not contain hash sign ('#')
- must not start with underscore ('-')
- must be lowercase
- must not contain invalid file name characters
Strings.INVALID_FILENAME_CHARS
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.transport.TransportRequest
TransportRequest.Empty
-
Nested classes/interfaces inherited from interface org.elasticsearch.action.IndicesRequest
IndicesRequest.Replaceable
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
-
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V>
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
DEFAULT_MASTER_NODE_TIMEOUT, masterNodeTimeout
-
Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent
EMPTY_PARAMS
-
-
Constructor Summary
Constructors Constructor Description CreateSnapshotRequest()
CreateSnapshotRequest(java.lang.String repository, java.lang.String snapshot)
Constructs a new put repository request with the provided snapshot and repository names
-
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getDescription()
Returns optional description of the request to be displayed by the task managerint
hashCode()
boolean
includeGlobalState()
Returns true if global state should be stored as part of the snapshotCreateSnapshotRequest
includeGlobalState(boolean includeGlobalState)
Set to true if global state should be stored as part of the snapshotjava.lang.String[]
indices()
Returns a list of indices that should be included into the snapshotCreateSnapshotRequest
indices(java.lang.String... indices)
Sets a list of indices that should be included into the snapshotCreateSnapshotRequest
indices(java.util.List<java.lang.String> indices)
Sets a list of indices that should be included into the snapshotIndicesOptions
indicesOptions()
Specifies the indices options.CreateSnapshotRequest
indicesOptions(IndicesOptions indicesOptions)
Specifies the indices options.boolean
partial()
Returns true if indices with unavailable shards should be be partially snapshotted.CreateSnapshotRequest
partial(boolean partial)
Set to true to allow indices with unavailable shards to be partially snapshotted.void
readFrom(StreamInput in)
Set this object's fields from a StreamInput.java.lang.String
repository()
Returns repository nameCreateSnapshotRequest
repository(java.lang.String repository)
Sets repository nameSettings
settings()
Returns repository-specific snapshot settingsCreateSnapshotRequest
settings(java.lang.String source, XContentType xContentType)
Sets repository-specific snapshot settings in JSON or YAML formatCreateSnapshotRequest
settings(java.util.Map<java.lang.String,java.lang.Object> source)
Sets repository-specific snapshot settings.CreateSnapshotRequest
settings(Settings settings)
Sets repository-specific snapshot settings.CreateSnapshotRequest
settings(Settings.Builder settings)
Sets repository-specific snapshot settings.java.lang.String
snapshot()
The snapshot nameCreateSnapshotRequest
snapshot(java.lang.String snapshot)
Sets the snapshot nameCreateSnapshotRequest
source(java.util.Map<java.lang.String,java.lang.Object> source)
Parses snapshot definition.java.lang.String
toString()
XContentBuilder
toXContent(XContentBuilder builder, ToXContent.Params params)
ActionRequestValidationException
validate()
boolean
waitForCompletion()
Returns true if the request should wait for the snapshot completion before returningCreateSnapshotRequest
waitForCompletion(boolean waitForCompletion)
If set to true the operation should wait for the snapshot completion before returning.void
writeTo(StreamOutput out)
Write this object's fields to a StreamOutput.-
Methods inherited from class org.elasticsearch.action.support.master.MasterNodeRequest
masterNodeTimeout, masterNodeTimeout, masterNodeTimeout
-
Methods inherited from class org.elasticsearch.action.ActionRequest
getShouldStoreResult
-
Methods inherited from class org.elasticsearch.transport.TransportRequest
getParentTask, setParentTask
-
Methods inherited from class org.elasticsearch.transport.TransportMessage
remoteAddress, remoteAddress
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.tasks.TaskAwareRequest
createTask, setParentTask
-
Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject
isFragment
-
-
-
-
Constructor Detail
-
CreateSnapshotRequest
public CreateSnapshotRequest()
-
CreateSnapshotRequest
public CreateSnapshotRequest(java.lang.String repository, java.lang.String snapshot)
Constructs a new put repository request with the provided snapshot and repository names- Parameters:
repository
- repository namesnapshot
- snapshot name
-
-
Method Detail
-
validate
public ActionRequestValidationException validate()
- Specified by:
validate
in classActionRequest
-
snapshot
public CreateSnapshotRequest snapshot(java.lang.String snapshot)
Sets the snapshot name- Parameters:
snapshot
- snapshot name
-
snapshot
public java.lang.String snapshot()
The snapshot name- Returns:
- snapshot name
-
repository
public CreateSnapshotRequest repository(java.lang.String repository)
Sets repository name- Parameters:
repository
- name- Returns:
- this request
-
repository
public java.lang.String repository()
Returns repository name- Returns:
- repository name
-
indices
public CreateSnapshotRequest indices(java.lang.String... indices)
Sets a list of indices that should be included into the snapshotThe list of indices supports multi-index syntax. For example: "+test*" ,"-test42" will index all indices with prefix "test" except index "test42". Aliases are supported. An empty list or {"_all"} will snapshot all open indices in the cluster.
- Specified by:
indices
in interfaceIndicesRequest.Replaceable
- Returns:
- this request
-
indices
public CreateSnapshotRequest indices(java.util.List<java.lang.String> indices)
Sets a list of indices that should be included into the snapshotThe list of indices supports multi-index syntax. For example: "+test*" ,"-test42" will index all indices with prefix "test" except index "test42". Aliases are supported. An empty list or {"_all"} will snapshot all open indices in the cluster.
- Returns:
- this request
-
indices
public java.lang.String[] indices()
Returns a list of indices that should be included into the snapshot- Specified by:
indices
in interfaceIndicesRequest
- Returns:
- list of indices
-
indicesOptions
public IndicesOptions indicesOptions()
Specifies the indices options. Like what type of requested indices to ignore. For example indices that don't exist.- Specified by:
indicesOptions
in interfaceIndicesRequest
- Returns:
- the desired behaviour regarding indices options
-
indicesOptions
public CreateSnapshotRequest indicesOptions(IndicesOptions indicesOptions)
Specifies the indices options. Like what type of requested indices to ignore. For example indices that don't exist.- Parameters:
indicesOptions
- the desired behaviour regarding indices options- Returns:
- this request
-
partial
public boolean partial()
Returns true if indices with unavailable shards should be be partially snapshotted.- Returns:
- the desired behaviour regarding indices options
-
partial
public CreateSnapshotRequest partial(boolean partial)
Set to true to allow indices with unavailable shards to be partially snapshotted.- Parameters:
partial
- true if indices with unavailable shards should be be partially snapshotted.- Returns:
- this request
-
waitForCompletion
public CreateSnapshotRequest waitForCompletion(boolean waitForCompletion)
If set to true the operation should wait for the snapshot completion before returning. By default, the operation will return as soon as snapshot is initialized. It can be changed by setting this flag to true.- Parameters:
waitForCompletion
- true if operation should wait for the snapshot completion- Returns:
- this request
-
waitForCompletion
public boolean waitForCompletion()
Returns true if the request should wait for the snapshot completion before returning- Returns:
- true if the request should wait for completion
-
settings
public CreateSnapshotRequest settings(Settings settings)
Sets repository-specific snapshot settings.See repository documentation for more information.
- Parameters:
settings
- repository-specific snapshot settings- Returns:
- this request
-
settings
public CreateSnapshotRequest settings(Settings.Builder settings)
Sets repository-specific snapshot settings.See repository documentation for more information.
- Parameters:
settings
- repository-specific snapshot settings- Returns:
- this request
-
settings
public CreateSnapshotRequest settings(java.lang.String source, XContentType xContentType)
Sets repository-specific snapshot settings in JSON or YAML formatSee repository documentation for more information.
- Parameters:
source
- repository-specific snapshot settingsxContentType
- the content type of the source- Returns:
- this request
-
settings
public CreateSnapshotRequest settings(java.util.Map<java.lang.String,java.lang.Object> source)
Sets repository-specific snapshot settings.See repository documentation for more information.
- Parameters:
source
- repository-specific snapshot settings- Returns:
- this request
-
settings
public Settings settings()
Returns repository-specific snapshot settings- Returns:
- repository-specific snapshot settings
-
includeGlobalState
public CreateSnapshotRequest includeGlobalState(boolean includeGlobalState)
Set to true if global state should be stored as part of the snapshot- Parameters:
includeGlobalState
- true if global state should be stored- Returns:
- this request
-
includeGlobalState
public boolean includeGlobalState()
Returns true if global state should be stored as part of the snapshot- Returns:
- true if global state should be stored as part of the snapshot
-
source
public CreateSnapshotRequest source(java.util.Map<java.lang.String,java.lang.Object> source)
Parses snapshot definition.- Parameters:
source
- snapshot definition- Returns:
- this request
-
toXContent
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
- Specified by:
toXContent
in interfaceToXContent
- Throws:
java.io.IOException
-
readFrom
public void readFrom(StreamInput in) throws java.io.IOException
Description copied from interface:Streamable
Set this object's fields from a StreamInput.- Specified by:
readFrom
in interfaceStreamable
- Overrides:
readFrom
in classMasterNodeRequest<CreateSnapshotRequest>
- Throws:
java.io.IOException
-
writeTo
public void writeTo(StreamOutput out) throws java.io.IOException
Description copied from interface:Streamable
Write this object's fields to a StreamOutput.- Specified by:
writeTo
in interfaceStreamable
- Specified by:
writeTo
in interfaceWriteable
- Overrides:
writeTo
in classMasterNodeRequest<CreateSnapshotRequest>
- Throws:
java.io.IOException
-
getDescription
public java.lang.String getDescription()
Description copied from interface:TaskAwareRequest
Returns optional description of the request to be displayed by the task manager- Specified by:
getDescription
in interfaceTaskAwareRequest
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-