-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3b0eefc
Showing
104 changed files
with
11,644 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: dbb31dc7b860cc58cb924d49dccdac0a | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en" data-content_root="../"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>backup — sophosfirewall-python 0.0.1 documentation</title> | ||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=fa44fd50" /> | ||
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=19f00094" /> | ||
|
||
|
||
<!--[if lt IE 9]> | ||
<script src="../_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
<script src="../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script src="../_static/documentation_options.js?v=d45e8c67"></script> | ||
<script src="../_static/doctools.js?v=9a2dae69"></script> | ||
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script> | ||
<script src="../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../genindex.html" /> | ||
<link rel="search" title="Search" href="../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" > | ||
|
||
|
||
|
||
<a href="../index.html" class="icon icon-home"> | ||
sophosfirewall-python | ||
</a> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../usage.html">Usage</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../examples.html">Examples</a></li> | ||
<li class="toctree-l1"><a class="reference internal" href="../modules.html">sophosfirewall_python</a></li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../index.html">sophosfirewall-python</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">backup</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for backup</h1><div class="highlight"><pre> | ||
<span></span><span class="sd">"""</span> | ||
<span class="sd">Copyright 2023 Sophos Ltd. All rights reserved.</span> | ||
<span class="sd">Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.</span> | ||
<span class="sd">You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0</span> | ||
<span class="sd">Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,</span> | ||
<span class="sd">WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing</span> | ||
<span class="sd">permissions and limitations under the License.</span> | ||
<span class="sd">"""</span> | ||
|
||
|
||
<div class="viewcode-block" id="Backup"> | ||
<a class="viewcode-back" href="../backup.html#backup.Backup">[docs]</a> | ||
<span class="k">class</span> <span class="nc">Backup</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""Class for working with Backup settings."""</span> | ||
|
||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">api_client</span><span class="p">):</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">client</span> <span class="o">=</span> <span class="n">api_client</span> | ||
|
||
<div class="viewcode-block" id="Backup.get"> | ||
<a class="viewcode-back" href="../backup.html#backup.Backup.get">[docs]</a> | ||
<span class="k">def</span> <span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""Get backup details.</span> | ||
|
||
<span class="sd"> Args:</span> | ||
<span class="sd"> name (str, optional): Name of backup schedule. Returns all if not specified.</span> | ||
|
||
<span class="sd"> Returns:</span> | ||
<span class="sd"> dict: XML response converted to Python dictionary</span> | ||
<span class="sd"> """</span> | ||
<span class="k">if</span> <span class="n">name</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get_tag_with_filter</span><span class="p">(</span> | ||
<span class="n">xml_tag</span><span class="o">=</span><span class="s2">"BackupRestore"</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="s2">"Name"</span><span class="p">,</span> <span class="n">value</span><span class="o">=</span><span class="n">name</span> | ||
<span class="p">)</span> | ||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">get_tag</span><span class="p">(</span><span class="n">xml_tag</span><span class="o">=</span><span class="s2">"BackupRestore"</span><span class="p">)</span></div> | ||
|
||
|
||
<div class="viewcode-block" id="Backup.update"> | ||
<a class="viewcode-back" href="../backup.html#backup.Backup.update">[docs]</a> | ||
<span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">backup_params</span><span class="p">,</span> <span class="n">debug</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""Updates scheduled backup settings</span> | ||
|
||
<span class="sd"> Args:</span> | ||
<span class="sd"> backup_params (dict): Dict containing backup settings</span> | ||
<span class="sd"> debug (bool, optional): Enable debug mode. Defaults to False.</span> | ||
|
||
<span class="sd"> Keyword Args:</span> | ||
<span class="sd"> BackupMode (str): Backup mode (FTP/Mail/Local)</span> | ||
<span class="sd"> BackupPrefix (str): Backup Prefix</span> | ||
<span class="sd"> FTPServer (str, optional): FTP Server IP Address</span> | ||
<span class="sd"> Username (str, optional): FTP Server username</span> | ||
<span class="sd"> Password (str, optional): FTP Server password</span> | ||
<span class="sd"> FtpPath (str, optional): FTP Server path</span> | ||
<span class="sd"> EmailAddress (str): Email address</span> | ||
<span class="sd"> BackupFrequency (str): Never/Daily/Weekly/Monthly</span> | ||
<span class="sd"> Day (str): Day</span> | ||
<span class="sd"> Hour (str): Hour</span> | ||
<span class="sd"> Minute (str): Minute</span> | ||
<span class="sd"> Date (str): Numeric representation of month</span> | ||
<span class="sd"> EncryptionPassword (str, optional): Encryption password</span> | ||
|
||
<span class="sd"> Returns:</span> | ||
<span class="sd"> dict: XML response converted to Python dictionary</span> | ||
<span class="sd"> """</span> | ||
<span class="n">updated_params</span> <span class="o">=</span> <span class="p">{}</span> | ||
<span class="n">current_params</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get</span><span class="p">()[</span><span class="s2">"Response"</span><span class="p">][</span><span class="s2">"BackupRestore"</span><span class="p">][</span><span class="s2">"ScheduleBackup"</span><span class="p">]</span> | ||
<span class="k">for</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">current_params</span><span class="p">:</span> | ||
<span class="k">if</span> <span class="n">param</span> <span class="ow">in</span> <span class="n">backup_params</span><span class="p">:</span> | ||
<span class="n">updated_params</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> <span class="o">=</span> <span class="n">backup_params</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> | ||
<span class="k">else</span><span class="p">:</span> | ||
<span class="n">updated_params</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> <span class="o">=</span> <span class="n">current_params</span><span class="p">[</span><span class="n">param</span><span class="p">]</span> | ||
|
||
<span class="n">resp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">client</span><span class="o">.</span><span class="n">submit_template</span><span class="p">(</span> | ||
<span class="s2">"updatebackup.j2"</span><span class="p">,</span> <span class="n">template_vars</span><span class="o">=</span><span class="n">updated_params</span><span class="p">,</span> <span class="n">debug</span><span class="o">=</span><span class="n">debug</span> | ||
<span class="p">)</span> | ||
<span class="k">return</span> <span class="n">resp</span></div> | ||
</div> | ||
|
||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2023, Sophos Ltd. All Rights Reserved..</p> | ||
</div> | ||
|
||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a | ||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> | ||
provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.