/usr/share/doc/python-elasticsearch-curator-doc/html/utilities.html is in python-elasticsearch-curator-doc 4.2.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Utility & Helper Methods — Elasticsearch Curator 4.2.5 documentation</title>
<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '4.2.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="top" title="Elasticsearch Curator 4.2.5 documentation" href="index.html" />
<link rel="next" title="Examples" href="examples.html" />
<link rel="prev" title="Filter Methods" href="filters.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="examples.html" title="Examples"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="filters.html" title="Filter Methods"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Elasticsearch Curator 4.2.5 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-curator.utils">
<span id="utility-helper-methods"></span><span id="utilities"></span><h1>Utility & Helper Methods<a class="headerlink" href="#module-curator.utils" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="curator.utils.TimestringSearch">
<em class="property">class </em><code class="descclassname">curator.utils.</code><code class="descname">TimestringSearch</code><span class="sig-paren">(</span><em>timestring</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.TimestringSearch" title="Permalink to this definition">¶</a></dt>
<dd><p>An object to allow repetitive search against a string, <cite>searchme</cite>, without
having to repeatedly recreate the regex.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timestring</strong> – An strftime pattern</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="curator.utils.TimestringSearch.get_epoch">
<code class="descname">get_epoch</code><span class="sig-paren">(</span><em>searchme</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.TimestringSearch.get_epoch" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the epoch timestamp extracted from the <cite>timestring</cite> appearing in
<cite>searchme</cite>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>searchme</strong> – A string to be searched for a date pattern that matches
<cite>timestring</cite></td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#int" title="(in Python v3.5)">int</a></td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="curator.utils.byte_size">
<code class="descclassname">curator.utils.</code><code class="descname">byte_size</code><span class="sig-paren">(</span><em>num</em>, <em>suffix='B'</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.byte_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a formatted string indicating the size in bytes, with the proper
unit, e.g. KB, MB, GB, TB, etc.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>num</strong> – The number of byte</li>
<li><strong>suffix</strong> – An arbitrary suffix, like <cite>Bytes</cite></li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#float" title="(in Python v3.5)">float</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.check_csv">
<code class="descclassname">curator.utils.</code><code class="descname">check_csv</code><span class="sig-paren">(</span><em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.check_csv" title="Permalink to this definition">¶</a></dt>
<dd><p>Some of the curator methods should not operate against multiple indices at
once. This method can be used to check if a list or csv has been sent.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> – The value to test, if list or csv string</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.check_master">
<code class="descclassname">curator.utils.</code><code class="descname">check_master</code><span class="sig-paren">(</span><em>client</em>, <em>master_only=False</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.check_master" title="Permalink to this definition">¶</a></dt>
<dd><p>Check if connected client is the elected master node of the cluster.
If not, cleanly exit with a log message.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/constants.html#None" title="(in Python v3.5)">None</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.check_version">
<code class="descclassname">curator.utils.</code><code class="descname">check_version</code><span class="sig-paren">(</span><em>client</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.check_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Verify version is within acceptable range. Raise an exception if it is not.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/constants.html#None" title="(in Python v3.5)">None</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.chunk_index_list">
<code class="descclassname">curator.utils.</code><code class="descname">chunk_index_list</code><span class="sig-paren">(</span><em>indices</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.chunk_index_list" title="Permalink to this definition">¶</a></dt>
<dd><p>This utility chunks very large index lists into 3KB chunks
It measures the size as a csv string, then converts back into a list
for the return value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>indices</strong> – A list of indices to act on.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#list" title="(in Python v3.5)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.create_repo_body">
<code class="descclassname">curator.utils.</code><code class="descname">create_repo_body</code><span class="sig-paren">(</span><em>repo_type=None</em>, <em>compress=True</em>, <em>chunk_size=None</em>, <em>max_restore_bytes_per_sec=None</em>, <em>max_snapshot_bytes_per_sec=None</em>, <em>location=None</em>, <em>bucket=None</em>, <em>region=None</em>, <em>base_path=None</em>, <em>access_key=None</em>, <em>secret_key=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.create_repo_body" title="Permalink to this definition">¶</a></dt>
<dd><p>Build the ‘body’ portion for use in creating a repository.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>repo_type</strong> – The type of repository (presently only <cite>fs</cite> and <cite>s3</cite>)</li>
<li><strong>compress</strong> – Turn on compression of the snapshot files. Compression is
applied only to metadata files (index mapping and settings). Data files
are not compressed. (Default: <cite>True</cite>)</li>
<li><strong>chunk_size</strong> – The chunk size can be specified in bytes or by using size
value notation, i.e. 1g, 10m, 5k. Defaults to <cite>null</cite> (unlimited chunk
size).</li>
<li><strong>max_restore_bytes_per_sec</strong> – Throttles per node restore rate. Defaults
to <code class="docutils literal"><span class="pre">20mb</span></code> per second.</li>
<li><strong>max_snapshot_bytes_per_sec</strong> – Throttles per node snapshot rate. Defaults
to <code class="docutils literal"><span class="pre">20mb</span></code> per second.</li>
<li><strong>location</strong> – Location of the snapshots. Required.</li>
<li><strong>bucket</strong> – <cite>S3 only.</cite> The name of the bucket to be used for snapshots.
Required.</li>
<li><strong>region</strong> – <cite>S3 only.</cite> The region where bucket is located. Defaults to
<cite>US Standard</cite></li>
<li><strong>base_path</strong> – <cite>S3 only.</cite> Specifies the path within bucket to repository
data. Defaults to value of <code class="docutils literal"><span class="pre">repositories.s3.base_path</span></code> or to root
directory if not set.</li>
<li><strong>access_key</strong> – <cite>S3 only.</cite> The access key to use for authentication.
Defaults to value of <code class="docutils literal"><span class="pre">cloud.aws.access_key</span></code>.</li>
<li><strong>secret_key</strong> – <cite>S3 only.</cite> The secret key to use for authentication.
Defaults to value of <code class="docutils literal"><span class="pre">cloud.aws.secret_key</span></code>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A dictionary suitable for creating a repository from the provided
arguments.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#dict" title="(in Python v3.5)">dict</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.create_repository">
<code class="descclassname">curator.utils.</code><code class="descname">create_repository</code><span class="sig-paren">(</span><em>client</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.create_repository" title="Permalink to this definition">¶</a></dt>
<dd><p>Create repository with repository and body settings</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</li>
<li><strong>repo_type</strong> – The type of repository (presently only <cite>fs</cite> and <cite>s3</cite>)</li>
<li><strong>compress</strong> – Turn on compression of the snapshot files. Compression is
applied only to metadata files (index mapping and settings). Data files
are not compressed. (Default: <cite>True</cite>)</li>
<li><strong>chunk_size</strong> – The chunk size can be specified in bytes or by using size
value notation, i.e. 1g, 10m, 5k. Defaults to <cite>null</cite> (unlimited chunk
size).</li>
<li><strong>max_restore_bytes_per_sec</strong> – Throttles per node restore rate. Defaults
to <code class="docutils literal"><span class="pre">20mb</span></code> per second.</li>
<li><strong>max_snapshot_bytes_per_sec</strong> – Throttles per node snapshot rate. Defaults
to <code class="docutils literal"><span class="pre">20mb</span></code> per second.</li>
<li><strong>location</strong> – Location of the snapshots. Required.</li>
<li><strong>bucket</strong> – <cite>S3 only.</cite> The name of the bucket to be used for snapshots.
Required.</li>
<li><strong>region</strong> – <cite>S3 only.</cite> The region where bucket is located. Defaults to
<cite>US Standard</cite></li>
<li><strong>base_path</strong> – <cite>S3 only.</cite> Specifies the path within bucket to repository
data. Defaults to value of <code class="docutils literal"><span class="pre">repositories.s3.base_path</span></code> or to root
directory if not set.</li>
<li><strong>access_key</strong> – <cite>S3 only.</cite> The access key to use for authentication.
Defaults to value of <code class="docutils literal"><span class="pre">cloud.aws.access_key</span></code>.</li>
<li><strong>secret_key</strong> – <cite>S3 only.</cite> The secret key to use for authentication.
Defaults to value of <code class="docutils literal"><span class="pre">cloud.aws.secret_key</span></code>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A boolean value indicating success or failure.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)">bool</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.create_snapshot_body">
<code class="descclassname">curator.utils.</code><code class="descname">create_snapshot_body</code><span class="sig-paren">(</span><em>indices</em>, <em>ignore_unavailable=False</em>, <em>include_global_state=True</em>, <em>partial=False</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.create_snapshot_body" title="Permalink to this definition">¶</a></dt>
<dd><p>Create the request body for creating a snapshot from the provided
arguments.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>indices</strong> – A single index, or list of indices to snapshot.</li>
<li><strong>ignore_unavailable</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)"><em>bool</em></a>) – Ignore unavailable shards/indices. (default:
<cite>False</cite>)</li>
<li><strong>include_global_state</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)"><em>bool</em></a>) – Store cluster global state with snapshot.
(default: <cite>True</cite>)</li>
<li><strong>partial</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)"><em>bool</em></a>) – Do not fail if primary shard is unavailable. (default:
<cite>False</cite>)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#dict" title="(in Python v3.5)">dict</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.ensure_list">
<code class="descclassname">curator.utils.</code><code class="descname">ensure_list</code><span class="sig-paren">(</span><em>indices</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.ensure_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list, even if indices is a single value</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>indices</strong> – A list of indices to act upon</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#list" title="(in Python v3.5)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.fix_epoch">
<code class="descclassname">curator.utils.</code><code class="descname">fix_epoch</code><span class="sig-paren">(</span><em>epoch</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.fix_epoch" title="Permalink to this definition">¶</a></dt>
<dd><p>Fix value of <cite>epoch</cite> to be epoch, which should be 10 or fewer digits long.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>epoch</strong> – An epoch timestamp, in epoch + milliseconds, or microsecond, or
even nanoseconds.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#int" title="(in Python v3.5)">int</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_client">
<code class="descclassname">curator.utils.</code><code class="descname">get_client</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_client" title="Permalink to this definition">¶</a></dt>
<dd><p>NOTE: AWS IAM parameters <cite>aws_key</cite>, <cite>aws_secret_key</cite>, and <cite>aws_region</cite> are
provided for future compatibility, should AWS ES support the
<code class="docutils literal"><span class="pre">/_cluster/state/metadata</span></code> endpoint. So long as this endpoint does not
function in AWS ES, the client will not be able to use
<a class="reference internal" href="objectclasses.html#curator.indexlist.IndexList" title="curator.indexlist.IndexList"><code class="xref py py-class docutils literal"><span class="pre">curator.indexlist.IndexList</span></code></a>, which is the backbone of Curator 4</p>
<p>Return an <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object using the
provided parameters. Any of the keyword arguments the
<a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object can receive are valid,
such as:</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>hosts</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#list" title="(in Python v3.5)"><em>list</em></a>) – A list of one or more Elasticsearch client hostnames or IP
addresses to connect to. Can send a single host.</li>
<li><strong>port</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#int" title="(in Python v3.5)"><em>int</em></a>) – The Elasticsearch client port to connect to.</li>
<li><strong>url_prefix</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#str" title="(in Python v3.5)"><em>str</em></a>) – <cite>Optional</cite> url prefix, if needed to reach the Elasticsearch
API (i.e., it’s not at the root level)</li>
<li><strong>use_ssl</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)"><em>bool</em></a>) – Whether to connect to the client via SSL/TLS</li>
<li><strong>certificate</strong> – Path to SSL/TLS certificate</li>
<li><strong>client_cert</strong> – Path to SSL/TLS client certificate (public key)</li>
<li><strong>client_key</strong> – Path to SSL/TLS private key</li>
<li><strong>aws_key</strong> – AWS IAM Access Key (Only used if the <code class="xref py py-mod docutils literal"><span class="pre">requests-aws4auth</span></code>
python module is installed)</li>
<li><strong>aws_secret_key</strong> – AWS IAM Secret Access Key (Only used if the
<code class="xref py py-mod docutils literal"><span class="pre">requests-aws4auth</span></code> python module is installed)</li>
<li><strong>aws_region</strong> – AWS Region (Only used if the <code class="xref py py-mod docutils literal"><span class="pre">requests-aws4auth</span></code>
python module is installed)</li>
<li><strong>ssl_no_validate</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)"><em>bool</em></a>) – If <cite>True</cite>, do not validate the certificate
chain. This is an insecure option and you will see warnings in the
log output.</li>
<li><strong>http_auth</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#str" title="(in Python v3.5)"><em>str</em></a>) – Authentication credentials in <cite>user:pass</cite> format.</li>
<li><strong>timeout</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#int" title="(in Python v3.5)"><em>int</em></a>) – Number of seconds before the client will timeout.</li>
<li><strong>master_only</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)"><em>bool</em></a>) – If <cite>True</cite>, the client will <cite>only</cite> connect if the
endpoint is the elected master node of the cluster. <strong>This option does
not work if `hosts` has more than one value.</strong> It will raise an
Exception in that case.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_date_regex">
<code class="descclassname">curator.utils.</code><code class="descname">get_date_regex</code><span class="sig-paren">(</span><em>timestring</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_date_regex" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a regex string based on a provided strftime timestring.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>timestring</strong> – An strftime pattern</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#str" title="(in Python v3.5)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_datetime">
<code class="descclassname">curator.utils.</code><code class="descname">get_datetime</code><span class="sig-paren">(</span><em>index_timestamp</em>, <em>timestring</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_datetime" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the datetime extracted from the index name, which is the index
creation time.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>index_timestamp</strong> – The timestamp extracted from an index name</li>
<li><strong>timestring</strong> – An strftime pattern</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/datetime.html#datetime.datetime" title="(in Python v3.5)"><code class="xref py py-class docutils literal"><span class="pre">datetime.datetime</span></code></a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_indices">
<code class="descclassname">curator.utils.</code><code class="descname">get_indices</code><span class="sig-paren">(</span><em>client</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_indices" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the current list of indices from the cluster.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#list" title="(in Python v3.5)">list</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_point_of_reference">
<code class="descclassname">curator.utils.</code><code class="descname">get_point_of_reference</code><span class="sig-paren">(</span><em>unit</em>, <em>count</em>, <em>epoch=None</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_point_of_reference" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a point-of-reference timestamp in epoch + milliseconds by deriving
from a <cite>unit</cite> and a <cite>count</cite>, and an optional reference timestamp, <cite>epoch</cite></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>unit</strong> – One of <code class="docutils literal"><span class="pre">seconds</span></code>, <code class="docutils literal"><span class="pre">minutes</span></code>, <code class="docutils literal"><span class="pre">hours</span></code>, <code class="docutils literal"><span class="pre">days</span></code>, <code class="docutils literal"><span class="pre">weeks</span></code>,
<code class="docutils literal"><span class="pre">months</span></code>, or <code class="docutils literal"><span class="pre">years</span></code>.</li>
<li><strong>unit_count</strong> – The number of <code class="docutils literal"><span class="pre">units</span></code>. <code class="docutils literal"><span class="pre">unit_count</span></code> * <code class="docutils literal"><span class="pre">unit</span></code> will
be calculated out to the relative number of seconds.</li>
<li><strong>epoch</strong> – An epoch timestamp used in conjunction with <code class="docutils literal"><span class="pre">unit</span></code> and
<code class="docutils literal"><span class="pre">unit_count</span></code> to establish a point of reference for calculations.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#int" title="(in Python v3.5)">int</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_repository">
<code class="descclassname">curator.utils.</code><code class="descname">get_repository</code><span class="sig-paren">(</span><em>client</em>, <em>repository=''</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_repository" title="Permalink to this definition">¶</a></dt>
<dd><p>Return configuration information for the indicated repository.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</li>
<li><strong>repository</strong> – The Elasticsearch snapshot repository to use</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#dict" title="(in Python v3.5)">dict</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_snapshot">
<code class="descclassname">curator.utils.</code><code class="descname">get_snapshot</code><span class="sig-paren">(</span><em>client</em>, <em>repository=None</em>, <em>snapshot=''</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_snapshot" title="Permalink to this definition">¶</a></dt>
<dd><p>Return information about a snapshot (or a comma-separated list of snapshots)
If no snapshot specified, it will return all snapshots. If none exist, an
empty dictionary will be returned.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</li>
<li><strong>repository</strong> – The Elasticsearch snapshot repository to use</li>
<li><strong>snapshot</strong> – The snapshot name, or a comma-separated list of snapshots</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#dict" title="(in Python v3.5)">dict</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_snapshot_data">
<code class="descclassname">curator.utils.</code><code class="descname">get_snapshot_data</code><span class="sig-paren">(</span><em>client</em>, <em>repository=None</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_snapshot_data" title="Permalink to this definition">¶</a></dt>
<dd><p>Get <code class="docutils literal"><span class="pre">_all</span></code> snapshots from repository and return a list.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</li>
<li><strong>repository</strong> – The Elasticsearch snapshot repository to use</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#list" title="(in Python v3.5)">list</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_version">
<code class="descclassname">curator.utils.</code><code class="descname">get_version</code><span class="sig-paren">(</span><em>client</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_version" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the ES version number as a tuple.
Omits trailing tags like -dev, or Beta</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#tuple" title="(in Python v3.5)">tuple</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.get_yaml">
<code class="descclassname">curator.utils.</code><code class="descname">get_yaml</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.get_yaml" title="Permalink to this definition">¶</a></dt>
<dd><p>Read the file identified by <cite>path</cite> and import its YAML contents.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>path</strong> – The path to a YAML configuration file.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#dict" title="(in Python v3.5)">dict</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.is_master_node">
<code class="descclassname">curator.utils.</code><code class="descname">is_master_node</code><span class="sig-paren">(</span><em>client</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.is_master_node" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <cite>True</cite> if the connected client node is the elected master node in
the Elasticsearch cluster, otherwise return <cite>False</cite>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.override_timeout">
<code class="descclassname">curator.utils.</code><code class="descname">override_timeout</code><span class="sig-paren">(</span><em>timeout</em>, <em>action</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.override_timeout" title="Permalink to this definition">¶</a></dt>
<dd><p>Override the default timeout for <cite>forcemerge</cite>, <cite>snapshot</cite>, and <cite>sync_flush</cite>
operations if the default value of <code class="docutils literal"><span class="pre">30</span></code> is provided.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>timeout</strong> – Number of seconds before the client will timeout.</li>
<li><strong>action</strong> – The <cite>action</cite> to be performed.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.parse_date_pattern">
<code class="descclassname">curator.utils.</code><code class="descname">parse_date_pattern</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.parse_date_pattern" title="Permalink to this definition">¶</a></dt>
<dd><p>Scan and parse <cite>name</cite> for <a class="reference external" href="https://docs.python.org/3.5/library/time.html#time.strftime" title="(in Python v3.5)"><code class="xref py py-func docutils literal"><span class="pre">time.strftime()</span></code></a> strings, replacing them
with the associated value when found, but otherwise returning lowercase
values, as uppercase snapshot names are not allowed.</p>
<p>The <a class="reference external" href="https://docs.python.org/3.5/library/time.html#time.strftime" title="(in Python v3.5)"><code class="xref py py-func docutils literal"><span class="pre">time.strftime()</span></code></a> identifiers that Curator currently recognizes
as acceptable include:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">Y</span></code>: A 4 digit year</li>
<li><code class="docutils literal"><span class="pre">y</span></code>: A 2 digit year</li>
<li><code class="docutils literal"><span class="pre">m</span></code>: The 2 digit month</li>
<li><code class="docutils literal"><span class="pre">W</span></code>: The 2 digit week of the year</li>
<li><code class="docutils literal"><span class="pre">d</span></code>: The 2 digit day of the month</li>
<li><code class="docutils literal"><span class="pre">H</span></code>: The 2 digit hour of the day, in 24 hour notation</li>
<li><code class="docutils literal"><span class="pre">M</span></code>: The 2 digit minute of the hour</li>
<li><code class="docutils literal"><span class="pre">S</span></code>: The 2 digit number of second of the minute</li>
<li><code class="docutils literal"><span class="pre">j</span></code>: The 3 digit day of the year</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> – A name, which can contain <a class="reference external" href="https://docs.python.org/3.5/library/time.html#time.strftime" title="(in Python v3.5)"><code class="xref py py-func docutils literal"><span class="pre">time.strftime()</span></code></a>
strings</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.prune_nones">
<code class="descclassname">curator.utils.</code><code class="descname">prune_nones</code><span class="sig-paren">(</span><em>mydict</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.prune_nones" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove keys from <cite>mydict</cite> whose values are <cite>None</cite></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>mydict</strong> – The dictionary to act on</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#dict" title="(in Python v3.5)">dict</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.read_file">
<code class="descclassname">curator.utils.</code><code class="descname">read_file</code><span class="sig-paren">(</span><em>myfile</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.read_file" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a file and return the resulting data.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>myfile</strong> – A file to read.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#str" title="(in Python v3.5)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.report_failure">
<code class="descclassname">curator.utils.</code><code class="descname">report_failure</code><span class="sig-paren">(</span><em>exception</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.report_failure" title="Permalink to this definition">¶</a></dt>
<dd><p>Raise a <cite>FailedExecution</cite> exception and include the original error message.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>exception</strong> – The upstream exception.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/constants.html#None" title="(in Python v3.5)">None</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.repository_exists">
<code class="descclassname">curator.utils.</code><code class="descname">repository_exists</code><span class="sig-paren">(</span><em>client</em>, <em>repository=None</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.repository_exists" title="Permalink to this definition">¶</a></dt>
<dd><p>Verify the existence of a repository</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</li>
<li><strong>repository</strong> – The Elasticsearch snapshot repository to use</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)">bool</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.safe_to_snap">
<code class="descclassname">curator.utils.</code><code class="descname">safe_to_snap</code><span class="sig-paren">(</span><em>client</em>, <em>repository=None</em>, <em>retry_interval=120</em>, <em>retry_count=3</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.safe_to_snap" title="Permalink to this definition">¶</a></dt>
<dd><p>Ensure there are no snapshots in progress. Pause and retry accordingly</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</li>
<li><strong>repository</strong> – The Elasticsearch snapshot repository to use</li>
<li><strong>retry_interval</strong> – Number of seconds to delay betwen retries. Default:
120 (seconds)</li>
<li><strong>retry_count</strong> – Number of attempts to make. Default: 3</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)">bool</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.show_dry_run">
<code class="descclassname">curator.utils.</code><code class="descname">show_dry_run</code><span class="sig-paren">(</span><em>ilo</em>, <em>action</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.show_dry_run" title="Permalink to this definition">¶</a></dt>
<dd><p>Log dry run output with the action which would have been executed.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>ilo</strong> – A <a class="reference internal" href="objectclasses.html#curator.indexlist.IndexList" title="curator.indexlist.IndexList"><code class="xref py py-class docutils literal"><span class="pre">curator.indexlist.IndexList</span></code></a></li>
<li><strong>action</strong> – The <cite>action</cite> to be performed.</li>
<li><strong>kwargs</strong> – Any other args to show in the log output</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.snapshot_in_progress">
<code class="descclassname">curator.utils.</code><code class="descname">snapshot_in_progress</code><span class="sig-paren">(</span><em>client</em>, <em>repository=None</em>, <em>snapshot=None</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.snapshot_in_progress" title="Permalink to this definition">¶</a></dt>
<dd><p>Determine whether the provided snapshot in <cite>repository</cite> is <code class="docutils literal"><span class="pre">IN_PROGRESS</span></code>.
If no value is provided for <cite>snapshot</cite>, then check all of them.
Return <cite>snapshot</cite> if it is found to be in progress, or <cite>False</cite></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</li>
<li><strong>repository</strong> – The Elasticsearch snapshot repository to use</li>
<li><strong>snapshot</strong> – The snapshot name</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.snapshot_running">
<code class="descclassname">curator.utils.</code><code class="descname">snapshot_running</code><span class="sig-paren">(</span><em>client</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.snapshot_running" title="Permalink to this definition">¶</a></dt>
<dd><p>Return <cite>True</cite> if a snapshot is in progress, and <cite>False</cite> if not</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/functions.html#bool" title="(in Python v3.5)">bool</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.test_client_options">
<code class="descclassname">curator.utils.</code><code class="descname">test_client_options</code><span class="sig-paren">(</span><em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.test_client_options" title="Permalink to this definition">¶</a></dt>
<dd><p>Test whether a SSL/TLS files exist. Will raise an exception if the files
cannot be read.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>config</strong> – A client configuration file data dictionary</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/constants.html#None" title="(in Python v3.5)">None</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.test_repo_fs">
<code class="descclassname">curator.utils.</code><code class="descname">test_repo_fs</code><span class="sig-paren">(</span><em>client</em>, <em>repository=None</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.test_repo_fs" title="Permalink to this definition">¶</a></dt>
<dd><p>Test whether all nodes have write access to the repository</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>client</strong> – An <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client object</li>
<li><strong>repository</strong> – The Elasticsearch snapshot repository to use</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.to_csv">
<code class="descclassname">curator.utils.</code><code class="descname">to_csv</code><span class="sig-paren">(</span><em>indices</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.to_csv" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a csv string from a list of indices, or a single value if only one
value is present</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>indices</strong> – A list of indices to act on, or a single value, which could be
in the format of a csv string already.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#str" title="(in Python v3.5)">str</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.validate_actions">
<code class="descclassname">curator.utils.</code><code class="descname">validate_actions</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.validate_actions" title="Permalink to this definition">¶</a></dt>
<dd><p>Validate an Action configuration dictionary, as imported from actions.yml,
for example.</p>
<p>The method returns a validated and sanitized configuration dictionary.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> – The configuration dictionary</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#dict" title="(in Python v3.5)">dict</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.validate_filters">
<code class="descclassname">curator.utils.</code><code class="descname">validate_filters</code><span class="sig-paren">(</span><em>action</em>, <em>filters</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.validate_filters" title="Permalink to this definition">¶</a></dt>
<dd><p>Validate that the filters are appropriate for the action type, e.g. no
index filters applied to a snapshot list.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>action</strong> – An action name</li>
<li><strong>filters</strong> – A list of filters to test.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.verify_client_object">
<code class="descclassname">curator.utils.</code><code class="descname">verify_client_object</code><span class="sig-paren">(</span><em>test</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.verify_client_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if <cite>test</cite> is a proper <a class="reference external" href="http://elasticsearch-py.readthedocs.io/en/2.3.0/api.html#elasticsearch.Elasticsearch" title="(in Elasticsearch v1.6.0)"><code class="xref py py-class docutils literal"><span class="pre">elasticsearch.Elasticsearch</span></code></a> client
object and raise an exception if it is not.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>test</strong> – The variable or object to test</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/constants.html#None" title="(in Python v3.5)">None</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.verify_index_list">
<code class="descclassname">curator.utils.</code><code class="descname">verify_index_list</code><span class="sig-paren">(</span><em>test</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.verify_index_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if <cite>test</cite> is a proper <a class="reference internal" href="objectclasses.html#curator.indexlist.IndexList" title="curator.indexlist.IndexList"><code class="xref py py-class docutils literal"><span class="pre">curator.indexlist.IndexList</span></code></a> object and
raise an exception if it is not.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>test</strong> – The variable or object to test</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/constants.html#None" title="(in Python v3.5)">None</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="curator.utils.verify_snapshot_list">
<code class="descclassname">curator.utils.</code><code class="descname">verify_snapshot_list</code><span class="sig-paren">(</span><em>test</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.utils.verify_snapshot_list" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if <cite>test</cite> is a proper <a class="reference internal" href="objectclasses.html#curator.snapshotlist.SnapshotList" title="curator.snapshotlist.SnapshotList"><code class="xref py py-class docutils literal"><span class="pre">curator.snapshotlist.SnapshotList</span></code></a>
object and raise an exception if it is not.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>test</strong> – The variable or object to test</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference external" href="https://docs.python.org/3.5/library/constants.html#None" title="(in Python v3.5)">None</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="class">
<dt id="curator.SchemaCheck">
<em class="property">class </em><code class="descclassname">curator.</code><code class="descname">SchemaCheck</code><span class="sig-paren">(</span><em>config</em>, <em>schema</em>, <em>test_what</em>, <em>location</em><span class="sig-paren">)</span><a class="headerlink" href="#curator.SchemaCheck" title="Permalink to this definition">¶</a></dt>
<dd><p>Validate <code class="docutils literal"><span class="pre">config</span></code> with the provided voluptuous <code class="docutils literal"><span class="pre">schema</span></code>.
<code class="docutils literal"><span class="pre">test_what</span></code> and <code class="docutils literal"><span class="pre">location</span></code> are for reporting the results, in case of
failure. If validation is successful, the method returns <code class="docutils literal"><span class="pre">config</span></code> as
valid.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>config</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#dict" title="(in Python v3.5)"><em>dict</em></a>) – A configuration dictionary.</li>
<li><strong>schema</strong> (<code class="xref py py-class docutils literal"><span class="pre">voluptuous.Schema</span></code>) – A voluptuous schema definition</li>
<li><strong>test_what</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#str" title="(in Python v3.5)"><em>str</em></a>) – which configuration block is being validated</li>
<li><strong>location</strong> (<a class="reference external" href="https://docs.python.org/3.5/library/stdtypes.html#str" title="(in Python v3.5)"><em>str</em></a>) – An string to report which configuration sub-block is
being tested.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="filters.html"
title="previous chapter">Filter Methods</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="examples.html"
title="next chapter">Examples</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/utilities.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="examples.html" title="Examples"
>next</a> |</li>
<li class="right" >
<a href="filters.html" title="Filter Methods"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">Elasticsearch Curator 4.2.5 documentation</a> »</li>
</ul>
</div>
<div class="footer" role="contentinfo">
© Copyright 2011-2017, Elasticsearch.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9.
</div>
</body>
</html>
|