diff --git a/README.md b/README.md index 1e170aff..6a19c6f2 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ Documentation on the NSX platform can be found at the [NSX-T Documentation page] The following versions of NSX are supported: + * NSX-T 4.1 + * NSX-T 4.0 * NSX-T 3.2 * NSX-T 3.1 * NSX-T 3.0 diff --git a/plugins/module_utils/nsxt_base_resource.py b/plugins/module_utils/nsxt_base_resource.py index c219b3dc..2543e153 100644 --- a/plugins/module_utils/nsxt_base_resource.py +++ b/plugins/module_utils/nsxt_base_resource.py @@ -40,7 +40,8 @@ BASE_RESOURCES = {"NSXTSegment", "NSXTTier0", "NSXTTier1", "NSXTSecurityPolicy", "NSXTPolicyGroup", "NSXTIpBlock", "NSXTIpPool", "NSXTBFDProfile", - "NSXTGatewayPolicy", "NSXTL2BridgeEpProfile"} + "NSXTGatewayPolicy", "NSXTL2BridgeEpProfile", + "NSXTService"} class NSXTBaseRealizableResource(ABC): diff --git a/plugins/module_utils/nsxt_resource_urls.py b/plugins/module_utils/nsxt_resource_urls.py index 7a7096df..923476dd 100644 --- a/plugins/module_utils/nsxt_resource_urls.py +++ b/plugins/module_utils/nsxt_resource_urls.py @@ -32,6 +32,9 @@ SECURITY_POLICY_URL = _DOMAIN_URL + '/{}/security-policies' +SERVICE_URL = '/infra/services' +SERVICE_ENTRIES_URL = SERVICE_URL + '/{}/service-entries' + SEGMENT_URL = '/infra/segments' SEGMENT_PORT_URL = SEGMENT_URL + '/{}/ports' diff --git a/plugins/modules/nsxt_policy_service.py b/plugins/modules/nsxt_policy_service.py new file mode 100644 index 00000000..8483ac54 --- /dev/null +++ b/plugins/modules/nsxt_policy_service.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2018 VMware, Inc. +# SPDX-License-Identifier: BSD-2-Clause OR GPL-3.0-only +# +# 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. + +from __future__ import (absolute_import, division, print_function) +__metaclass__ = type + +ANSIBLE_METADATA = {'metadata_version': '1.1', + 'status': ['preview'], + 'supported_by': 'community'} + +DOCUMENTATION = ''' +--- +module: nsxt_policy_service + + +''' + +RETURN = '''# ''' + +import json +import time +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.vmware.ansible_for_nsxt.plugins.module_utils.nsxt_base_resource import NSXTBaseRealizableResource +from ansible_collections.vmware.ansible_for_nsxt.plugins.module_utils.nsxt_resource_urls import ( + SERVICE_ENTRIES_URL, SERVICE_URL) +from ansible.module_utils._text import to_native + + +class NSXTService(NSXTBaseRealizableResource): + @staticmethod + def get_resource_spec(): + service_arg_spec = {} + service_arg_spec.update( + service_entries=dict( + type='list', + elements='dict' + ), + ) + return service_arg_spec + + @staticmethod + def get_resource_base_url(baseline_args=None): + return SERVICE_URL + +if __name__ == '__main__': + svc = NSXTService() + svc.realize()