Skip to content

Commit

Permalink
Merged release/2.0 on this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavbansal29 committed Dec 23, 2024
2 parents ddec6d8 + 23496fe commit a476899
Show file tree
Hide file tree
Showing 220 changed files with 1,068 additions and 608 deletions.
8 changes: 6 additions & 2 deletions plugins/module_utils/v4/base_info_module.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright: 2021, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause )
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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

from copy import deepcopy
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/clusters_mgmt/api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/clusters_mgmt/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
8 changes: 6 additions & 2 deletions plugins/module_utils/v4/clusters_mgmt/spec/clusters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright: 2021, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause )
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
5 changes: 4 additions & 1 deletion plugins/module_utils/v4/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# This file is part of Ansible
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/data_protection/api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/data_protection/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/flow/api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/flow/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/iam/api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
15 changes: 15 additions & 0 deletions plugins/module_utils/v4/iam/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand All @@ -6,6 +12,15 @@


def get_authorization_policy(module, api_instance, ext_id):
"""
This method will return authorization policy info using ext_id.
Args:
module (object): Ansible module object
api_instance (object): Authorization policy api instance
ext_id (str): External id of authorization policy
Returns:
authorization_policy_info (dict): Authorization policy info
"""
try:
return api_instance.get_authorization_policy_by_id(extId=ext_id).data
except Exception as e:
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/network/api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/network/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/prism/pc_api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 5 additions & 1 deletion plugins/module_utils/v4/prism/tasks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file is part of Ansible
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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

from copy import deepcopy
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/sdk_mock.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 5 additions & 1 deletion plugins/module_utils/v4/spec_generator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file is part of Ansible
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
5 changes: 4 additions & 1 deletion plugins/module_utils/v4/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# This file is part of Ansible
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/vmm/api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
83 changes: 83 additions & 0 deletions plugins/module_utils/v4/vmm/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand All @@ -6,6 +12,15 @@


def get_vm(module, api_instance, ext_id):
"""
Get VM by ext_id
Args:
module: Ansible module
api_instance: VmApi instance from ntnx_vmm_py_client sdk
ext_id: ext_id of VM
Returns:
vm (obj): VM info object
"""
try:
return api_instance.get_vm_by_id(extId=ext_id).data
except Exception as e:
Expand All @@ -17,6 +32,16 @@ def get_vm(module, api_instance, ext_id):


def get_nic(module, api_instance, ext_id, vm_ext_id):
"""
Get NIC by ext_id
Args:
module: Ansible module
api_instance: VmApi instance from ntnx_vmm_py_client sdk
ext_id: ext_id of NIC
vm_ext_id: ext_id of VM
Returns:
nic (obj): NIC info object
"""
try:
return api_instance.get_nic_by_id(vmExtId=vm_ext_id, extId=ext_id).data
except Exception as e:
Expand All @@ -28,6 +53,15 @@ def get_nic(module, api_instance, ext_id, vm_ext_id):


def get_ngt_status(module, api_instance, vm_ext_id):
"""
Get NGT info by vm ext_id
Args:
module: Ansible module
api_instance: VmApi instance from ntnx_vmm_py_client sdk
vm_ext_id: ext_id of VM
Returns:
ngt (obj): NGT info object
"""
try:
return api_instance.get_guest_tools_by_id(extId=vm_ext_id).data
except Exception as e:
Expand All @@ -39,6 +73,16 @@ def get_ngt_status(module, api_instance, vm_ext_id):


def get_disk(module, api_instance, ext_id, vm_ext_id):
"""
Get Disk by ext_id
Args:
module: Ansible module
api_instance: VmApi instance from ntnx_vmm_py_client sdk
ext_id: ext_id of Disk
vm_ext_id: ext_id of VM
Returns:
disk (obj): Disk info object
"""
try:
return api_instance.get_disk_by_id(vmExtId=vm_ext_id, extId=ext_id).data
except Exception as e:
Expand All @@ -50,6 +94,16 @@ def get_disk(module, api_instance, ext_id, vm_ext_id):


def get_serial_port(module, api_instance, ext_id, vm_ext_id):
"""
Get Serial Port by ext_id
Args:
module: Ansible module
api_instance: VmApi instance from ntnx_vmm_py_client sdk
ext_id: ext_id of Serial Port
vm_ext_id: ext_id of VM
Returns:
serial_port (obj): Serial Port info object
"""
try:
return api_instance.get_serial_port_by_id(vmExtId=vm_ext_id, extId=ext_id).data
except Exception as e:
Expand All @@ -61,6 +115,15 @@ def get_serial_port(module, api_instance, ext_id, vm_ext_id):


def get_template(module, api_instance, ext_id):
"""
Get Template by ext_id
Args:
module: Ansible module
api_instance: VmApi instance from ntnx_vmm_py_client sdk
ext_id: ext_id of Template
Returns:
template (obj): Template info object
"""
try:
return api_instance.get_template_by_id(extId=ext_id).data
except Exception as e:
Expand All @@ -72,6 +135,16 @@ def get_template(module, api_instance, ext_id):


def get_cd_rom(module, api_instance, ext_id, vm_ext_id):
"""
Get CD ROM by ext_id
Args:
module: Ansible module
api_instance: VmApi instance from ntnx_vmm_py_client sdk
ext_id: ext_id of CD ROM
vm_ext_id: ext_id of VM
Returns:
cd_rom (obj): CD ROM info object
"""
try:
return api_instance.get_cd_rom_by_id(vmExtId=vm_ext_id, extId=ext_id).data
except Exception as e:
Expand All @@ -83,6 +156,16 @@ def get_cd_rom(module, api_instance, ext_id, vm_ext_id):


def get_gpu(module, api_instance, ext_id, vm_ext_id):
"""
Get GPU by ext_id
Args:
module: Ansible module
api_instance: VmApi instance from ntnx_vmm_py_client sdk
ext_id: ext_id of GPU
vm_ext_id: ext_id of VM
Returns:
gpu (obj): GPU info object
"""
try:
return api_instance.get_gpu_by_id(vmExtId=vm_ext_id, extId=ext_id).data
except Exception as e:
Expand Down
8 changes: 6 additions & 2 deletions plugins/module_utils/v4/vmm/spec/vms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright: 2021, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause )
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/volumes/api_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/v4/volumes/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
8 changes: 6 additions & 2 deletions plugins/module_utils/v4/volumes/spec/volume_group.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright: 2021, Ansible Project
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause )
#!/usr/bin/python
# -*- coding: utf-8 -*-

# Copyright: (c) 2024, Nutanix
# 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
Expand Down
Loading

0 comments on commit a476899

Please sign in to comment.