| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 | [[java-rest-high-snapshot-create-repository]]=== Snapshot Create RepositoryAPIThe Snapshot Create RepositoryAPI allows to register a snapshot repository.[[java-rest-high-snapshot-create-repository-request]]==== Snapshot Create RepositoryRequestA `PutRepositoryRequest`:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-request]--------------------------------------------------==== Repository SettingsSettings requirements will differ based on the repository backend chosen.["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-request-repository-settings]--------------------------------------------------<1> Sets the repository settings==== Providing the SettingsThe settings to be applied can be provided in different ways:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-create-settings]--------------------------------------------------<1> Settings provided as `Settings`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-settings-builder]--------------------------------------------------<1> Settings provided as `Settings.Builder`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-settings-source]--------------------------------------------------<1> Settings provided as `String`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-settings-map]--------------------------------------------------<1> Settings provided as a `Map`==== Required ArgumentsThe following arguments must be provided:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-request-name]--------------------------------------------------<1> The name of the repository["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-request-type]--------------------------------------------------<1> The type of the repository==== Optional ArgumentsThe following arguments can optionally be provided:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-request-timeout]--------------------------------------------------<1> Timeout to wait for the all the nodes to acknowledge the settings were appliedas a `TimeValue`<2> Timeout to wait for the all the nodes to acknowledge the settings were appliedas a `String`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-request-masterTimeout]--------------------------------------------------<1> Timeout to connect to the master node as a `TimeValue`<2> Timeout to connect to the master node as a `String`["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-request-verify]--------------------------------------------------<1> Verify after creation as a `Boolean`[[java-rest-high-snapshot-create-repository-sync]]==== Synchronous Execution["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-execute]--------------------------------------------------[[java-rest-high-snapshot-create-repository-async]]==== Asynchronous ExecutionThe asynchronous execution of a repository put settings requires both the`PutRepositoryRequest` instance and an `ActionListener` instance to bepassed to the asynchronous method:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-execute-async]--------------------------------------------------<1> The `PutRepositoryRequest` to execute and the `ActionListener`to use when the execution completesThe asynchronous method does not block and returns immediately. Once it iscompleted the `ActionListener` is called back using the `onResponse` methodif the execution successfully completed or using the `onFailure` method ifit failed.A typical listener for `PutRepositoryResponse` looks like:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-execute-listener]--------------------------------------------------<1> Called when the execution is successfully completed. The response isprovided as an argument<2> Called in case of a failure. The raised exception is provided as an argument[[java-rest-high-snapshot-create-repository-response]]==== Snapshot Create RepositoryResponseThe returned `PutRepositoryResponse` allows to retrieve information about theexecuted operation as follows:["source","java",subs="attributes,callouts,macros"]--------------------------------------------------include-tagged::{doc-tests}/SnapshotClientDocumentationIT.java[create-repository-response]--------------------------------------------------<1> Indicates the node has acknowledged the request
 |