summaryrefslogtreecommitdiffstats
path: root/ansible_collections/netapp/aws
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/netapp/aws')
-rw-r--r--ansible_collections/netapp/aws/.github/ISSUE_TEMPLATE/bug_report.yml210
-rw-r--r--ansible_collections/netapp/aws/.github/ISSUE_TEMPLATE/feature_request.yml100
-rw-r--r--ansible_collections/netapp/aws/.github/workflows/coverage.yml45
-rw-r--r--ansible_collections/netapp/aws/.github/workflows/main.yml45
-rw-r--r--ansible_collections/netapp/aws/CHANGELOG.rst90
-rw-r--r--ansible_collections/netapp/aws/COPYING674
-rw-r--r--ansible_collections/netapp/aws/FILES.json376
-rw-r--r--ansible_collections/netapp/aws/MANIFEST.json35
-rw-r--r--ansible_collections/netapp/aws/README.md86
-rw-r--r--ansible_collections/netapp/aws/changelogs/changelog.yaml81
-rw-r--r--ansible_collections/netapp/aws/changelogs/config.yaml32
-rw-r--r--ansible_collections/netapp/aws/changelogs/fragments/20.2.0.yaml2
-rw-r--r--ansible_collections/netapp/aws/changelogs/fragments/20.6.0.yaml2
-rw-r--r--ansible_collections/netapp/aws/changelogs/fragments/20.8.0.yaml3
-rw-r--r--ansible_collections/netapp/aws/changelogs/fragments/20.9.0.yaml2
-rw-r--r--ansible_collections/netapp/aws/changelogs/fragments/2019.10.0.yaml2
-rw-r--r--ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-3569.yaml4
-rw-r--r--ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-3644.yaml5
-rw-r--r--ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-4416.yaml2
-rw-r--r--ansible_collections/netapp/aws/meta/runtime.yml8
-rw-r--r--ansible_collections/netapp/aws/plugins/doc_fragments/netapp.py55
-rw-r--r--ansible_collections/netapp/aws/plugins/module_utils/netapp.py241
-rw-r--r--ansible_collections/netapp/aws/plugins/module_utils/netapp_module.py142
-rw-r--r--ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_active_directory.py276
-rw-r--r--ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_filesystems.py362
-rw-r--r--ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_pool.py267
-rw-r--r--ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_snapshots.py245
-rw-r--r--ansible_collections/netapp/aws/requirements.txt1
-rw-r--r--ansible_collections/netapp/aws/tests/unit/compat/__init__.py0
-rw-r--r--ansible_collections/netapp/aws/tests/unit/compat/builtins.py33
-rw-r--r--ansible_collections/netapp/aws/tests/unit/compat/mock.py122
-rw-r--r--ansible_collections/netapp/aws/tests/unit/compat/unittest.py44
-rw-r--r--ansible_collections/netapp/aws/tests/unit/plugins/module_utils/test_netapp.py195
-rw-r--r--ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_active_directory.py117
-rw-r--r--ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_filesystems.py155
-rw-r--r--ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_pool.py258
-rw-r--r--ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_snapshots.py147
-rw-r--r--ansible_collections/netapp/aws/tests/unit/requirements.txt1
38 files changed, 4465 insertions, 0 deletions
diff --git a/ansible_collections/netapp/aws/.github/ISSUE_TEMPLATE/bug_report.yml b/ansible_collections/netapp/aws/.github/ISSUE_TEMPLATE/bug_report.yml
new file mode 100644
index 00000000..2767dba5
--- /dev/null
+++ b/ansible_collections/netapp/aws/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -0,0 +1,210 @@
+---
+name: 🐛 Bug report
+description: Create a report to help us improve
+
+body:
+- type: markdown
+ attributes:
+ value: >
+ **Thank you for wanting to report a bug in netapp.aws!**
+
+
+ ⚠
+ Verify first that your issue is not [already reported on
+ GitHub][issue search] and keep in mind that we may have to keep
+ the current behavior because [every change breaks someone's
+ workflow][XKCD 1172].
+ We try to be mindful about this.
+
+ Also test if the latest release and devel branch are affected too.
+
+
+ **Tip:** If you are seeking community support, please consider
+ [Join our Slack community][ML||IRC].
+
+
+
+ [ML||IRC]:
+ https://join.slack.com/t/netapppub/shared_invite/zt-njcjx2sh-1VR2mEDvPcJAmPutOnP~mg
+
+ [issue search]: ../search?q=is%3Aissue&type=issues
+
+ [XKCD 1172]: https://xkcd.com/1172/
+
+
+- type: textarea
+ attributes:
+ label: Summary
+ description: Explain the problem briefly below.
+ placeholder: >-
+ When I try to do X with netapp.aws from the devel branch on GitHub, Y
+ breaks in a way Z under the env E. Here are all the details I know
+ about this problem...
+ validations:
+ required: true
+
+- type: input
+ attributes:
+ label: Component Name
+ description: >
+ Write the short name of the rst file, module, plugin, task or
+ feature below, *use your best guess if unsure*.
+
+
+ **Tip:** Cannot find it in this repository? Please be advised that
+ the source for some parts of the documentation are hosted outside
+ of this repository. If the page you are reporting describes
+ modules/plugins/etc that are not officially supported by the
+ Ansible Core Engineering team, there is a good chance that it is
+ coming from one of the [Ansible Collections maintained by the
+ community][collections org]. If this is the case, please make sure
+ to file an issue under the appropriate project there instead.
+
+
+ [collections org]: /ansible-collections
+ placeholder: dnf, apt, yum, pip, user etc.
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Ansible Version
+ description: >-
+ Paste verbatim output from `ansible --version` below, under
+ the prompt line. Please don't wrap it with tripple backticks — your
+ whole input will be turned into a code snippet automatically.
+ render: console
+ value: |
+ $ ansible --version
+ placeholder: |
+ $ ansible --version
+ ansible [core 2.11.0b4.post0] (detached HEAD ref: refs/) last updated 2021/04/02 00:33:35 (GMT +200)
+ config file = None
+ configured module search path = ['~/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
+ ansible python module location = ~/src/github/ansible/ansible/lib/ansible
+ ansible collection location = ~/.ansible/collections:/usr/share/ansible/collections
+ executable location = bin/ansible
+ python version = 3.9.0 (default, Oct 26 2020, 13:08:59) [GCC 10.2.0]
+ jinja version = 2.11.3
+ libyaml = True
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: CVS for AWS Collection Version
+ description: >-
+ CVS for AWS Collection Version. Run `ansible-galaxy collection` and copy the entire output
+ render: console
+ value: |
+ $ ansible-galaxy collection list
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Playbook
+ description: >-
+ The task from the playbook that is give you the issue
+ render: console
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Steps to Reproduce
+ description: |
+ Describe exactly how to reproduce the problem, using a minimal test-case. It would *really* help us understand your problem if you could also pased any playbooks, configs and commands you used.
+
+ **HINT:** You can paste https://gist.github.com links for larger files.
+ value: |
+ <!--- Paste example playbooks or commands between quotes below -->
+ ```yaml (paste below)
+
+ ```
+ placeholder: |
+ 1. Implement the following playbook:
+
+ ```yaml
+ ---
+ # ping.yml
+ - hosts: all
+ gather_facts: false
+ tasks:
+ - ping:
+ ...
+ ```
+ 2. Then run `ANSIBLE_DEBUG=1 ansible-playbook ping.yml -vvvvv`
+ 3. An error occurs.
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Expected Results
+ description: >-
+ Describe what you expected to happen when running the steps above.
+ placeholder: >-
+ I expected X to happen because I assumed Y and was shocked
+ that it did not.
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Actual Results
+ description: |
+ Describe what actually happened. If possible run with extra verbosity (`-vvvv`).
+
+ Paste verbatim command output and don't wrap it with tripple backticks — your
+ whole input will be turned into a code snippet automatically.
+ render: console
+ placeholder: >-
+ Certificate did not match expected hostname: files.pythonhosted.org. Certificate: {'notAfter': 'Apr 28 19:20:25 2021 GMT', 'subjectAltName': ((u'DNS', 'r.ssl.fastly.net'), (u'DNS', '*.catchpoint.com'), (u'DNS', '*.cnn.io'), (u'DNS', '*.dollarshaveclub.com'), (u'DNS', '*.eater.com'), (u'DNS', '*.fastly.picmonkey.com'), (u'DNS', '*.files.saymedia-content.com'), (u'DNS', '*.ft.com'), (u'DNS', '*.meetupstatic.com'), (u'DNS', '*.nfl.com'), (u'DNS', '*.pagar.me'), (u'DNS', '*.picmonkey.com'), (u'DNS', '*.realself.com'), (u'DNS', '*.sbnation.com'), (u'DNS', '*.shakr.com'), (u'DNS', '*.streamable.com'), (u'DNS', '*.surfly.com'), (u'DNS', '*.theverge.com'), (u'DNS', '*.thrillist.com'), (u'DNS', '*.vox-cdn.com'), (u'DNS', '*.vox.com'), (u'DNS', '*.voxmedia.com'), (u'DNS', 'eater.com'), (u'DNS', 'ft.com'), (u'DNS', 'i.gse.io'), (u'DNS', 'picmonkey.com'), (u'DNS', 'realself.com'), (u'DNS', 'static.wixstatic.com'), (u'DNS', 'streamable.com'), (u'DNS', 'surfly.com'), (u'DNS', 'theverge.com'), (u'DNS', 'vox-cdn.com'), (u'DNS', 'vox.com'), (u'DNS', 'www.joyent.com')), 'subject': ((('countryName', u'US'),), (('stateOrProvinceName', u'California'),), (('localityName', u'San Francisco'),), (('organizationName', u'Fastly, Inc'),), (('commonName', u'r.ssl.fastly.net'),))}
+ Exception:
+ Traceback (most recent call last):
+ File "/usr/local/lib/python2.6/dist-packages/pip/basecommand.py", line 215, in main
+ status = self.run(options, args)
+ File "/usr/local/lib/python2.6/dist-packages/pip/commands/install.py", line 335, in run
+ wb.build(autobuilding=True)
+ File "/usr/local/lib/python2.6/dist-packages/pip/wheel.py", line 749, in build
+ self.requirement_set.prepare_files(self.finder)
+ File "/usr/local/lib/python2.6/dist-packages/pip/req/req_set.py", line 380, in prepare_files
+ ignore_dependencies=self.ignore_dependencies))
+ File "/usr/local/lib/python2.6/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
+ session=self.session, hashes=hashes)
+ File "/usr/local/lib/python2.6/dist-packages/pip/download.py", line 821, in unpack_url
+ hashes=hashes
+ File "/usr/local/lib/python2.6/dist-packages/pip/download.py", line 659, in unpack_http_url
+ hashes)
+ File "/usr/local/lib/python2.6/dist-packages/pip/download.py", line 853, in _download_http_url
+ stream=True,
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/requests/sessions.py", line 521, in get
+ return self.request('GET', url, **kwargs)
+ File "/usr/local/lib/python2.6/dist-packages/pip/download.py", line 386, in request
+ return super(PipSession, self).request(method, url, *args, **kwargs)
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/requests/sessions.py", line 508, in request
+ resp = self.send(prep, **send_kwargs)
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/requests/sessions.py", line 618, in send
+ r = adapter.send(request, **kwargs)
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
+ resp = super(CacheControlAdapter, self).send(request, **kw)
+ File "/usr/local/lib/python2.6/dist-packages/pip/_vendor/requests/adapters.py", line 506, in send
+ raise SSLError(e, request=request)
+ SSLError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/ef/ab/aa12712415809bf698e719b307419f953e25344e8f42d557533d7a02b276/netapp_lib-2020.7.16-py2-none-any.whl (Caused by SSLError(CertificateError("hostname 'files.pythonhosted.org' doesn't match either of 'r.ssl.fastly.net', '*.catchpoint.com', '*.cnn.io', '*.dollarshaveclub.com', '*.eater.com', '*.fastly.picmonkey.com', '*.files.saymedia-content.com', '*.ft.com', '*.meetupstatic.com', '*.nfl.com', '*.pagar.me', '*.picmonkey.com', '*.realself.com', '*.sbnation.com', '*.shakr.com', '*.streamable.com', '*.surfly.com', '*.theverge.com', '*.thrillist.com', '*.vox-cdn.com', '*.vox.com', '*.voxmedia.com', 'eater.com', 'ft.com', 'i.gse.io', 'picmonkey.com', 'realself.com', 'static.wixstatic.com', 'streamable.com', 'surfly.com', 'theverge.com', 'vox-cdn.com', 'vox.com', 'www.joyent.com'",),))
+ ERROR: Command "/usr/bin/python2.6 /root/ansible/test/lib/ansible_test/_data/quiet_pip.py install --disable-pip-version-check -r /root/ansible/test/lib/ansible_test/_data/requirements/units.txt -r tests/unit/requirements.txt -c /root/ansible/test/lib/ansible_test/_data/requirements/constraints.txt" returned exit status 2.
+ ERROR: Command "docker exec d47eb360db4ce779c1f690db964655b76e68895c4360ff252c46fe7fe6f5c75a /usr/bin/env ANSIBLE_TEST_CONTENT_ROOT=/root/ansible_collections/netapp/ontap LC_ALL=en_US.UTF-8 /usr/bin/python3.6 /root/ansible/bin/ansible-test units --metadata tests/output/.tmp/metadata-9i2qfrcl.json --truncate 200 --redact --color yes --requirements --python default --requirements-mode only" returned exit status 1.
+ validations:
+ required: true
+
+
+- type: markdown
+ attributes:
+ value: >
+ *One last thing...*
+
+
+ Thank you for your collaboration!
+
+
+...
diff --git a/ansible_collections/netapp/aws/.github/ISSUE_TEMPLATE/feature_request.yml b/ansible_collections/netapp/aws/.github/ISSUE_TEMPLATE/feature_request.yml
new file mode 100644
index 00000000..c0506a05
--- /dev/null
+++ b/ansible_collections/netapp/aws/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -0,0 +1,100 @@
+---
+name: ✨ Feature request
+description: Suggest an idea for this project
+
+body:
+- type: markdown
+ attributes:
+ value: >
+ **Thank you for wanting to suggest a feature for netapp.aws!**
+
+ 💡
+ Before you go ahead with your request, please first consider if it
+ would be useful for majority of the netapp.aws users. As a
+ general rule of thumb, any feature that is only of interest to a
+ small sub group should be [implemented in a third-party Ansible
+ Collection][contribute to collections] or maybe even just your
+ project alone. Be mindful of the fact that the essential
+ netapp.aws features have a broad impact.
+
+
+ <details>
+ <summary>
+ ❗ Every change breaks someone's workflow.
+ </summary>
+
+
+ [![❗ Every change breaks someone's workflow.
+ ](https://imgs.xkcd.com/comics/workflow.png)
+ ](https://xkcd.com/1172/)
+ </details>
+
+
+ ⚠
+ Verify first that your idea is not [already requested on
+ GitHub][issue search].
+
+ Also test if the main branch does not already implement this.
+
+
+- type: textarea
+ attributes:
+ label: Summary
+ description: >
+ Describe the new feature/improvement you would like briefly below.
+
+
+ What's the problem this feature will solve?
+
+ What are you trying to do, that you are unable to achieve
+ with netapp.aws as it currently stands?
+
+
+ * Provide examples of real-world use cases that this would enable
+ and how it solves the problem you described.
+
+ * How do you solve this now?
+
+ * Have you tried to work around the problem using other tools?
+
+ * Could there be a different approach to solving this issue?
+
+ placeholder: >-
+ I am trying to do X with netapp.aws from the devel branch on GitHub and
+ I think that implementing a feature Y would be very helpful for me and
+ every other user of netapp.aws because of Z.
+ validations:
+ required: true
+
+- type: input
+ attributes:
+ label: Component Name
+ description: >
+ Write the short name of the module, plugin, task or feature below,
+ *use your best guess if unsure*.
+
+
+ [collections org]: /ansible-collections
+ placeholder: dnf, apt, yum, pip, user etc.
+ validations:
+ required: true
+
+- type: textarea
+ attributes:
+ label: Additional Information
+ description: |
+ Describe how the feature would be used, why it is needed and what it would solve.
+
+ **HINT:** You can paste https://gist.github.com links for larger files.
+ value: |
+ <!--- Paste example playbooks or commands between quotes below -->
+ ```yaml (paste below)
+
+ ```
+ placeholder: >-
+ I asked on https://stackoverflow.com/.... and the community
+ advised me to do X, Y and Z.
+ validations:
+ required: true
+
+...
diff --git a/ansible_collections/netapp/aws/.github/workflows/coverage.yml b/ansible_collections/netapp/aws/.github/workflows/coverage.yml
new file mode 100644
index 00000000..d254e608
--- /dev/null
+++ b/ansible_collections/netapp/aws/.github/workflows/coverage.yml
@@ -0,0 +1,45 @@
+name: NetApp.aws Ansible Coverage
+
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 6 * * *'
+
+jobs:
+ sanity:
+ name: Coverage on AWS
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+
+ - name: Install ansible stable-2.11
+ run: pip install https://github.com/ansible/ansible/archive/stable-2.11.tar.gz --disable-pip-version-check
+
+ - name: Make directory to make ansible-test happy
+ run: |
+ pwd
+ mkdir -p ansible_collections/netapp/aws/
+ rsync -av . ansible_collections/netapp/aws/ --exclude ansible_collections/netapp/aws/
+
+ - name: Run Unit Tests
+ run: ansible-test units --coverage --color --docker --python 3.8
+ working-directory: ansible_collections/netapp/aws/
+
+ # ansible-test support producing code coverage date
+ - name: Generate coverage report
+ run: ansible-test coverage xml -v --requirements --group-by command --group-by version
+ working-directory: ansible_collections/netapp/aws/
+
+ - name: Upload coverage to Codecov
+ uses: codecov/codecov-action@v2
+ with:
+ working-directory: ansible_collections/netapp/aws/
+ verbose: true \ No newline at end of file
diff --git a/ansible_collections/netapp/aws/.github/workflows/main.yml b/ansible_collections/netapp/aws/.github/workflows/main.yml
new file mode 100644
index 00000000..d4357270
--- /dev/null
+++ b/ansible_collections/netapp/aws/.github/workflows/main.yml
@@ -0,0 +1,45 @@
+name: NetApp.aws Ansible CI
+
+on:
+ push:
+ pull_request:
+ schedule:
+ - cron: '0 6 * * *'
+
+jobs:
+ sanity:
+ name: Sanity (${{ matrix.ansible }} on AWS
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ ansible:
+ - stable-2.9
+ - stable-2.10
+ - stable-2.11
+ - stable-2.12
+ - devel
+
+ steps:
+ - name: Check out code
+ uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+
+ - name: Install ansible (${{ matrix.ansible }})
+ run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
+
+ - name: Make directory to make ansible-test happy
+ run: |
+ pwd
+ mkdir -p ansible_collections/netapp/aws/
+ rsync -av . ansible_collections/netapp/aws/ --exclude ansible_collections/netapp/aws/
+ - name: Run sanity tests AWS
+ run: ansible-test sanity --docker -v --color
+ working-directory: ansible_collections/netapp/aws/
+
+ - name: Run Unit Tests
+ run: ansible-test units --docker -v --color
+ working-directory: ansible_collections/netapp/aws/
diff --git a/ansible_collections/netapp/aws/CHANGELOG.rst b/ansible_collections/netapp/aws/CHANGELOG.rst
new file mode 100644
index 00000000..11be8dba
--- /dev/null
+++ b/ansible_collections/netapp/aws/CHANGELOG.rst
@@ -0,0 +1,90 @@
+=======================================
+NetApp AWS CVS Collection Release Notes
+=======================================
+
+.. contents:: Topics
+
+
+v21.7.0
+=======
+
+Minor Changes
+-------------
+
+- PR1 - allow usage of Ansible module group defaults - for Ansible 2.12+.
+
+v21.6.0
+=======
+
+Minor Changes
+-------------
+
+- all modules - ability to trace API calls and responses.
+
+Bugfixes
+--------
+
+- all modules - fix traceback TypeError 'NoneType' object is not subscriptable when URL points to a web server.
+
+v21.2.0
+=======
+
+Bugfixes
+--------
+
+- all modules - disable logging for ``api_key`` and ``secret_key`` values.
+- all modules - prevent infinite loop when asynchronous action fails.
+- all modules - report error if response does not contain valid JSON.
+- aws_netapp_cvs_filesystems - fix KeyError when exportPolicy is not present.
+
+v20.9.0
+=======
+
+Minor Changes
+-------------
+
+- Fix pylint or flake8 warnings reported by galaxy importer.
+
+v20.8.0
+=======
+
+Minor Changes
+-------------
+
+- add "elements:" and update "required:" to match module requirements.
+- use a three group format for version_added. So 2.7 becomes 2.7.0. Same thing for 2.8 and 2.9.
+
+v20.6.0
+=======
+
+Bugfixes
+--------
+
+- galaxy.yml - fix repository and homepage links.
+
+v20.2.0
+=======
+
+Bugfixes
+--------
+
+- galaxy.yml - fix path to github repository.
+
+v19.10.0
+========
+
+Minor Changes
+-------------
+
+- refactor existing modules as a collection
+
+v2.9.0
+======
+
+New Modules
+-----------
+
+- netapp.aws.aws_netapp_cvs_active_directory - NetApp AWS CloudVolumes Service Manage Active Directory.
+- netapp.aws.aws_netapp_cvs_filesystems - NetApp AWS Cloud Volumes Service Manage FileSystem.
+- netapp.aws.aws_netapp_cvs_pool - NetApp AWS Cloud Volumes Service Manage Pools.
+- netapp.aws.aws_netapp_cvs_snapshots - NetApp AWS Cloud Volumes Service Manage Snapshots.
diff --git a/ansible_collections/netapp/aws/COPYING b/ansible_collections/netapp/aws/COPYING
new file mode 100644
index 00000000..94a9ed02
--- /dev/null
+++ b/ansible_collections/netapp/aws/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/ansible_collections/netapp/aws/FILES.json b/ansible_collections/netapp/aws/FILES.json
new file mode 100644
index 00000000..0c3ecec9
--- /dev/null
+++ b/ansible_collections/netapp/aws/FILES.json
@@ -0,0 +1,376 @@
+{
+ "files": [
+ {
+ "name": ".",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "requirements.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "ec72420df5dfbdce4111f715c96338df3b7cb75f58e478d2449c9720e560de8c",
+ "format": 1
+ },
+ {
+ "name": "plugins",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/doc_fragments",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/doc_fragments/netapp.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "73a260df376d83b7076b7654a10e9f238de604470a6ba309e8c6019c0f710203",
+ "format": 1
+ },
+ {
+ "name": "plugins/module_utils",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/module_utils/netapp.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7c23b3d0d56e977cf8d27dce883c871960efb9707c89cd5d82147e36d93945bf",
+ "format": 1
+ },
+ {
+ "name": "plugins/module_utils/netapp_module.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2d69e77a6e5b76dc8909149c8c364454e80fb42631af7d889dfb6e2ff0438c3e",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/aws_netapp_cvs_filesystems.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "600bccc2f8464217ff4672ba52c160fdcbdc27d40ae33b29f8944af10b14af18",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/aws_netapp_cvs_active_directory.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "a040e165f265ad4cfc04672506be81a07a032a9e2769f5d84b2a77c3be81fce0",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/aws_netapp_cvs_snapshots.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8edfd787384f01ef37a0032e60898b0253472355a32e420b439e1dbb4d385e85",
+ "format": 1
+ },
+ {
+ "name": "plugins/modules/aws_netapp_cvs_pool.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7a4b6fc9d48d61cf80a052455334ffd671dd880e7ec476aff6ccae820b658610",
+ "format": 1
+ },
+ {
+ "name": "tests",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/unittest.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "cba95d18c5b39c6f49714eacf1ac77452c2e32fa087c03cf01aacd19ae597b0f",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/builtins.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0ca4cac919e166b25e601e11acb01f6957dddd574ff0a62569cb994a5ecb63e1",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/__init__.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/compat/mock.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "0af958450cf6de3fbafe94b1111eae8ba5a8dbe1d785ffbb9df81f26e4946d99",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/requirements.txt",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "68a61b1d58a722f4ffabaa28da01c9837c93a582ea41c1bfb1c1fd54ea2d8fab",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/module_utils",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/module_utils/test_netapp.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "2d8932ad58a04840536e850abf3f131960e99ec55546081fb63713dbfc3bc05d",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_aws_netapp_cvs_snapshots.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "553b6f1afd566bebf6a90de18f71517efc3a41953bade06cd8972fcbff9ea1fb",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_aws_netapp_cvs_active_directory.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "3b42a059c1dfd757cd6294ca9ebce74f1e3ce6690bcddcdca2cdb4e6b8ac771b",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_aws_netapp_cvs_filesystems.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "f74d3b3ecbaf71433fcf569a9a09d134f241c8eb5a8e2ed373eeb5638fc79b2e",
+ "format": 1
+ },
+ {
+ "name": "tests/unit/plugins/modules/test_aws_netapp_cvs_pool.py",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "64f0c7995f02daaf91d3d6cc15f2347ecba5253a2dc13f7a7df6a880c0926fcf",
+ "format": 1
+ },
+ {
+ "name": "meta",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "meta/runtime.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "064142cc7f33ebdf05a9f5eb31629c37c1f2cc791728b9e8bfa7d6d02753841f",
+ "format": 1
+ },
+ {
+ "name": "changelogs",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.9.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "adc1cab2c7625a1e299876d9d622eb1e7529af59042268e088673f408c1d1dce",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3569.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "e3e0500c584d187e1b339a612f800540a39cddcebe5c3e1c8c2e134af0b2baf6",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/2019.10.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7b1a5ef7df5f1e6e66ddc013149aea0480eb79f911a0563e2e6d7d9af79d5572",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.2.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "91918f48a406834778ff7163c92c12dd1802c0620cb681ee66f8a4709444cf5e",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.8.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "a91cbe5f46d2bae6af1eb3693470bdfaf04e5fbd6cdc76882e674389f4352f16",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/20.6.0.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "6192b3cccdc7c1e1eb0d61a49dd20c6f234499b6dd9b52b2f974b673e99f7a47",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-3644.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "7eaf09f11cdf4fd2628e29124ce128dd984340ee65a233acdde77369ebf08ada",
+ "format": 1
+ },
+ {
+ "name": "changelogs/fragments/DEVOPS-4416.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4224db573f34caeeb956c8728eb343a47bc2729d898001a4c6a671b780dae1bf",
+ "format": 1
+ },
+ {
+ "name": "changelogs/config.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b0bb3c0938ee0599c727ceef11d224bd771e9db9dc7a0bca162d786c2933ea89",
+ "format": 1
+ },
+ {
+ "name": "changelogs/changelog.yaml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8f1d175c82536c75b0c17c289a6aa7e9bd2faeea39485d571cea6cba5c86d9aa",
+ "format": 1
+ },
+ {
+ "name": "README.md",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "35c36cfbf3376b4441c096654932c92810d8970c89f50a21adffa44da6609aca",
+ "format": 1
+ },
+ {
+ "name": "COPYING",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903",
+ "format": 1
+ },
+ {
+ "name": ".github",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/workflows",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/coverage.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "876f2d16a1c4169c208ddec8702048f376eeacd4f697a10cfe4a948444ce3f4e",
+ "format": 1
+ },
+ {
+ "name": ".github/workflows/main.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "b30611d534ec350cce00d5c14b28fd26f3961c7e05f714c79022c4af91975620",
+ "format": 1
+ },
+ {
+ "name": ".github/ISSUE_TEMPLATE",
+ "ftype": "dir",
+ "chksum_type": null,
+ "chksum_sha256": null,
+ "format": 1
+ },
+ {
+ "name": ".github/ISSUE_TEMPLATE/feature_request.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "4204f720b07bf0636be6a9c39717e84e59dc1a0b36425bf0f10fc9817131d3e7",
+ "format": 1
+ },
+ {
+ "name": ".github/ISSUE_TEMPLATE/bug_report.yml",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "1bcc8888ddd84ef0fc9efe03e784278a748a71ec3e4fffa62dc4a8ad02007760",
+ "format": 1
+ },
+ {
+ "name": "CHANGELOG.rst",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c9a90849f79ddb81dc0f31e6cad9e6273e82d60b8651404fa31e40f0a6ee66b1",
+ "format": 1
+ }
+ ],
+ "format": 1
+} \ No newline at end of file
diff --git a/ansible_collections/netapp/aws/MANIFEST.json b/ansible_collections/netapp/aws/MANIFEST.json
new file mode 100644
index 00000000..373e1c4f
--- /dev/null
+++ b/ansible_collections/netapp/aws/MANIFEST.json
@@ -0,0 +1,35 @@
+{
+ "collection_info": {
+ "namespace": "netapp",
+ "name": "aws",
+ "version": "21.7.0",
+ "authors": [
+ "NetApp Ansible Team <ng-ansibleteam@netapp.com>"
+ ],
+ "readme": "README.md",
+ "tags": [
+ "storage",
+ "cloud",
+ "netapp",
+ "cvs",
+ "amazon",
+ "aws"
+ ],
+ "description": "Cloud Volumes Service (CVS) for AWS",
+ "license": [],
+ "license_file": "COPYING",
+ "dependencies": {},
+ "repository": "https://github.com/ansible-collections/netapp.aws",
+ "documentation": null,
+ "homepage": "https://netapp.io/configuration-management-and-automation/",
+ "issues": "https://github.com/ansible-collections/netapp.aws/issues"
+ },
+ "file_manifest_file": {
+ "name": "FILES.json",
+ "ftype": "file",
+ "chksum_type": "sha256",
+ "chksum_sha256": "c8d3153cb010a888ed1cd2f4912db9e5c59533c0eb853bc6fa6495b7a7d8811e",
+ "format": 1
+ },
+ "format": 1
+} \ No newline at end of file
diff --git a/ansible_collections/netapp/aws/README.md b/ansible_collections/netapp/aws/README.md
new file mode 100644
index 00000000..7dbbfb84
--- /dev/null
+++ b/ansible_collections/netapp/aws/README.md
@@ -0,0 +1,86 @@
+[![Documentation](https://img.shields.io/badge/docs-brightgreen.svg)](https://docs.ansible.com/ansible/devel/collections/netapp/aws/index.html)
+![example workflow](https://github.com/ansible-collections/netapp.aws/actions/workflows/main.yml/badge.svg)
+[![codecov](https://codecov.io/gh/ansible-collections/netapp.aws/branch/main/graph/badge.svg?token=weBYkksxSi)](https://codecov.io/gh/ansible-collections/netapp.aws)
+
+
+=============================================================
+
+netapp.aws
+
+NetApp AWS CVS Collection
+
+Copyright (c) 2019 NetApp, Inc. All rights reserved.
+Specifications subject to change without notice.
+
+=============================================================
+
+# Installation
+```bash
+ansible-galaxy collection install netapp.aws
+```
+To use Collection add the following to the top of your playbook, with out this you will be using Ansible 2.9 version of the module
+```
+collections:
+ - netapp.aws
+```
+
+# Module documentation
+https://docs.ansible.com/ansible/devel/collections/netapp/aws/
+
+# Need help
+Join our Slack Channel at [Netapp.io](http://netapp.io/slack)
+
+# Notes
+
+These Ansible modules are supporting NetApp Cloud Volumes Service for AWS.
+
+They require a subscription to the service and your API access keys.
+
+The modules currently support Active Directory, Pool, FileSystem (Volume), and Snapshot services.
+
+# Release Notes
+
+
+## 21.7.0
+
+### Minor Changes
+- all modules - allow usage of Ansible module group defaults - for Ansible 2.12+.
+
+## 21.6.0
+
+### Minor Changes
+- all modules - ability to trace API calls and responses.
+
+### Bug Fixes
+- all modules - fix traceback TypeError 'NoneType' object is not subscriptable when URL points to a web server.
+
+## 21.2.0
+
+### Bug Fixes
+- aws_netapp_cvs_filesystems - fix KeyError when exportPolicy is not present.
+- all modules - disable logging for `api_key` and `secret_key` values.
+- all modules - report error if response does not contain valid JSON.
+- all modules - prevent infinite loop when asynchornous action fails.
+
+## 20.9.0
+
+Fix pylint or flake8 warnings reported by galaxy importer.
+
+## 20.8.0
+
+### Module documentation changes
+- use a three group format for `version_added`. So 2.7 becomes 2.7.0. Same thing for 2.8 and 2.9.
+- add `elements:` and update `required:` to match module requirements.
+
+## 20.6.0
+
+### Bug Fixes
+- galaxy.xml: fix repository and homepage links.
+
+## 20.2.0
+
+### Bug Fixes
+- galaxy.yml: fix path to github repository.
+
+## 19.11.0
+- Initial release as a collection.
diff --git a/ansible_collections/netapp/aws/changelogs/changelog.yaml b/ansible_collections/netapp/aws/changelogs/changelog.yaml
new file mode 100644
index 00000000..ba907fcd
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/changelog.yaml
@@ -0,0 +1,81 @@
+ancestor: null
+releases:
+ 19.10.0:
+ changes:
+ minor_changes:
+ - refactor existing modules as a collection
+ fragments:
+ - 2019.10.0.yaml
+ release_date: '2019-11-14'
+ 2.9.0:
+ modules:
+ - description: NetApp AWS CloudVolumes Service Manage Active Directory.
+ name: aws_netapp_cvs_active_directory
+ namespace: ''
+ - description: NetApp AWS Cloud Volumes Service Manage FileSystem.
+ name: aws_netapp_cvs_filesystems
+ namespace: ''
+ - description: NetApp AWS Cloud Volumes Service Manage Pools.
+ name: aws_netapp_cvs_pool
+ namespace: ''
+ - description: NetApp AWS Cloud Volumes Service Manage Snapshots.
+ name: aws_netapp_cvs_snapshots
+ namespace: ''
+ release_date: '2019-11-13'
+ 20.2.0:
+ changes:
+ bugfixes:
+ - galaxy.yml - fix path to github repository.
+ fragments:
+ - 20.2.0.yaml
+ release_date: '2020-02-05'
+ 20.6.0:
+ changes:
+ bugfixes:
+ - galaxy.yml - fix repository and homepage links.
+ fragments:
+ - 20.6.0.yaml
+ release_date: '2020-06-03'
+ 20.8.0:
+ changes:
+ minor_changes:
+ - add "elements:" and update "required:" to match module requirements.
+ - use a three group format for version_added. So 2.7 becomes 2.7.0. Same thing
+ for 2.8 and 2.9.
+ fragments:
+ - 20.8.0.yaml
+ release_date: '2020-08-05'
+ 20.9.0:
+ changes:
+ minor_changes:
+ - Fix pylint or flake8 warnings reported by galaxy importer.
+ fragments:
+ - 20.9.0.yaml
+ release_date: '2020-09-02'
+ 21.2.0:
+ changes:
+ bugfixes:
+ - all modules - disable logging for ``api_key`` and ``secret_key`` values.
+ - all modules - prevent infinite loop when asynchronous action fails.
+ - all modules - report error if response does not contain valid JSON.
+ - aws_netapp_cvs_filesystems - fix KeyError when exportPolicy is not present.
+ fragments:
+ - DEVOPS-3644.yaml
+ release_date: '2021-02-04'
+ 21.6.0:
+ changes:
+ bugfixes:
+ - all modules - fix traceback TypeError 'NoneType' object is not subscriptable
+ when URL points to a web server.
+ minor_changes:
+ - all modules - ability to trace API calls and responses.
+ fragments:
+ - DEVOPS-3569.yaml
+ release_date: '2021-07-14'
+ 21.7.0:
+ changes:
+ minor_changes:
+ - PR1 - allow usage of Ansible module group defaults - for Ansible 2.12+.
+ fragments:
+ - DEVOPS-4416.yaml
+ release_date: '2021-11-03'
diff --git a/ansible_collections/netapp/aws/changelogs/config.yaml b/ansible_collections/netapp/aws/changelogs/config.yaml
new file mode 100644
index 00000000..5f649c68
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/config.yaml
@@ -0,0 +1,32 @@
+changelog_filename_template: ../CHANGELOG.rst
+changelog_filename_version_depth: 0
+changes_file: changelog.yaml
+changes_format: combined
+ignore_other_fragment_extensions: true
+keep_fragments: true
+mention_ancestor: true
+new_plugins_after_name: removed_features
+notesdir: fragments
+prelude_section_name: release_summary
+prelude_section_title: Release Summary
+sanitize_changelog: true
+sections:
+- - major_changes
+ - Major Changes
+- - minor_changes
+ - Minor Changes
+- - breaking_changes
+ - Breaking Changes / Porting Guide
+- - deprecated_features
+ - Deprecated Features
+- - removed_features
+ - Removed Features (previously deprecated)
+- - security_fixes
+ - Security Fixes
+- - bugfixes
+ - Bugfixes
+- - known_issues
+ - Known Issues
+title: NetApp AWS CVS Collection
+trivial_section_name: trivial
+use_fqcn: true
diff --git a/ansible_collections/netapp/aws/changelogs/fragments/20.2.0.yaml b/ansible_collections/netapp/aws/changelogs/fragments/20.2.0.yaml
new file mode 100644
index 00000000..3f764c1c
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/fragments/20.2.0.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - galaxy.yml - fix path to github repository.
diff --git a/ansible_collections/netapp/aws/changelogs/fragments/20.6.0.yaml b/ansible_collections/netapp/aws/changelogs/fragments/20.6.0.yaml
new file mode 100644
index 00000000..fcd0d11e
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/fragments/20.6.0.yaml
@@ -0,0 +1,2 @@
+bugfixes:
+ - galaxy.yml - fix repository and homepage links.
diff --git a/ansible_collections/netapp/aws/changelogs/fragments/20.8.0.yaml b/ansible_collections/netapp/aws/changelogs/fragments/20.8.0.yaml
new file mode 100644
index 00000000..c92e9e41
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/fragments/20.8.0.yaml
@@ -0,0 +1,3 @@
+minor_changes:
+ - use a three group format for version_added. So 2.7 becomes 2.7.0. Same thing for 2.8 and 2.9.
+ - add "elements:" and update "required:" to match module requirements.
diff --git a/ansible_collections/netapp/aws/changelogs/fragments/20.9.0.yaml b/ansible_collections/netapp/aws/changelogs/fragments/20.9.0.yaml
new file mode 100644
index 00000000..c7328c5e
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/fragments/20.9.0.yaml
@@ -0,0 +1,2 @@
+minor_changes:
+ - Fix pylint or flake8 warnings reported by galaxy importer.
diff --git a/ansible_collections/netapp/aws/changelogs/fragments/2019.10.0.yaml b/ansible_collections/netapp/aws/changelogs/fragments/2019.10.0.yaml
new file mode 100644
index 00000000..5723daa1
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/fragments/2019.10.0.yaml
@@ -0,0 +1,2 @@
+minor_changes:
+ - refactor existing modules as a collection
diff --git a/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-3569.yaml b/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-3569.yaml
new file mode 100644
index 00000000..19ba55d8
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-3569.yaml
@@ -0,0 +1,4 @@
+minor_changes:
+ - all modules - ability to trace API calls and responses.
+bugfixes:
+ - all modules - fix traceback TypeError 'NoneType' object is not subscriptable when URL points to a web server.
diff --git a/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-3644.yaml b/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-3644.yaml
new file mode 100644
index 00000000..2c7e83f3
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-3644.yaml
@@ -0,0 +1,5 @@
+bugfixes:
+ - aws_netapp_cvs_filesystems - fix KeyError when exportPolicy is not present.
+ - all modules - disable logging for ``api_key`` and ``secret_key`` values.
+ - all modules - report error if response does not contain valid JSON.
+ - all modules - prevent infinite loop when asynchronous action fails.
diff --git a/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-4416.yaml b/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-4416.yaml
new file mode 100644
index 00000000..6b4b660a
--- /dev/null
+++ b/ansible_collections/netapp/aws/changelogs/fragments/DEVOPS-4416.yaml
@@ -0,0 +1,2 @@
+minor_changes:
+ - PR1 - allow usage of Ansible module group defaults - for Ansible 2.12+.
diff --git a/ansible_collections/netapp/aws/meta/runtime.yml b/ansible_collections/netapp/aws/meta/runtime.yml
new file mode 100644
index 00000000..048c94c1
--- /dev/null
+++ b/ansible_collections/netapp/aws/meta/runtime.yml
@@ -0,0 +1,8 @@
+---
+requires_ansible: ">=2.9.10"
+action_groups:
+ netapp_aws:
+ - aws_netapp_cvs_active_directory
+ - aws_netapp_cvs_filesystems
+ - aws_netapp_cvs_pool
+ - aws_netapp_cvs_snapshots
diff --git a/ansible_collections/netapp/aws/plugins/doc_fragments/netapp.py b/ansible_collections/netapp/aws/plugins/doc_fragments/netapp.py
new file mode 100644
index 00000000..aff60719
--- /dev/null
+++ b/ansible_collections/netapp/aws/plugins/doc_fragments/netapp.py
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+
+# Copyright: (c) 2019, NetApp Ansible Team <ng-ansibleteam@netapp.com>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+
+class ModuleDocFragment(object):
+
+ DOCUMENTATION = r'''
+options:
+ - See respective platform section for more details
+requirements:
+ - See respective platform section for more details
+notes:
+ - This is documentation for NetApp's AWS CVS modules.
+'''
+
+ # Documentation fragment for AWSCVS
+ AWSCVS = """
+options:
+ api_key:
+ required: true
+ type: str
+ description:
+ - The access key to authenticate with the AWSCVS Web Services Proxy or Embedded Web Services API.
+ secret_key:
+ required: true
+ type: str
+ description:
+ - The secret_key to authenticate with the AWSCVS Web Services Proxy or Embedded Web Services API.
+ api_url:
+ required: true
+ type: str
+ description:
+ - The url to the AWSCVS Web Services Proxy or Embedded Web Services API.
+ validate_certs:
+ required: false
+ default: true
+ description:
+ - Should https certificates be validated?
+ type: bool
+ feature_flags:
+ description:
+ - Enable or disable a new feature.
+ - This can be used to enable an experimental feature or disable a new feature that breaks backward compatibility.
+ - Supported keys and values are subject to change without notice. Unknown keys are ignored.
+ - trace_apis can be set to true to enable tracing, data is written to /tmp/um_apis.log.
+ type: dict
+ version_added: 21.6.0
+notes:
+ - The modules prefixed with aws\\_cvs\\_netapp are built to Manage AWS Cloud Volumes Service .
+"""
diff --git a/ansible_collections/netapp/aws/plugins/module_utils/netapp.py b/ansible_collections/netapp/aws/plugins/module_utils/netapp.py
new file mode 100644
index 00000000..df7b85ff
--- /dev/null
+++ b/ansible_collections/netapp/aws/plugins/module_utils/netapp.py
@@ -0,0 +1,241 @@
+# This code is part of Ansible, but is an independent component.
+# This particular file snippet, and this file snippet only, is BSD licensed.
+# Modules you write using this snippet, which is embedded dynamically by Ansible
+# still belong to the author of the module, and may assign their own license
+# to the complete work.
+#
+# Copyright (c) 2019, NetApp Ansible Team <ng-ansibleteam@netapp.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+'''
+netapp.py
+Support methods and class for AWS CVS modules
+'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import logging
+import time
+from ansible.module_utils.basic import missing_required_lib
+
+try:
+ from ansible.module_utils.ansible_release import __version__ as ansible_version
+except ImportError:
+ ansible_version = 'unknown'
+
+COLLECTION_VERSION = "21.7.0"
+
+try:
+ import requests
+ HAS_REQUESTS = True
+except ImportError:
+ HAS_REQUESTS = False
+
+
+POW2_BYTE_MAP = dict(
+ # Here, 1 kb = 1024
+ bytes=1,
+ b=1,
+ kb=1024,
+ mb=1024 ** 2,
+ gb=1024 ** 3,
+ tb=1024 ** 4,
+ pb=1024 ** 5,
+ eb=1024 ** 6,
+ zb=1024 ** 7,
+ yb=1024 ** 8
+)
+
+LOG = logging.getLogger(__name__)
+LOG_FILE = '/tmp/aws_cvs_apis.log'
+
+
+def aws_cvs_host_argument_spec():
+
+ return dict(
+ api_url=dict(required=True, type='str'),
+ validate_certs=dict(required=False, type='bool', default=True),
+ api_key=dict(required=True, type='str', no_log=True),
+ secret_key=dict(required=True, type='str', no_log=True),
+ feature_flags=dict(required=False, type='dict', default=dict()),
+ )
+
+
+def has_feature(module, feature_name):
+ feature = get_feature(module, feature_name)
+ if isinstance(feature, bool):
+ return feature
+ module.fail_json(msg="Error: expected bool type for feature flag: %s" % feature_name)
+
+
+def get_feature(module, feature_name):
+ ''' if the user has configured the feature, use it
+ otherwise, use our default
+ '''
+ default_flags = dict(
+ strict_json_check=True, # if true, fail if response.content in not empty and is not valid json
+ trace_apis=False, # if true, append REST requests/responses to LOG_FILE
+ )
+
+ if module.params['feature_flags'] is not None and feature_name in module.params['feature_flags']:
+ return module.params['feature_flags'][feature_name]
+ if feature_name in default_flags:
+ return default_flags[feature_name]
+ module.fail_json(msg="Internal error: unexpected feature flag: %s" % feature_name)
+
+
+class AwsCvsRestAPI(object):
+ ''' wraps requests methods to interface with AWS CVS REST APIs '''
+ def __init__(self, module, timeout=60):
+ self.module = module
+ self.api_key = self.module.params['api_key']
+ self.secret_key = self.module.params['secret_key']
+ self.api_url = self.module.params['api_url']
+ self.verify = self.module.params['validate_certs']
+ self.timeout = timeout
+ self.url = 'https://' + self.api_url + '/v1/'
+ self.errors = list()
+ self.debug_logs = list()
+ self.check_required_library()
+ if has_feature(module, 'trace_apis'):
+ logging.basicConfig(filename=LOG_FILE, level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s')
+
+ def check_required_library(self):
+ if not HAS_REQUESTS:
+ self.module.fail_json(msg=missing_required_lib('requests'))
+
+ def send_request(self, method, api, params, json=None):
+ ''' send http request and process reponse, including error conditions '''
+ if params is not None:
+ self.module.fail_json(msg='params is not implemented. api=%s, params=%s' % (api, repr(params)))
+ url = self.url + api
+ status_code = None
+ content = None
+ json_dict = None
+ json_error = None
+ error_details = None
+ headers = {
+ 'Content-type': "application/json",
+ 'api-key': self.api_key,
+ 'secret-key': self.secret_key,
+ 'Cache-Control': "no-cache",
+ }
+
+ def check_contents(response):
+ '''json() may fail on an empty value, but it's OK if no response is expected.
+ To avoid false positives, only report an issue when we expect to read a value.
+ The first get will see it.
+ '''
+ if method == 'GET' and has_feature(self.module, 'strict_json_check'):
+ contents = response.content
+ if len(contents) > 0:
+ raise ValueError("Expecting json, got: %s" % contents)
+
+ def get_json(response):
+ ''' extract json, and error message if present '''
+ error = None
+ try:
+ json = response.json()
+ except ValueError:
+ check_contents(response)
+ return None, None
+ success_code = [200, 201, 202]
+ if response.status_code not in success_code:
+ error = json.get('message')
+ return json, error
+
+ def sanitize(value, key=None):
+ if isinstance(value, dict):
+ new_dict = dict()
+ for key, value in value.items():
+ new_dict[key] = sanitize(value, key)
+ return new_dict
+ else:
+ if key in ['api-key', 'secret-key', 'password']:
+ return '*' * 12
+ else:
+ return value
+
+ self.log_debug('sending', repr(sanitize(dict(method=method, url=url, verify=self.verify, params=params,
+ timeout=self.timeout, json=json, headers=headers))))
+ try:
+ response = requests.request(method, url, headers=headers, timeout=self.timeout, json=json)
+ content = response.content # for debug purposes
+ status_code = response.status_code
+ # If the response was successful, no Exception will be raised
+ response.raise_for_status()
+ json_dict, json_error = get_json(response)
+ except requests.exceptions.HTTPError as err:
+ __, json_error = get_json(response)
+ if json_error is None:
+ self.log_error(status_code, 'HTTP error: %s' % err)
+ error_details = str(err)
+ # If an error was reported in the json payload, it is handled below
+ except requests.exceptions.ConnectionError as err:
+ self.log_error(status_code, 'Connection error: %s' % err)
+ error_details = str(err)
+ except Exception as err:
+ self.log_error(status_code, 'Other error: %s' % err)
+ error_details = 'general exception: %s' % str(err)
+ if json_error is not None:
+ self.log_error(status_code, 'Endpoint error: %d: %s' % (status_code, json_error))
+ error_details = json_error
+ self.log_debug(status_code, content)
+ return json_dict, error_details
+
+ def get(self, api, params=None):
+ method = 'GET'
+ return self.send_request(method, api, params)
+
+ def post(self, api, data, params=None):
+ method = 'POST'
+ return self.send_request(method, api, params, json=data)
+
+ def patch(self, api, data, params=None):
+ method = 'PATCH'
+ return self.send_request(method, api, params, json=data)
+
+ def put(self, api, data, params=None):
+ method = 'PUT'
+ return self.send_request(method, api, params, json=data)
+
+ def delete(self, api, data, params=None):
+ method = 'DELETE'
+ return self.send_request(method, api, params, json=data)
+
+ def get_state(self, job_id):
+ """ Method to get the state of the job """
+ response, dummy = self.get('Jobs/%s' % job_id)
+ while str(response['state']) == 'ongoing':
+ time.sleep(15)
+ response, dummy = self.get('Jobs/%s' % job_id)
+ return str(response['state'])
+
+ def log_error(self, status_code, message):
+ LOG.error("%s: %s", status_code, message)
+ self.errors.append(message)
+ self.debug_logs.append((status_code, message))
+
+ def log_debug(self, status_code, content):
+ LOG.debug("%s: %s", status_code, content)
+ self.debug_logs.append((status_code, content))
diff --git a/ansible_collections/netapp/aws/plugins/module_utils/netapp_module.py b/ansible_collections/netapp/aws/plugins/module_utils/netapp_module.py
new file mode 100644
index 00000000..3e31ae98
--- /dev/null
+++ b/ansible_collections/netapp/aws/plugins/module_utils/netapp_module.py
@@ -0,0 +1,142 @@
+# This code is part of Ansible, but is an independent component.
+# This particular file snippet, and this file snippet only, is BSD licensed.
+# Modules you write using this snippet, which is embedded dynamically by Ansible
+# still belong to the author of the module, and may assign their own license
+# to the complete work.
+#
+# Copyright (c) 2018, Laurent Nicolas <laurentn@netapp.com>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+''' Support class for NetApp ansible modules '''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+
+def cmp(a, b):
+ """
+ Python 3 does not have a cmp function, this will do the cmp.
+ :param a: first object to check
+ :param b: second object to check
+ :return:
+ """
+ # convert to lower case for string comparison.
+ if a is None:
+ return -1
+ if isinstance(a, str) and isinstance(b, str):
+ a = a.lower()
+ b = b.lower()
+ # if list has string element, convert string to lower case.
+ if isinstance(a, list) and isinstance(b, list):
+ a = [x.lower() if isinstance(x, str) else x for x in a]
+ b = [x.lower() if isinstance(x, str) else x for x in b]
+ a.sort()
+ b.sort()
+ return (a > b) - (a < b)
+
+
+class NetAppModule(object):
+ '''
+ Common class for NetApp modules
+ set of support functions to derive actions based
+ on the current state of the system, and a desired state
+ '''
+
+ def __init__(self):
+ self.log = list()
+ self.changed = False
+ self.parameters = {'name': 'not intialized'}
+
+ def set_parameters(self, ansible_params):
+ self.parameters = dict()
+ for param in ansible_params:
+ if ansible_params[param] is not None:
+ self.parameters[param] = ansible_params[param]
+ return self.parameters
+
+ def get_cd_action(self, current, desired):
+ ''' takes a desired state and a current state, and return an action:
+ create, delete, None
+ eg:
+ is_present = 'absent'
+ some_object = self.get_object(source)
+ if some_object is not None:
+ is_present = 'present'
+ action = cd_action(current=is_present, desired = self.desired.state())
+ '''
+ if 'state' in desired:
+ desired_state = desired['state']
+ else:
+ desired_state = 'present'
+
+ if current is None and desired_state == 'absent':
+ return None
+ if current is not None and desired_state == 'present':
+ return None
+ # change in state
+ self.changed = True
+ if current is not None:
+ return 'delete'
+ return 'create'
+
+ def compare_and_update_values(self, current, desired, keys_to_compare):
+ updated_values = dict()
+ is_changed = False
+ for key in keys_to_compare:
+ if key in current:
+ if key in desired and desired[key] is not None:
+ if current[key] != desired[key]:
+ updated_values[key] = desired[key]
+ is_changed = True
+ else:
+ updated_values[key] = current[key]
+ else:
+ updated_values[key] = current[key]
+
+ return updated_values, is_changed
+
+ def is_rename_action(self, source, target):
+ ''' takes a source and target object, and returns True
+ if a rename is required
+ eg:
+ source = self.get_object(source_name)
+ target = self.get_object(target_name)
+ action = is_rename_action(source, target)
+ :return: None for error, True for rename action, False otherwise
+ '''
+ if source is None and target is None:
+ # error, do nothing
+ # cannot rename an non existent resource
+ # alternatively we could create B
+ return None
+ if source is not None and target is not None:
+ # error, do nothing
+ # idempotency (or) new_name_is_already_in_use
+ # alternatively we could delete B and rename A to B
+ return False
+ if source is None and target is not None:
+ # do nothing, maybe the rename was already done
+ return False
+ # source is not None and target is None:
+ # rename is in order
+ self.changed = True
+ return True
diff --git a/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_active_directory.py b/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_active_directory.py
new file mode 100644
index 00000000..b64c877b
--- /dev/null
+++ b/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_active_directory.py
@@ -0,0 +1,276 @@
+#!/usr/bin/python
+
+# (c) 2019, NetApp Inc.
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+"""AWS Cloud Volumes Services - Manage ActiveDirectory"""
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'certified'}
+
+
+DOCUMENTATION = '''
+
+module: aws_netapp_cvs_active_directory
+
+short_description: NetApp AWS CloudVolumes Service Manage Active Directory.
+extends_documentation_fragment:
+ - netapp.aws.netapp.awscvs
+version_added: 2.9.0
+author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>
+description:
+ - Create, Update, Delete ActiveDirectory on AWS Cloud Volumes Service.
+
+options:
+ state:
+ description:
+ - Whether the specified ActiveDirectory should exist or not.
+ choices: ['present', 'absent']
+ required: true
+ type: str
+
+ region:
+ description:
+ - The region to which the Active Directory credentials are associated.
+ required: true
+ type: str
+
+ domain:
+ description:
+ - Name of the Active Directory domain
+ type: str
+
+ DNS:
+ description:
+ - DNS server address for the Active Directory domain
+ - Required when C(state=present)
+ - Required when C(state=present), to modify ActiveDirectory properties.
+ type: str
+
+ netBIOS:
+ description:
+ - NetBIOS name of the server.
+ type: str
+
+ username:
+ description:
+ - Username of the Active Directory domain administrator
+ type: str
+
+ password:
+ description:
+ - Password of the Active Directory domain administrator
+ - Required when C(state=present), to modify ActiveDirectory properties
+ type: str
+'''
+
+EXAMPLES = """
+ - name: Create Active Directory
+ aws_netapp_cvs_active_directory.py:
+ state: present
+ region: us-east-1
+ DNS: 101.102.103.123
+ domain: mydomain.com
+ password: netapp1!
+ netBIOS: testing
+ username: user1
+ api_url : My_CVS_Hostname
+ api_key: My_API_Key
+ secret_key : My_Secret_Key
+
+ - name: Update Active Directory
+ aws_netapp_cvs_active_directory.py:
+ state: present
+ region: us-east-1
+ DNS: 101.102.103.123
+ domain: mydomain.com
+ password: netapp2!
+ netBIOS: testingBIOS
+ username: user2
+ api_url : My_CVS_Hostname
+ api_key: My_API_Key
+ secret_key : My_Secret_Key
+
+ - name: Delete Active Directory
+ aws_netapp_cvs_active_directory.py:
+ state: absent
+ region: us-east-1
+ domain: mydomain.com
+ api_url : My_CVS_Hostname
+ api_key: My_API_Key
+ secret_key : My_Secret_Key
+"""
+
+RETURN = '''
+'''
+
+from ansible.module_utils.basic import AnsibleModule
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+from ansible_collections.netapp.aws.plugins.module_utils.netapp_module import NetAppModule
+from ansible_collections.netapp.aws.plugins.module_utils.netapp import AwsCvsRestAPI
+
+
+class AwsCvsNetappActiveDir(object):
+ """
+ Contains methods to parse arguments,
+ derive details of AWS_CVS objects
+ and send requests to AWS CVS via
+ the restApi
+ """
+
+ def __init__(self):
+ """
+ Parse arguments, setup state variables,
+ check paramenters and ensure request module is installed
+ """
+ self.argument_spec = netapp_utils.aws_cvs_host_argument_spec()
+ self.argument_spec.update(dict(
+ state=dict(required=True, choices=['present', 'absent'], type='str'),
+ region=dict(required=True, type='str'),
+ DNS=dict(required=False, type='str'),
+ domain=dict(required=False, type='str'),
+ password=dict(required=False, type='str', no_log=True),
+ netBIOS=dict(required=False, type='str'),
+ username=dict(required=False, type='str')
+ ))
+
+ self.module = AnsibleModule(
+ argument_spec=self.argument_spec,
+ required_if=[
+ ('state', 'present', ['domain', 'password']),
+ ],
+ supports_check_mode=True
+ )
+
+ self.na_helper = NetAppModule()
+
+ # set up state variables
+ self.parameters = self.na_helper.set_parameters(self.module.params)
+ # Calling generic AWSCVS restApi class
+ self.rest_api = AwsCvsRestAPI(self.module)
+
+ def get_activedirectory_id(self):
+ # Check if ActiveDirectory exists
+ # Return UUID for ActiveDirectory is found, None otherwise
+ try:
+ list_activedirectory, error = self.rest_api.get('Storage/ActiveDirectory')
+ except Exception:
+ return None
+ if error is not None:
+ self.module.fail_json(msg='Error calling list_activedirectory: %s' % error)
+
+ for activedirectory in list_activedirectory:
+ if activedirectory['region'] == self.parameters['region']:
+ return activedirectory['UUID']
+ return None
+
+ def get_activedirectory(self, activedirectory_id=None):
+ if activedirectory_id is None:
+ return None
+ else:
+ activedirectory_info, error = self.rest_api.get('Storage/ActiveDirectory/%s' % activedirectory_id)
+ if not error:
+ return activedirectory_info
+ return None
+
+ def create_activedirectory(self):
+ # Create ActiveDirectory
+ api = 'Storage/ActiveDirectory'
+ data = {"region": self.parameters['region'], "DNS": self.parameters['DNS'], "domain": self.parameters['domain'],
+ "username": self.parameters['username'], "password": self.parameters['password'], "netBIOS": self.parameters['netBIOS']}
+
+ response, error = self.rest_api.post(api, data)
+
+ if not error:
+ return response
+ else:
+ self.module.fail_json(msg=response['message'])
+
+ def delete_activedirectory(self):
+ activedirectory_id = self.get_activedirectory_id()
+ # Delete ActiveDirectory
+
+ if activedirectory_id:
+ api = 'Storage/ActiveDirectory/' + activedirectory_id
+ data = None
+ response, error = self.rest_api.delete(api, data)
+ if not error:
+ return response
+ else:
+ self.module.fail_json(msg=response['message'])
+
+ else:
+ self.module.fail_json(msg="Active Directory does not exist")
+
+ def update_activedirectory(self, activedirectory_id, updated_activedirectory):
+ # Update ActiveDirectory
+ api = 'Storage/ActiveDirectory/' + activedirectory_id
+ data = {
+ "region": self.parameters['region'],
+ "DNS": updated_activedirectory['DNS'],
+ "domain": updated_activedirectory['domain'],
+ "username": updated_activedirectory['username'],
+ "password": updated_activedirectory['password'],
+ "netBIOS": updated_activedirectory['netBIOS']
+ }
+
+ response, error = self.rest_api.put(api, data)
+ if not error:
+ return response
+ else:
+ self.module.fail_json(msg=response['message'])
+
+ def apply(self):
+ """
+ Perform pre-checks, call functions and exit
+ """
+ modify = False
+ activedirectory_id = self.get_activedirectory_id()
+ current = self.get_activedirectory(activedirectory_id)
+ cd_action = self.na_helper.get_cd_action(current, self.parameters)
+
+ if current and self.parameters['state'] != 'absent':
+ keys_to_check = ['DNS', 'domain', 'username', 'netBIOS']
+ updated_active_directory, modify = self.na_helper.compare_and_update_values(current, self.parameters, keys_to_check)
+
+ if self.parameters['password']:
+ modify = True
+ updated_active_directory['password'] = self.parameters['password']
+
+ if modify is True:
+ self.na_helper.changed = True
+ if 'domain' in self.parameters and self.parameters['domain'] is not None:
+ ad_exists = self.get_activedirectory(updated_active_directory['domain'])
+ if ad_exists:
+ modify = False
+ self.na_helper.changed = False
+
+ if self.na_helper.changed:
+ if self.module.check_mode:
+ pass
+ else:
+ if modify is True:
+ self.update_activedirectory(activedirectory_id, updated_active_directory)
+ elif cd_action == 'create':
+ self.create_activedirectory()
+ elif cd_action == 'delete':
+ self.delete_activedirectory()
+
+ self.module.exit_json(changed=self.na_helper.changed)
+
+
+def main():
+ """
+ Main function
+ """
+ aws_netapp_cvs_active_directory = AwsCvsNetappActiveDir()
+ aws_netapp_cvs_active_directory.apply()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_filesystems.py b/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_filesystems.py
new file mode 100644
index 00000000..09190b39
--- /dev/null
+++ b/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_filesystems.py
@@ -0,0 +1,362 @@
+#!/usr/bin/python
+
+# (c) 2019, NetApp Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+"""AWS Cloud Volumes Services - Manage fileSystem"""
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+
+module: aws_netapp_cvs_filesystems
+
+short_description: NetApp AWS Cloud Volumes Service Manage FileSystem.
+extends_documentation_fragment:
+ - netapp.aws.netapp.awscvs
+version_added: 2.9.0
+author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>
+description:
+- Create, Update, Delete fileSystem on AWS Cloud Volumes Service.
+
+options:
+ state:
+ description:
+ - Whether the specified fileSystem should exist or not.
+ required: true
+ choices: ['present', 'absent']
+ type: str
+
+ region:
+ description:
+ - The region to which the filesystem belongs to.
+ required: true
+ type: str
+
+ creationToken:
+ description:
+ - Name of the filesystem
+ required: true
+ type: str
+
+ quotaInBytes:
+ description:
+ - Size of the filesystem
+ - Required for create
+ type: int
+
+ serviceLevel:
+ description:
+ - Service Level of a filesystem.
+ choices: ['standard', 'premium', 'extreme']
+ type: str
+
+ exportPolicy:
+ description:
+ - The policy rules to export the filesystem
+ type: dict
+ suboptions:
+ rules:
+ description:
+ - Set of rules to export the filesystem
+ - Requires allowedClients, access and protocol
+ type: list
+ elements: dict
+ suboptions:
+ allowedClients:
+ description:
+ - Comma separated list of ip address blocks of the clients to access the fileSystem
+ - Each address block contains the starting IP address and size for the block
+ type: str
+
+ cifs:
+ description:
+ - Enable or disable cifs filesystem
+ type: bool
+
+ nfsv3:
+ description:
+ - Enable or disable nfsv3 fileSystem
+ type: bool
+
+ nfsv4:
+ description:
+ - Enable or disable nfsv4 filesystem
+ type: bool
+
+ ruleIndex:
+ description:
+ - Index number of the rule
+ type: int
+
+ unixReadOnly:
+ description:
+ - Should fileSystem have read only permission or not
+ type: bool
+
+ unixReadWrite:
+ description:
+ - Should fileSystem have read write permission or not
+ type: bool
+'''
+
+EXAMPLES = """
+- name: Create FileSystem
+ aws_netapp_cvs_filesystems:
+ state: present
+ region: us-east-1
+ creationToken: newVolume-1
+ exportPolicy:
+ rules:
+ - allowedClients: 172.16.0.4
+ cifs: False
+ nfsv3: True
+ nfsv4: True
+ ruleIndex: 1
+ unixReadOnly: True
+ unixReadWrite: False
+ quotaInBytes: 100000000000
+ api_url : cds-aws-bundles.netapp.com:8080
+ api_key: My_API_Key
+ secret_key : My_Secret_Key
+
+- name: Update FileSystem
+ aws_netapp_cvs_filesystems:
+ state: present
+ region: us-east-1
+ creationToken: newVolume-1
+ exportPolicy:
+ rules:
+ - allowedClients: 172.16.0.4
+ cifs: False
+ nfsv3: True
+ nfsv4: True
+ ruleIndex: 1
+ unixReadOnly: True
+ unixReadWrite: False
+ quotaInBytes: 200000000000
+ api_url : cds-aws-bundles.netapp.com:8080
+ api_key: My_API_Key
+ secret_key : My_Secret_Key
+
+- name: Delete FileSystem
+ aws_netapp_cvs_filesystems:
+ state: present
+ region: us-east-1
+ creationToken: newVolume-1
+ quotaInBytes: 100000000000
+ api_url : cds-aws-bundles.netapp.com:8080
+ api_key: My_API_Key
+ secret_key : My_Secret_Key
+"""
+
+RETURN = """
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+from ansible_collections.netapp.aws.plugins.module_utils.netapp_module import NetAppModule
+from ansible_collections.netapp.aws.plugins.module_utils.netapp import AwsCvsRestAPI
+
+
+class AwsCvsNetappFileSystem(object):
+ """
+ Contains methods to parse arguments,
+ derive details of AWS_CVS objects
+ and send requests to AWS CVS via
+ the restApi
+ """
+
+ def __init__(self):
+ """
+ Parse arguments, setup state variables,
+ check paramenters and ensure request module is installed
+ """
+ self.argument_spec = netapp_utils.aws_cvs_host_argument_spec()
+ self.argument_spec.update(dict(
+ state=dict(required=True, choices=['present', 'absent']),
+ region=dict(required=True, type='str'),
+ creationToken=dict(required=True, type='str', no_log=False),
+ quotaInBytes=dict(required=False, type='int'),
+ serviceLevel=dict(required=False, choices=['standard', 'premium', 'extreme']),
+ exportPolicy=dict(
+ type='dict',
+ options=dict(
+ rules=dict(
+ type='list',
+ elements='dict',
+ options=dict(
+ allowedClients=dict(required=False, type='str'),
+ cifs=dict(required=False, type='bool'),
+ nfsv3=dict(required=False, type='bool'),
+ nfsv4=dict(required=False, type='bool'),
+ ruleIndex=dict(required=False, type='int'),
+ unixReadOnly=dict(required=False, type='bool'),
+ unixReadWrite=dict(required=False, type='bool')
+ )
+ )
+ )
+ ),
+ ))
+
+ self.module = AnsibleModule(
+ argument_spec=self.argument_spec,
+ required_if=[
+ ('state', 'present', ['region', 'creationToken', 'quotaInBytes']),
+ ],
+ supports_check_mode=True
+ )
+
+ self.na_helper = NetAppModule()
+
+ # set up state variables
+ self.parameters = self.na_helper.set_parameters(self.module.params)
+
+ # Calling generic AWSCVS restApi class
+ self.rest_api = AwsCvsRestAPI(self.module)
+
+ self.data = {}
+ for key in self.parameters.keys():
+ self.data[key] = self.parameters[key]
+
+ def get_filesystem_id(self):
+ # Check given FileSystem is exists
+ # Return fileSystemId is found, None otherwise
+ list_filesystem, error = self.rest_api.get('FileSystems')
+ if error:
+ self.module.fail_json(msg=error)
+
+ for filesystem in list_filesystem:
+ if filesystem['creationToken'] == self.parameters['creationToken']:
+ return filesystem['fileSystemId']
+ return None
+
+ def get_filesystem(self, filesystem_id):
+ # Get FileSystem information by fileSystemId
+ # Return fileSystem Information
+ filesystem_info, error = self.rest_api.get('FileSystems/%s' % filesystem_id)
+ if error:
+ self.module.fail_json(msg=error)
+ else:
+ return filesystem_info
+ return None
+
+ def is_job_done(self, response):
+ # check jobId is present and equal to 'done'
+ # return True on success, False otherwise
+ try:
+ job_id = response['jobs'][0]['jobId']
+ except TypeError:
+ job_id = None
+
+ if job_id is not None and self.rest_api.get_state(job_id) == 'done':
+ return True
+ return False
+
+ def create_filesystem(self):
+ # Create fileSystem
+ api = 'FileSystems'
+ response, error = self.rest_api.post(api, self.data)
+ if not error:
+ if self.is_job_done(response):
+ return
+ error = "Error: unexpected response on FileSystems create: %s" % str(response)
+ self.module.fail_json(msg=error)
+
+ def delete_filesystem(self, filesystem_id):
+ # Delete FileSystem
+ api = 'FileSystems/' + filesystem_id
+ self.data = None
+ response, error = self.rest_api.delete(api, self.data)
+ if not error:
+ if self.is_job_done(response):
+ return
+ error = "Error: unexpected response on FileSystems delete: %s" % str(response)
+ self.module.fail_json(msg=error)
+
+ def update_filesystem(self, filesystem_id):
+ # Update FileSystem
+ api = 'FileSystems/' + filesystem_id
+ response, error = self.rest_api.put(api, self.data)
+ if not error:
+ if self.is_job_done(response):
+ return
+ error = "Error: unexpected response on FileSystems update: %s" % str(response)
+ self.module.fail_json(msg=error)
+
+ def apply(self):
+ """
+ Perform pre-checks, call functions and exit
+ """
+
+ filesystem = None
+ filesystem_id = self.get_filesystem_id()
+
+ if filesystem_id:
+ # Getting the FileSystem details
+ filesystem = self.get_filesystem(filesystem_id)
+
+ cd_action = self.na_helper.get_cd_action(filesystem, self.parameters)
+
+ if cd_action is None and self.parameters['state'] == 'present':
+ # Check if we need to update the fileSystem
+ update_filesystem = False
+ if filesystem['quotaInBytes'] is not None and 'quotaInBytes' in self.parameters \
+ and filesystem['quotaInBytes'] != self.parameters['quotaInBytes']:
+ update_filesystem = True
+ elif filesystem['creationToken'] is not None and 'creationToken' in self.parameters \
+ and filesystem['creationToken'] != self.parameters['creationToken']:
+ update_filesystem = True
+ elif filesystem['serviceLevel'] is not None and 'serviceLevel' in self.parameters \
+ and filesystem['serviceLevel'] != self.parameters['serviceLevel']:
+ update_filesystem = True
+ elif 'exportPolicy' in filesystem and filesystem['exportPolicy']['rules'] is not None and 'exportPolicy' in self.parameters:
+ for rule_org in filesystem['exportPolicy']['rules']:
+ for rule in self.parameters['exportPolicy']['rules']:
+ if rule_org['allowedClients'] != rule['allowedClients']:
+ update_filesystem = True
+ elif rule_org['unixReadOnly'] != rule['unixReadOnly']:
+ update_filesystem = True
+ elif rule_org['unixReadWrite'] != rule['unixReadWrite']:
+ update_filesystem = True
+
+ if update_filesystem:
+ self.na_helper.changed = True
+
+ result_message = ""
+
+ if self.na_helper.changed:
+ if self.module.check_mode:
+ # Skip changes
+ result_message = "Check mode, skipping changes"
+ else:
+ if cd_action == "create":
+ self.create_filesystem()
+ result_message = "FileSystem Created"
+ elif cd_action == "delete":
+ self.delete_filesystem(filesystem_id)
+ result_message = "FileSystem Deleted"
+ else: # modify
+ self.update_filesystem(filesystem_id)
+ result_message = "FileSystem Updated"
+ self.module.exit_json(changed=self.na_helper.changed, msg=result_message)
+
+
+def main():
+ """
+ Main function
+ """
+ aws_cvs_netapp_filesystem = AwsCvsNetappFileSystem()
+ aws_cvs_netapp_filesystem.apply()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_pool.py b/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_pool.py
new file mode 100644
index 00000000..fa4818a3
--- /dev/null
+++ b/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_pool.py
@@ -0,0 +1,267 @@
+#!/usr/bin/python
+
+# (c) 2019, NetApp Inc.
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+"""AWS Cloud Volumes Services - Manage Pools"""
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+
+module: aws_netapp_cvs_pool
+
+short_description: NetApp AWS Cloud Volumes Service Manage Pools.
+extends_documentation_fragment:
+ - netapp.aws.netapp.awscvs
+version_added: 2.9.0
+author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>
+description:
+ - Create, Update, Delete Pool on AWS Cloud Volumes Service.
+
+options:
+ state:
+ description:
+ - Whether the specified pool should exist or not.
+ choices: ['present', 'absent']
+ required: true
+ type: str
+ region:
+ description:
+ - The region to which the Pool is associated.
+ required: true
+ type: str
+ name:
+ description:
+ - pool name ( The human readable name of the Pool )
+ - name can be used for create, update and delete operations
+ required: true
+ type: str
+ serviceLevel:
+ description:
+ - The service level of the Pool
+ - can be used with pool create, update operations
+ choices: ['basic', 'standard', 'extreme']
+ type: str
+ sizeInBytes:
+ description:
+ - Size of the Pool in bytes
+ - can be used with pool create, update operations
+ - minimum value is 4000000000000 bytes
+ type: int
+ vendorID:
+ description:
+ - A vendor ID for the Pool. E.g. an ID allocated by a vendor service for the Pool.
+ - can be used with pool create, update operations
+ - must be unique
+ type: str
+ from_name:
+ description:
+ - rename the existing pool name ( The human readable name of the Pool )
+ - I(from_name) is the existing name, and I(name) the new name
+ - can be used with update operation
+ type: str
+'''
+
+EXAMPLES = """
+- name: Create a new Pool
+ aws_netapp_cvs_pool:
+ state: present
+ name: TestPoolBB12
+ serviceLevel: extreme
+ sizeInBytes: 4000000000000
+ vendorID: ansiblePoolTestVendorBB12
+ region: us-east-1
+ api_url: cds-aws-bundles.netapp.com
+ api_key: MyAPiKey
+ secret_key: MySecretKey
+
+- name: Delete a Pool
+ aws_netapp_cvs_pool:
+ state: absent
+ name: TestPoolBB7
+ region: us-east-1
+ api_url: cds-aws-bundles.netapp.com
+ api_key: MyAPiKey
+ secret_key: MySecretKey
+
+- name: Update a Pool
+ aws_netapp_cvs_pool:
+ state: present
+ from_name: TestPoolBB12
+ name: Mynewpool7
+ vendorID: ansibleVendorMynewpool15
+ serviceLevel: extreme
+ sizeInBytes: 4000000000000
+ region: us-east-1
+ api_url: cds-aws-bundles.netapp.com
+ api_key: MyAPiKey
+ secret_key: MySecretKey
+
+"""
+
+RETURN = '''
+'''
+
+from ansible.module_utils.basic import AnsibleModule
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+from ansible_collections.netapp.aws.plugins.module_utils.netapp_module import NetAppModule
+from ansible_collections.netapp.aws.plugins.module_utils.netapp import AwsCvsRestAPI
+
+
+class NetAppAWSCVS(object):
+ '''Class for Pool operations '''
+
+ def __init__(self):
+ """
+ Parse arguments, setup state variables,
+ """
+ self.argument_spec = netapp_utils.aws_cvs_host_argument_spec()
+ self.argument_spec.update(dict(
+ state=dict(required=True, choices=['present', 'absent']),
+ region=dict(required=True, type='str'),
+ name=dict(required=True, type='str'),
+ from_name=dict(required=False, type='str'),
+ serviceLevel=dict(required=False, choices=['basic', 'standard', 'extreme'], type='str'),
+ sizeInBytes=dict(required=False, type='int'),
+ vendorID=dict(required=False, type='str'),
+ ))
+ self.module = AnsibleModule(
+ argument_spec=self.argument_spec,
+ supports_check_mode=True
+ )
+
+ self.na_helper = NetAppModule()
+ self.parameters = self.na_helper.set_parameters(self.module.params)
+ self.rest_api = AwsCvsRestAPI(self.module)
+ self.sizeinbytes_min_value = 4000000000000
+
+ def get_aws_netapp_cvs_pool(self, name=None):
+ """
+ Returns Pool object if exists else Return None
+ """
+ pool_info = None
+
+ if name is None:
+ name = self.parameters['name']
+
+ pools, error = self.rest_api.get('Pools')
+
+ if error is None and pools is not None:
+ for pool in pools:
+ if 'name' in pool and pool['region'] == self.parameters['region']:
+ if pool['name'] == name:
+ pool_info = pool
+ break
+
+ return pool_info
+
+ def create_aws_netapp_cvs_pool(self):
+ """
+ Create a pool
+ """
+ api = 'Pools'
+
+ for key in ['serviceLevel', 'sizeInBytes', 'vendorID']:
+ if key not in self.parameters.keys() or self.parameters[key] is None:
+ self.module.fail_json(changed=False, msg="Mandatory key '%s' required" % (key))
+
+ pool = {
+ "name": self.parameters['name'],
+ "region": self.parameters['region'],
+ "serviceLevel": self.parameters['serviceLevel'],
+ "sizeInBytes": self.parameters['sizeInBytes'],
+ "vendorID": self.parameters['vendorID']
+ }
+
+ dummy, error = self.rest_api.post(api, pool)
+ if error is not None:
+ self.module.fail_json(changed=False, msg=error)
+
+ def update_aws_netapp_cvs_pool(self, update_pool_info, pool_id):
+ """
+ Update a pool
+ """
+ api = 'Pools/' + pool_id
+
+ pool = {
+ "name": update_pool_info['name'],
+ "region": self.parameters['region'],
+ "serviceLevel": update_pool_info['serviceLevel'],
+ "sizeInBytes": update_pool_info['sizeInBytes'],
+ "vendorID": update_pool_info['vendorID']
+ }
+
+ dummy, error = self.rest_api.put(api, pool)
+ if error is not None:
+ self.module.fail_json(changed=False, msg=error)
+
+ def delete_aws_netapp_cvs_pool(self, pool_id):
+ """
+ Delete a pool
+ """
+ api = 'Pools/' + pool_id
+ data = None
+ dummy, error = self.rest_api.delete(api, data)
+
+ if error is not None:
+ self.module.fail_json(changed=False, msg=error)
+
+ def apply(self):
+ """
+ Perform pre-checks, call functions and exit
+ """
+ update_required = False
+ cd_action = None
+
+ if 'sizeInBytes' in self.parameters.keys() and self.parameters['sizeInBytes'] < self.sizeinbytes_min_value:
+ self.module.fail_json(changed=False, msg="sizeInBytes should be greater than or equal to %d" % (self.sizeinbytes_min_value))
+
+ current = self.get_aws_netapp_cvs_pool()
+ if self.parameters.get('from_name'):
+ existing = self.get_aws_netapp_cvs_pool(self.parameters['from_name'])
+ rename = self.na_helper.is_rename_action(existing, current)
+ if rename is None:
+ self.module.fail_json(changed=False, msg="unable to rename pool: '%s' does not exist" % self.parameters['from_name'])
+ if rename:
+ current = existing
+ else:
+ cd_action = self.na_helper.get_cd_action(current, self.parameters)
+
+ if cd_action is None and self.parameters['state'] == 'present':
+ keys_to_check = ['name', 'vendorID', 'sizeInBytes', 'serviceLevel']
+ update_pool_info, update_required = self.na_helper.compare_and_update_values(current, self.parameters, keys_to_check)
+
+ if update_required is True:
+ self.na_helper.changed = True
+ cd_action = 'update'
+
+ if self.na_helper.changed:
+ if self.module.check_mode:
+ pass
+ else:
+ if cd_action == 'update':
+ self.update_aws_netapp_cvs_pool(update_pool_info, current['poolId'])
+ elif cd_action == 'create':
+ self.create_aws_netapp_cvs_pool()
+ elif cd_action == 'delete':
+ self.delete_aws_netapp_cvs_pool(current['poolId'])
+
+ self.module.exit_json(changed=self.na_helper.changed)
+
+
+def main():
+ '''Main Function'''
+ aws_cvs_netapp_pool = NetAppAWSCVS()
+ aws_cvs_netapp_pool.apply()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_snapshots.py b/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_snapshots.py
new file mode 100644
index 00000000..fa5c5f87
--- /dev/null
+++ b/ansible_collections/netapp/aws/plugins/modules/aws_netapp_cvs_snapshots.py
@@ -0,0 +1,245 @@
+#!/usr/bin/python
+
+# (c) 2019, NetApp Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+"""AWS Cloud Volumes Services - Manage Snapshots"""
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+
+ANSIBLE_METADATA = {'metadata_version': '1.1',
+ 'status': ['preview'],
+ 'supported_by': 'community'}
+
+
+DOCUMENTATION = '''
+
+module: aws_netapp_cvs_snapshots
+
+short_description: NetApp AWS Cloud Volumes Service Manage Snapshots.
+extends_documentation_fragment:
+ - netapp.aws.netapp.awscvs
+version_added: 2.9.0
+author: NetApp Ansible Team (@carchi8py) <ng-ansibleteam@netapp.com>
+description:
+- Create, Update, Delete Snapshot on AWS Cloud Volumes Service.
+
+options:
+ state:
+ description:
+ - Whether the specified snapshot should exist or not.
+ required: true
+ type: str
+ choices: ['present', 'absent']
+
+ region:
+ description:
+ - The region to which the snapshot belongs to.
+ required: true
+ type: str
+
+ name:
+ description:
+ - Name of the snapshot
+ required: true
+ type: str
+
+ fileSystemId:
+ description:
+ - Name or Id of the filesystem.
+ - Required for create operation
+ type: str
+
+ from_name:
+ description:
+ - ID or Name of the snapshot to rename.
+ - Required to create an snapshot called 'name' by renaming 'from_name'.
+ type: str
+'''
+
+EXAMPLES = """
+- name: Create Snapshot
+ aws_netapp_cvs_snapshots:
+ state: present
+ region: us-east-1
+ name: testSnapshot
+ fileSystemId: testVolume
+ api_url : cds-aws-bundles.netapp.com
+ api_key: myApiKey
+ secret_key : mySecretKey
+
+- name: Update Snapshot
+ aws_netapp_cvs_snapshots:
+ state: present
+ region: us-east-1
+ name: testSnapshot - renamed
+ from_name: testSnapshot
+ fileSystemId: testVolume
+ api_url : cds-aws-bundles.netapp.com
+ api_key: myApiKey
+ secret_key : mySecretKey
+
+- name: Delete Snapshot
+ aws_netapp_cvs_snapshots:
+ state: absent
+ region: us-east-1
+ name: testSnapshot
+ api_url : cds-aws-bundles.netapp.com
+ api_key: myApiKey
+ secret_key : mySecretKey
+"""
+
+RETURN = """
+"""
+
+from ansible.module_utils.basic import AnsibleModule
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+from ansible_collections.netapp.aws.plugins.module_utils.netapp_module import NetAppModule
+from ansible_collections.netapp.aws.plugins.module_utils.netapp import AwsCvsRestAPI
+
+
+class AwsCvsNetappSnapshot(object):
+ """
+ Contains methods to parse arguments,
+ derive details of AWS_CVS objects
+ and send requests to AWS CVS via
+ the restApi
+ """
+
+ def __init__(self):
+ """
+ Parse arguments, setup state variables,
+ check paramenters and ensure request module is installed
+ """
+ self.argument_spec = netapp_utils.aws_cvs_host_argument_spec()
+ self.argument_spec.update(dict(
+ state=dict(required=True, choices=['present', 'absent']),
+ region=dict(required=True, type='str'),
+ name=dict(required=True, type='str'),
+ from_name=dict(required=False, type='str'),
+ fileSystemId=dict(required=False, type='str')
+ ))
+
+ self.module = AnsibleModule(
+ argument_spec=self.argument_spec,
+ required_if=[
+ ('state', 'present', ['fileSystemId']),
+ ],
+ supports_check_mode=True
+ )
+
+ self.na_helper = NetAppModule()
+
+ # set up state variables
+ self.parameters = self.na_helper.set_parameters(self.module.params)
+ # Calling generic AWSCVS restApi class
+ self.rest_api = AwsCvsRestAPI(self.module)
+
+ # Checking for the parameters passed and create new parameters list
+ self.data = {}
+ for key in self.parameters.keys():
+ self.data[key] = self.parameters[key]
+
+ def get_snapshot_id(self, name):
+ # Check if snapshot exists
+ # Return snpashot Id If Snapshot is found, None otherwise
+ list_snapshots, error = self.rest_api.get('Snapshots')
+
+ if error:
+ self.module.fail_json(msg=error)
+
+ for snapshot in list_snapshots:
+ if snapshot['name'] == name:
+ return snapshot['snapshotId']
+ return None
+
+ def get_filesystem_id(self):
+ # Check given FileSystem is exists
+ # Return fileSystemId is found, None otherwise
+ list_filesystem, error = self.rest_api.get('FileSystems')
+
+ if error:
+ self.module.fail_json(msg=error)
+ for filesystem in list_filesystem:
+ if filesystem['fileSystemId'] == self.parameters['fileSystemId']:
+ return filesystem['fileSystemId']
+ elif filesystem['creationToken'] == self.parameters['fileSystemId']:
+ return filesystem['fileSystemId']
+ return None
+
+ def create_snapshot(self):
+ # Create Snapshot
+ api = 'Snapshots'
+ dummy, error = self.rest_api.post(api, self.data)
+ if error:
+ self.module.fail_json(msg=error)
+
+ def rename_snapshot(self, snapshot_id):
+ # Rename Snapshot
+ api = 'Snapshots/' + snapshot_id
+ dummy, error = self.rest_api.put(api, self.data)
+ if error:
+ self.module.fail_json(msg=error)
+
+ def delete_snapshot(self, snapshot_id):
+ # Delete Snapshot
+ api = 'Snapshots/' + snapshot_id
+ dummy, error = self.rest_api.delete(api, self.data)
+ if error:
+ self.module.fail_json(msg=error)
+
+ def apply(self):
+ """
+ Perform pre-checks, call functions and exit
+ """
+ self.snapshot_id = self.get_snapshot_id(self.data['name'])
+
+ if self.snapshot_id is None and 'fileSystemId' in self.data:
+ self.filesystem_id = self.get_filesystem_id()
+ self.data['fileSystemId'] = self.filesystem_id
+ if self.filesystem_id is None:
+ self.module.fail_json(msg='Error: Specified filesystem id %s does not exist ' % self.data['fileSystemId'])
+
+ cd_action = self.na_helper.get_cd_action(self.snapshot_id, self.data)
+ result_message = ""
+ if self.na_helper.changed:
+ if self.module.check_mode:
+ # Skip changes
+ result_message = "Check mode, skipping changes"
+ else:
+ if cd_action == "delete":
+ self.delete_snapshot(self.snapshot_id)
+ result_message = "Snapshot Deleted"
+
+ elif cd_action == "create":
+ if 'from_name' in self.data:
+ # If cd_action is craete and from_name is given
+ snapshot_id = self.get_snapshot_id(self.data['from_name'])
+ if snapshot_id is not None:
+ # If resource pointed by from_name exists, rename the snapshot to name
+ self.rename_snapshot(snapshot_id)
+ result_message = "Snapshot Updated"
+ else:
+ # If resource pointed by from_name does not exists, error out
+ self.module.fail_json(msg="Resource does not exist : %s" % self.data['from_name'])
+ else:
+ self.create_snapshot()
+ # If from_name is not defined, Create from scratch.
+ result_message = "Snapshot Created"
+
+ self.module.exit_json(changed=self.na_helper.changed, msg=result_message)
+
+
+def main():
+ """
+ Main function
+ """
+ aws_netapp_cvs_snapshots = AwsCvsNetappSnapshot()
+ aws_netapp_cvs_snapshots.apply()
+
+
+if __name__ == '__main__':
+ main()
diff --git a/ansible_collections/netapp/aws/requirements.txt b/ansible_collections/netapp/aws/requirements.txt
new file mode 100644
index 00000000..663bd1f6
--- /dev/null
+++ b/ansible_collections/netapp/aws/requirements.txt
@@ -0,0 +1 @@
+requests \ No newline at end of file
diff --git a/ansible_collections/netapp/aws/tests/unit/compat/__init__.py b/ansible_collections/netapp/aws/tests/unit/compat/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/compat/__init__.py
diff --git a/ansible_collections/netapp/aws/tests/unit/compat/builtins.py b/ansible_collections/netapp/aws/tests/unit/compat/builtins.py
new file mode 100644
index 00000000..f60ee678
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/compat/builtins.py
@@ -0,0 +1,33 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+#
+# Compat for python2.7
+#
+
+# One unittest needs to import builtins via __import__() so we need to have
+# the string that represents it
+try:
+ import __builtin__
+except ImportError:
+ BUILTINS = 'builtins'
+else:
+ BUILTINS = '__builtin__'
diff --git a/ansible_collections/netapp/aws/tests/unit/compat/mock.py b/ansible_collections/netapp/aws/tests/unit/compat/mock.py
new file mode 100644
index 00000000..0972cd2e
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/compat/mock.py
@@ -0,0 +1,122 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+'''
+Compat module for Python3.x's unittest.mock module
+'''
+import sys
+
+# Python 2.7
+
+# Note: Could use the pypi mock library on python3.x as well as python2.x. It
+# is the same as the python3 stdlib mock library
+
+try:
+ # Allow wildcard import because we really do want to import all of mock's
+ # symbols into this compat shim
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ from unittest.mock import *
+except ImportError:
+ # Python 2
+ # pylint: disable=wildcard-import,unused-wildcard-import
+ try:
+ from mock import *
+ except ImportError:
+ print('You need the mock library installed on python2.x to run tests')
+
+
+# Prior to 3.4.4, mock_open cannot handle binary read_data
+if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
+ file_spec = None
+
+ def _iterate_read_data(read_data):
+ # Helper for mock_open:
+ # Retrieve lines from read_data via a generator so that separate calls to
+ # readline, read, and readlines are properly interleaved
+ sep = b'\n' if isinstance(read_data, bytes) else '\n'
+ data_as_list = [l + sep for l in read_data.split(sep)]
+
+ if data_as_list[-1] == sep:
+ # If the last line ended in a newline, the list comprehension will have an
+ # extra entry that's just a newline. Remove this.
+ data_as_list = data_as_list[:-1]
+ else:
+ # If there wasn't an extra newline by itself, then the file being
+ # emulated doesn't have a newline to end the last line remove the
+ # newline that our naive format() added
+ data_as_list[-1] = data_as_list[-1][:-1]
+
+ for line in data_as_list:
+ yield line
+
+ def mock_open(mock=None, read_data=''):
+ """
+ A helper function to create a mock to replace the use of `open`. It works
+ for `open` called directly or used as a context manager.
+
+ The `mock` argument is the mock object to configure. If `None` (the
+ default) then a `MagicMock` will be created for you, with the API limited
+ to methods or attributes available on standard file handles.
+
+ `read_data` is a string for the `read` methoddline`, and `readlines` of the
+ file handle to return. This is an empty string by default.
+ """
+ def _readlines_side_effect(*args, **kwargs):
+ if handle.readlines.return_value is not None:
+ return handle.readlines.return_value
+ return list(_data)
+
+ def _read_side_effect(*args, **kwargs):
+ if handle.read.return_value is not None:
+ return handle.read.return_value
+ return type(read_data)().join(_data)
+
+ def _readline_side_effect():
+ if handle.readline.return_value is not None:
+ while True:
+ yield handle.readline.return_value
+ for line in _data:
+ yield line
+
+ global file_spec
+ if file_spec is None:
+ import _io
+ file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
+
+ if mock is None:
+ mock = MagicMock(name='open', spec=open)
+
+ handle = MagicMock(spec=file_spec)
+ handle.__enter__.return_value = handle
+
+ _data = _iterate_read_data(read_data)
+
+ handle.write.return_value = None
+ handle.read.return_value = None
+ handle.readline.return_value = None
+ handle.readlines.return_value = None
+
+ handle.read.side_effect = _read_side_effect
+ handle.readline.side_effect = _readline_side_effect()
+ handle.readlines.side_effect = _readlines_side_effect
+
+ mock.return_value = handle
+ return mock
diff --git a/ansible_collections/netapp/aws/tests/unit/compat/unittest.py b/ansible_collections/netapp/aws/tests/unit/compat/unittest.py
new file mode 100644
index 00000000..73a20cf8
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/compat/unittest.py
@@ -0,0 +1,44 @@
+# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
+#
+# This file is part of Ansible
+#
+# Ansible is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Ansible is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+'''
+Compat module for Python2.7's unittest module
+'''
+
+import sys
+
+import pytest
+
+# Allow wildcard import because we really do want to import all of
+# unittests's symbols into this compat shim
+# pylint: disable=wildcard-import,unused-wildcard-import
+if sys.version_info < (2, 7):
+ try:
+ # Need unittest2 on python2.6
+ from unittest2 import *
+ except ImportError:
+ print('You need unittest2 installed on python2.6.x to run tests')
+
+ class TestCase:
+ """ skip everything """
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as unittest2 may not be available')
+else:
+ from unittest import *
diff --git a/ansible_collections/netapp/aws/tests/unit/plugins/module_utils/test_netapp.py b/ansible_collections/netapp/aws/tests/unit/plugins/module_utils/test_netapp.py
new file mode 100644
index 00000000..2fb3b7ba
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/plugins/module_utils/test_netapp.py
@@ -0,0 +1,195 @@
+# Copyright (c) 2018 NetApp
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests for module_utils netapp.py '''
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import json
+import os.path
+import sys
+import tempfile
+
+import pytest
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.aws.tests.unit.compat.mock import patch
+
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+
+
+if not netapp_utils.HAS_REQUESTS and sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+SRR = {
+ 'empty_good': (dict(), None),
+ 'get_data': (dict(records=['data1', 'data2']), None),
+ 'end_of_sequence': (None, "Unexpected call to send_request"),
+ 'generic_error': (None, "Expected error"),
+}
+
+
+def mock_args(feature_flags=None):
+ args = {
+ 'api_key': 'api_key',
+ 'api_url': 'api_url',
+ 'secret_key': 'secret_key!',
+ }
+ if feature_flags is not None:
+ args.update({'feature_flags': feature_flags})
+ return args
+
+
+def create_module(args):
+ argument_spec = netapp_utils.aws_cvs_host_argument_spec()
+ set_module_args(args)
+ module = basic.AnsibleModule(argument_spec)
+ return module
+
+
+def create_restapi_object(args):
+ module = create_module(args)
+ module.fail_json = fail_json
+ rest_api = netapp_utils.AwsCvsRestAPI(module)
+ return rest_api
+
+
+class mockResponse:
+ def __init__(self, json_data, status_code, raise_action=None):
+ self.json_data = json_data
+ self.status_code = status_code
+ self.content = json_data
+ self.raise_action = raise_action
+
+ def raise_for_status(self):
+ pass
+
+ def json(self):
+ if self.raise_action == 'bad_json':
+ raise ValueError(self.raise_action)
+ return self.json_data
+
+
+@patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.send_request')
+def test_empty_get(mock_request):
+ ''' get with no data '''
+ mock_request.side_effect = [
+ SRR['empty_good'],
+ SRR['end_of_sequence'],
+ ]
+ rest_api = create_restapi_object(mock_args())
+ message, error = rest_api.get('api', None)
+ assert not error
+ assert len(message) == 0
+
+
+@patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.send_request')
+def test_get_data(mock_request):
+ ''' get with data '''
+ mock_request.side_effect = [
+ SRR['get_data'],
+ SRR['end_of_sequence'],
+ ]
+ rest_api = create_restapi_object(mock_args())
+ message, error = rest_api.get('api', None)
+ assert not error
+ print('get:', message)
+ assert message['records'] == SRR['get_data'][0]['records']
+
+
+def test_has_feature_success_default_0():
+ ''' existing feature_flag with default of False'''
+ flag = 'trace_apis'
+ module = create_module(mock_args())
+ value = netapp_utils.has_feature(module, flag)
+ assert not value
+
+
+def test_has_feature_success_default_1():
+ ''' existing feature_flag with default of True'''
+ flag = 'strict_json_check'
+ module = create_module(mock_args())
+ value = netapp_utils.has_feature(module, flag)
+ assert value
+
+
+def test_has_feature_success_user_true():
+ ''' existing feature_flag with value set to True '''
+ flag = 'user_deprecation_warning'
+ args = dict(mock_args({flag: True}))
+ module = create_module(args)
+ value = netapp_utils.has_feature(module, flag)
+ assert value
+
+
+def test_has_feature_success_user_false():
+ ''' existing feature_flag with value set to False '''
+ flag = 'user_deprecation_warning'
+ args = dict(mock_args({flag: False}))
+ print(args)
+ module = create_module(args)
+ value = netapp_utils.has_feature(module, flag)
+ assert not value
+
+
+def test_has_feature_invalid_key():
+ ''' existing feature_flag with unknown key '''
+ flag = 'deprecation_warning_bad_key'
+ module = create_module(mock_args())
+ # replace ANsible fail method with ours
+ module.fail_json = fail_json
+ with pytest.raises(AnsibleFailJson) as exc:
+ netapp_utils.has_feature(module, flag)
+ msg = 'Internal error: unexpected feature flag: %s' % flag
+ assert exc.value.args[0]['msg'] == msg
+
+
+@patch('requests.request')
+def test_empty_get_sent(mock_request):
+ ''' get with no data '''
+ mock_request.return_value = mockResponse(json_data=dict(_links='me'), status_code=200)
+ rest_api = create_restapi_object(mock_args())
+ message, error = rest_api.get('api', None)
+ assert not error
+ # only one key (_links)
+ assert len(message) == 1
+
+
+@patch('requests.request')
+def test_empty_get_sent_bad_json(mock_request):
+ ''' get with no data '''
+ mock_request.return_value = mockResponse(json_data='anything', status_code=200, raise_action='bad_json')
+ rest_api = create_restapi_object(mock_args())
+ message, error = rest_api.get('api', None)
+ assert error
+ assert 'Expecting json, got: anything' in error
+ print('errors:', rest_api.errors)
+ print('debug:', rest_api.debug_logs)
+
+
+@patch('requests.request')
+def test_empty_get_sent_bad_but_empty_json(mock_request):
+ ''' get with no data '''
+ mock_request.return_value = mockResponse(json_data='', status_code=200, raise_action='bad_json')
+ rest_api = create_restapi_object(mock_args())
+ message, error = rest_api.get('api', None)
+ assert error is None
+ assert message is None
diff --git a/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_active_directory.py b/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_active_directory.py
new file mode 100644
index 00000000..98755b93
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_active_directory.py
@@ -0,0 +1,117 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests ONTAP Ansible module: '''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+import json
+import pytest
+import sys
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.aws.tests.unit.compat import unittest
+from ansible_collections.netapp.aws.tests.unit.compat.mock import patch
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+
+from ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_active_directory \
+ import AwsCvsNetappActiveDir as ad_module
+
+
+if not netapp_utils.HAS_REQUESTS and sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleExitJson(Exception):
+ """Exception class to be raised by module.exit_json and caught by the test case"""
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def exit_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over exit_json; package return data into an exception"""
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class TestMyModule(unittest.TestCase):
+ ''' a group of related Unit Tests '''
+
+ def setUp(self):
+ self.mock_module_helper = patch.multiple(basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json)
+ self.mock_module_helper.start()
+ self.addCleanup(self.mock_module_helper.stop)
+
+ def set_default_args_fail_check(self):
+ return dict({
+ 'state': 'present',
+ 'DNS': '101.102.103.123',
+ 'domain': 'mydomain.com',
+ 'password': 'netapp1!',
+ 'username': 'myuser',
+ 'api_url': 'myapiurl.com',
+ 'secret_key': 'mysecretkey',
+ 'api_key': 'myapikey'
+ })
+
+ def set_default_args_pass_check(self):
+ return dict({
+ 'state': 'present',
+ 'DNS': '101.102.103.123',
+ 'domain': 'mydomain.com',
+ 'password': 'netapp1!',
+ 'region': 'us-east-1',
+ 'netBIOS': 'testing',
+ 'username': 'myuser',
+ 'api_url': 'myapiurl.com',
+ 'secret_key': 'mysecretkey',
+ 'api_key': 'myapikey'
+ })
+
+ def test_module_fail_when_required_args_missing(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleFailJson) as exc:
+ set_module_args(self.set_default_args_fail_check())
+ ad_module()
+ print('Info: %s' % exc.value.args[0]['msg'])
+
+ def test_module_fail_when_required_args_present(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleExitJson) as exc:
+ set_module_args(self.set_default_args_pass_check())
+ ad_module()
+ exit_json(changed=True, msg="TestCase Fail when required ars are present")
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_active_directory.AwsCvsNetappActiveDir.get_activedirectory_id')
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_active_directory.AwsCvsNetappActiveDir.get_activedirectory')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.post')
+ def test_create_aws_netapp_cvs_activedir(self, get_post_api, get_aws_api, get_ad_id):
+ set_module_args(self.set_default_args_pass_check())
+ my_obj = ad_module()
+
+ get_aws_api.return_value = None
+ get_post_api.return_value = None, None
+ get_ad_id.return_value = "123"
+ with pytest.raises(AnsibleExitJson) as exc:
+ my_obj.apply()
+ print('Info: test_create_aws_netapp_cvs_active_directory: %s' % repr(exc.value))
+ assert exc.value.args[0]['changed']
diff --git a/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_filesystems.py b/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_filesystems.py
new file mode 100644
index 00000000..b5a4bad8
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_filesystems.py
@@ -0,0 +1,155 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests AWS CVS FileSystems Ansible module: aws_netapp_cvs_filesystems'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import json
+import pytest
+import sys
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.aws.tests.unit.compat import unittest
+from ansible_collections.netapp.aws.tests.unit.compat.mock import patch
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+
+from ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_filesystems \
+ import AwsCvsNetappFileSystem as fileSystem_module
+
+
+if not netapp_utils.HAS_REQUESTS and sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleExitJson(Exception):
+ """Exception class to be raised by module.exit_json and caught by the test case"""
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def exit_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over exit_json; package return data into an exception"""
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class TestMyModule(unittest.TestCase):
+ ''' a group of related Unit Tests '''
+
+ def setUp(self):
+ self.mock_module_helper = patch.multiple(basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json)
+ self.mock_module_helper.start()
+ self.addCleanup(self.mock_module_helper.stop)
+
+ def set_default_args_fail_check(self):
+ return dict({
+ 'creationToken': 'TestFilesystem',
+ 'region': 'us-east-1',
+ 'quotaInBytes': 3424,
+ 'serviceLevel': 'standard',
+ 'api_url': 'hostname.com',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_default_args_pass_check(self):
+ return dict({
+ 'state': 'present',
+ 'creationToken': 'TestFilesystem',
+ 'region': 'us-east-1',
+ 'quotaInBytes': 3424,
+ 'serviceLevel': 'standard',
+ 'api_url': 'hostname.com',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_args_create_aws_netapp_cvs_filesystems(self):
+ return dict({
+ 'state': 'present',
+ 'creationToken': 'TestFilesystem',
+ 'region': 'us-east-1',
+ 'quotaInBytes': 3424,
+ 'serviceLevel': 'standard',
+ 'api_url': 'hostname.com',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_args_delete_aws_netapp_cvs_filesystems(self):
+ return dict({
+ 'state': 'absent',
+ 'creationToken': 'TestFilesystem',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.com',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def test_module_fail_when_required_args_missing(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleFailJson) as exc:
+ set_module_args(self.set_default_args_fail_check())
+ fileSystem_module()
+ print('Info: test_module_fail_when_required_args_missing: %s' % exc.value.args[0]['msg'])
+
+ def test_module_fail_when_required_args_present(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleExitJson) as exc:
+ set_module_args(self.set_default_args_pass_check())
+ fileSystem_module()
+ exit_json(changed=True, msg="Induced arguments check")
+ print('Info: test_module_fail_when_required_args_present: %s' % exc.value.args[0]['msg'])
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_filesystems.AwsCvsNetappFileSystem.get_filesystem_id')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.get_state')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.post')
+ def test_create_aws_netapp_cvs_snapshots_pass(self, get_post_api, get_state_api, get_filesystem_id):
+ set_module_args(self.set_args_create_aws_netapp_cvs_filesystems())
+ my_obj = fileSystem_module()
+ get_filesystem_id.return_value = None
+ get_state_api.return_value = 'done'
+ response = {'jobs': [{'jobId': 'dummy'}]}
+ get_post_api.return_value = response, None
+ with pytest.raises(AnsibleExitJson) as exc:
+ my_obj.apply()
+ print('Info: test_create_aws_netapp_cvs_filesystem_pass: %s' % repr(exc.value.args[0]))
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_filesystems.AwsCvsNetappFileSystem.get_filesystem_id')
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_filesystems.AwsCvsNetappFileSystem.get_filesystem')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.get_state')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.delete')
+ def test_delete_aws_netapp_cvs_snapshots_pass(self, get_post_api, get_state_api, get_filesystem, get_filesystem_id):
+ set_module_args(self.set_args_delete_aws_netapp_cvs_filesystems())
+ my_obj = fileSystem_module()
+ get_filesystem_id.return_value = '432-432-532423-4232'
+ get_filesystem.return_value = 'dummy'
+ get_state_api.return_value = 'done'
+ response = {'jobs': [{'jobId': 'dummy'}]}
+ get_post_api.return_value = response, None
+ with pytest.raises(AnsibleExitJson) as exc:
+ my_obj.apply()
+ print('Info: test_create_aws_netapp_cvs_filesyste_pass: %s' % repr(exc.value.args[0]))
+ assert exc.value.args[0]['changed']
diff --git a/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_pool.py b/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_pool.py
new file mode 100644
index 00000000..26e822de
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_pool.py
@@ -0,0 +1,258 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' Unit tests for AWS Cloud Volumes Services - Manage Pools '''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+import json
+import pytest
+import sys
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.aws.tests.unit.compat import unittest
+from ansible_collections.netapp.aws.tests.unit.compat.mock import patch
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+
+from ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_pool \
+ import NetAppAWSCVS as pool_module
+
+
+if not netapp_utils.HAS_REQUESTS and sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleExitJson(Exception):
+ """Exception class to be raised by module.exit_json and caught by the test case"""
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def exit_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over exit_json; package return data into an exception"""
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class TestMyModule(unittest.TestCase):
+ ''' a group of related Unit Tests '''
+
+ def setUp(self):
+ self.mock_module_helper = patch.multiple(basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json)
+ self.mock_module_helper.start()
+ self.addCleanup(self.mock_module_helper.stop)
+
+ def set_default_args_fail_check(self):
+ return dict({
+ 'from_name': 'TestPoolAA',
+ 'name': 'TestPoolAA_new',
+ 'serviceLevel': 'standard',
+ 'sizeInBytes': 4000000000000,
+ 'vendorID': 'ansiblePoolTestVendorA',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.invalid',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_default_args_pass_check(self):
+ return dict({
+ 'state': 'present',
+ 'from_name': 'TestPoolAA',
+ 'name': 'TestPoolAA_new',
+ 'serviceLevel': 'standard',
+ 'sizeInBytes': 4000000000000,
+ 'vendorID': 'ansiblePoolTestVendorA',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.invalid',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_args_create_aws_netapp_cvs_pool(self):
+ return dict({
+ 'state': 'present',
+ 'name': 'TestPoolAA',
+ 'serviceLevel': 'standard',
+ 'sizeInBytes': 4000000000000,
+ 'vendorID': 'ansiblePoolTestVendorA',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.invalid',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_args_update_aws_netapp_cvs_pool(self):
+ return dict({
+ 'state': 'present',
+ 'from_name': 'TestPoolAA',
+ 'name': 'TestPoolAA_new',
+ 'serviceLevel': 'standard',
+ 'sizeInBytes': 4000000000000,
+ 'vendorID': 'ansiblePoolTestVendorA',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.invalid',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_args_delete_aws_netapp_cvs_pool(self):
+ return dict({
+ 'state': 'absent',
+ 'name': 'TestPoolAA',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.invalid',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def test_module_fail_when_required_args_missing(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleFailJson) as exc:
+ set_module_args(self.set_default_args_fail_check())
+ pool_module()
+ print('Info: test_module_fail_when_required_args_missing: %s' % exc.value.args[0]['msg'])
+
+ def test_module_pass_when_required_args_present(self):
+ ''' required arguments are present '''
+ with pytest.raises(AnsibleExitJson) as exc:
+ set_module_args(self.set_default_args_pass_check())
+ pool_module()
+ exit_json(changed=True, msg="Induced arguments check")
+ print('Info: test_module_pass_when_required_args_present: %s' % exc.value.args[0]['msg'])
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_pool.NetAppAWSCVS.get_aws_netapp_cvs_pool')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.put')
+ def test_update_aws_netapp_cvs_pool_pass(self, get_put_api, get_aws_api):
+ set_module_args(self.set_args_update_aws_netapp_cvs_pool())
+ my_obj = pool_module()
+ my_pool = {
+ "name": "Dummyname",
+ "poolId": "1f63b3d0-4fd4-b4fe-1ed6-c62f5f20d975",
+ "region": "us-east-1",
+ "serviceLevel": "extreme",
+ "sizeInBytes": 40000000000000000,
+ "state": "available",
+ "vendorID": "Dummy"
+ }
+ get_aws_api.return_value = my_pool
+ get_put_api.return_value = my_pool, None
+ with pytest.raises(AnsibleExitJson) as exc:
+ my_obj.apply()
+ print('Info: test_update_aws_netapp_cvs_pool_pass: %s' % repr(exc.value))
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_pool.NetAppAWSCVS.get_aws_netapp_cvs_pool')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.put')
+ def test_update_aws_netapp_cvs_pool_fail(self, get_put_api, get_aws_api):
+ set_module_args(self.set_args_update_aws_netapp_cvs_pool())
+ my_obj = pool_module()
+ my_pool = {
+ "name": "Dummyname",
+ "poolId": "1f63b3d0-4fd4-b4fe-1ed6-c62f5f20d975",
+ "region": "us-east-1",
+ "serviceLevel": "extreme",
+ "sizeInBytes": 40000000000000000,
+ "state": "available",
+ "vendorID": "Dummy"
+ }
+ get_put_api.return_value = my_pool, "Error"
+ get_aws_api.return_value = my_pool
+ with pytest.raises(AnsibleFailJson) as exc:
+ my_obj.apply()
+ print('Info: test_update_aws_netapp_cvs_pool_fail: %s' % repr(exc.value))
+ assert exc.value.args[0]['msg'] is not None
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_pool.NetAppAWSCVS.get_aws_netapp_cvs_pool')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.post')
+ def test_create_aws_netapp_cvs_pool_pass(self, get_post_api, get_aws_api):
+ set_module_args(self.set_args_create_aws_netapp_cvs_pool())
+ my_obj = pool_module()
+ get_aws_api.return_value = None
+ get_post_api.return_value = None, None
+ with pytest.raises(AnsibleExitJson) as exc:
+ my_obj.apply()
+ print('Info: test_create_aws_netapp_cvs_pool_pass: %s' % repr(exc.value))
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_pool.NetAppAWSCVS.get_aws_netapp_cvs_pool')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.post')
+ def test_create_aws_netapp_cvs_pool_fail(self, get_post_api, get_aws_api):
+ set_module_args(self.set_args_create_aws_netapp_cvs_pool())
+ my_obj = pool_module()
+ my_pool = {
+ "name": "Dummyname",
+ "poolId": "1f63b3d0-4fd4-b4fe-1ed6-c62f5f20d975",
+ "region": "us-east-1",
+ "serviceLevel": "extreme",
+ "sizeInBytes": 40000000000000000,
+ "state": "available",
+ "vendorID": "Dummy"
+ }
+ get_post_api.return_value = my_pool, "Error"
+ get_aws_api.return_value = None
+ with pytest.raises(AnsibleFailJson) as exc:
+ my_obj.apply()
+ print('Info: test_create_aws_netapp_cvs_pool_fail: %s' % repr(exc.value))
+ assert exc.value.args[0]['msg'] is not None
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_pool.NetAppAWSCVS.get_aws_netapp_cvs_pool')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.delete')
+ def test_delete_aws_netapp_cvs_pool_pass(self, get_delete_api, get_aws_api):
+ set_module_args(self.set_args_delete_aws_netapp_cvs_pool())
+ my_obj = pool_module()
+ my_pool = {
+ "name": "Dummyname",
+ "poolId": "1f63b3d0-4fd4-b4fe-1ed6-c62f5f20d975",
+ "region": "us-east-1",
+ "serviceLevel": "extreme",
+ "sizeInBytes": 40000000000000000,
+ "state": "available",
+ "vendorID": "Dummy"
+ }
+ get_aws_api.return_value = my_pool
+ get_delete_api.return_value = None, None
+ with pytest.raises(AnsibleExitJson) as exc:
+ my_obj.apply()
+ print('Info: test_delete_aws_netapp_cvs_pool_pass: %s' % repr(exc.value))
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_pool.NetAppAWSCVS.get_aws_netapp_cvs_pool')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.delete')
+ def test_delete_aws_netapp_cvs_pool_fail(self, get_delete_api, get_aws_api):
+ set_module_args(self.set_args_delete_aws_netapp_cvs_pool())
+ my_obj = pool_module()
+ my_pool = {
+ "name": "Dummyname",
+ "poolId": "1f63b3d0-4fd4-b4fe-1ed6-c62f5f20d975",
+ "region": "us-east-1",
+ "serviceLevel": "extreme",
+ "sizeInBytes": 40000000000000000,
+ "state": "available",
+ "vendorID": "Dummy"
+ }
+ get_delete_api.return_value = my_pool, "Error"
+ get_aws_api.return_value = my_pool
+ with pytest.raises(AnsibleFailJson) as exc:
+ my_obj.apply()
+ print('Info: test_delete_aws_netapp_cvs_pool_fail: %s' % repr(exc.value))
+ assert exc.value.args[0]['msg'] is not None
diff --git a/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_snapshots.py b/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_snapshots.py
new file mode 100644
index 00000000..bb825a2e
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/plugins/modules/test_aws_netapp_cvs_snapshots.py
@@ -0,0 +1,147 @@
+# (c) 2019, NetApp, Inc
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+''' unit tests NetApp AWS CVS Snapshots Ansible module: aws_netapp_cvs_snapshots'''
+
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+import json
+import pytest
+import sys
+
+from ansible.module_utils import basic
+from ansible.module_utils._text import to_bytes
+from ansible_collections.netapp.aws.tests.unit.compat import unittest
+from ansible_collections.netapp.aws.tests.unit.compat.mock import patch
+import ansible_collections.netapp.aws.plugins.module_utils.netapp as netapp_utils
+
+from ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_snapshots \
+ import AwsCvsNetappSnapshot as snapshot_module
+
+
+if not netapp_utils.HAS_REQUESTS and sys.version_info < (2, 7):
+ pytestmark = pytest.mark.skip('Skipping Unit Tests on 2.6 as requests is not be available')
+
+
+def set_module_args(args):
+ """prepare arguments so that they will be picked up during module creation"""
+ args = json.dumps({'ANSIBLE_MODULE_ARGS': args})
+ basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access
+
+
+class AnsibleExitJson(Exception):
+ """Exception class to be raised by module.exit_json and caught by the test case"""
+
+
+class AnsibleFailJson(Exception):
+ """Exception class to be raised by module.fail_json and caught by the test case"""
+
+
+def exit_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over exit_json; package return data into an exception"""
+ if 'changed' not in kwargs:
+ kwargs['changed'] = False
+ raise AnsibleExitJson(kwargs)
+
+
+def fail_json(*args, **kwargs): # pylint: disable=unused-argument
+ """function to patch over fail_json; package return data into an exception"""
+ kwargs['failed'] = True
+ raise AnsibleFailJson(kwargs)
+
+
+class TestMyModule(unittest.TestCase):
+ ''' a group of related Unit Tests '''
+
+ def setUp(self):
+ self.mock_module_helper = patch.multiple(basic.AnsibleModule,
+ exit_json=exit_json,
+ fail_json=fail_json)
+ self.mock_module_helper.start()
+ self.addCleanup(self.mock_module_helper.stop)
+
+ def set_default_args_fail_check(self):
+ return dict({
+ 'name': 'TestFilesystem',
+ 'fileSystemId': 'standard',
+ 'from_name': 'from_TestFilesystem',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.com',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_default_args_pass_check(self):
+ return dict({
+ 'state': 'present',
+ 'name': 'testSnapshot',
+ 'fileSystemId': 'standard',
+ 'from_name': 'from_TestFilesystem',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.com',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_args_create_aws_netapp_cvs_snapshots(self):
+ return dict({
+ 'state': 'present',
+ 'name': 'testSnapshot',
+ 'fileSystemId': '123-4213-432-432',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.com',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def set_args_delete_aws_netapp_cvs_snapshots(self):
+ return dict({
+ 'state': 'absent',
+ 'name': 'testSnapshot',
+ 'region': 'us-east-1',
+ 'api_url': 'hostname.com',
+ 'api_key': 'myapikey',
+ 'secret_key': 'mysecretkey'
+ })
+
+ def test_module_fail_when_required_args_missing(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleFailJson) as exc:
+ set_module_args(self.set_default_args_fail_check())
+ snapshot_module()
+ print('Info: test_module_fail_when_required_args_missing: %s' % exc.value.args[0]['msg'])
+
+ def test_module_fail_when_required_args_present(self):
+ ''' required arguments are reported as errors '''
+ with pytest.raises(AnsibleExitJson) as exc:
+ set_module_args(self.set_default_args_pass_check())
+ snapshot_module()
+ exit_json(changed=True, msg="Induced arguments check")
+ print('Info: test_module_fail_when_required_args_present: %s' % exc.value.args[0]['msg'])
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_snapshots.AwsCvsNetappSnapshot.get_snapshot_id')
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_snapshots.AwsCvsNetappSnapshot.get_filesystem_id')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.post')
+ def test_create_aws_netapp_cvs_snapshots_pass(self, get_post_api, get_filesystem_id, get_snapshot_id):
+ set_module_args(self.set_args_create_aws_netapp_cvs_snapshots())
+ my_obj = snapshot_module()
+ get_filesystem_id.return_value = 'fiesystemName'
+ get_snapshot_id.return_value = None
+ get_post_api.return_value = None, None
+ with pytest.raises(AnsibleExitJson) as exc:
+ my_obj.apply()
+ print('Info: test_create_aws_netapp_cvs_snapshots_pass: %s' % repr(exc.value.args[0]))
+ assert exc.value.args[0]['changed']
+
+ @patch('ansible_collections.netapp.aws.plugins.modules.aws_netapp_cvs_snapshots.AwsCvsNetappSnapshot.get_snapshot_id')
+ @patch('ansible_collections.netapp.aws.plugins.module_utils.netapp.AwsCvsRestAPI.delete')
+ def test_delete_aws_netapp_cvs_snapshots_pass(self, get_post_api, get_snapshot_id):
+ set_module_args(self.set_args_delete_aws_netapp_cvs_snapshots())
+ my_obj = snapshot_module()
+ get_snapshot_id.return_value = "1f63b3d0-4fd4-b4fe-1ed6-c62f5f20d975"
+ get_post_api.return_value = None, None
+ with pytest.raises(AnsibleExitJson) as exc:
+ my_obj.apply()
+ print('Info: test_create_aws_netapp_cvs_snapshots_pass: %s' % repr(exc.value.args[0]))
+ assert exc.value.args[0]['changed']
diff --git a/ansible_collections/netapp/aws/tests/unit/requirements.txt b/ansible_collections/netapp/aws/tests/unit/requirements.txt
new file mode 100644
index 00000000..b754473a
--- /dev/null
+++ b/ansible_collections/netapp/aws/tests/unit/requirements.txt
@@ -0,0 +1 @@
+requests ; python_version >= '2.7'