Skip to content

Commit

Permalink
fix sanity error
Browse files Browse the repository at this point in the history
add azure_rm_vpnsite to pr-pipeline

fix sanity error

fix sanity error

add ignores file

delete unused ignore

fix sanity error

fix paramters

update verison to 1.4.0
  • Loading branch information
Fred-sun committed Dec 18, 2020
1 parent a04a8cf commit b0d8fe3
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 117 deletions.
148 changes: 74 additions & 74 deletions plugins/modules/azure_rm_vpnsite.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python
#
# Copyright (c) 2020 GuopengLin, (@t-glin)
# Copyright (c) 2020 Gu Fred-Sun, (@Fred-Sun)
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

Expand All @@ -16,12 +16,12 @@
DOCUMENTATION = '''
---
module: azure_rm_vpnsite
version_added: '2.0.0'
version_added: '1.4.0'
short_description: Manage Azure VpnSite instance
description:
- Create, update and delete instance of Azure VpnSite.
options:
resource_group_name:
resource_group:
description:
- The resource group name of the VpnSite.
required: true
Expand All @@ -30,12 +30,9 @@
description:
- The location of the VpnSite
type: str
required: true
vpn_site_name:
name:
description:
- The name of the VpnSite being retrieved.
- The name of the VpnSite being created or updated.
- The name of the VpnSite being deleted.
- The name of the VpnSite.
required: true
type: str
virtual_wan:
Expand Down Expand Up @@ -63,7 +60,7 @@
link_speed_in_mbps:
description:
- Link speed.
type: integer
type: int
ip_address:
description:
- The ip-address for the vpn-site.
Expand All @@ -89,7 +86,7 @@
asn:
description:
- The BGP speaker's ASN.
type: integer
type: int
bgp_peering_address:
description:
- The BGP peering address and BGP identifier of this BGP speaker.
Expand Down Expand Up @@ -133,40 +130,40 @@
- The name of the resource that is unique within a resource group.
- This name can be used to access the resource.
type: str
link_properties:
description:
- The link provider properties.
type: dict
suboptions:
link_provider_name:
description:
- Name of the link provider.
type: str
link_speed_in_mbps:
description:
- Link speed.
type: int
ip_address:
description:
- The ip-address for the vpn-site-link.
type: str
fqdn:
description:
- FQDN of vpn-site-link.
type: str
bgp_properties:
description:
- The set of bgp properties.
type: dict
suboptions:
asn:
description:
- The BGP speaker's ASN.
type: integer
bgp_peering_address:
description:
- The BGP peering address and BGP identifier of this BGP speaker.
link_properties:
description:
- The link provider properties.
type: dict
suboptions:
link_provider_name:
description:
- Name of the link provider.
type: str
link_speed_in_mbps:
description:
- Link speed.
type: int
ip_address:
description:
- The IP address for the vpn site link.
type: str
fqdn:
description:
- FQDN of vpn-site-link.
type: str
bgp_properties:
description:
- The set of bgp properties.
type: dict
suboptions:
asn:
description:
- The BGP speaker's ASN.
type: int
bgp_peering_address:
description:
- The BGP peering address and BGP identifier of this BGP speaker.
type: str
o365_policy:
description:
- Office365 Policy.
Expand Down Expand Up @@ -201,22 +198,20 @@
- azure.azcollection.azure
- azure.azcollection.azure_tags
author:
- GuopengLin (@t-glin)
- Fred-Sun (@Fred-Sun)
- Haiyuan Zhang (@haiyuazhang)
'''

EXAMPLES = '''
- name: Create VpnSite
azure_rm_vpnsite:
resource_group_name: myResourceGroup
vpn_site_name: vpnSite_name
azure_rm_vpnsite:
resource_group: myResourceGroup
name: vpnSite_name
- name: VpnSiteDelete
azure_rm_vpnsite:
resource_group_name: myResourceGroup
vpn_site_name: vpnSite_name
- name: Delete Vpn Site
azure_rm_vpnsite:
resource_group: myResourceGroup
name: vpnSite_name
'''

Expand Down Expand Up @@ -255,7 +250,7 @@
description:
- Resource tags.
returned: always
type: dictionary
type: dict
sample: { 'key1': 'value1'}
etag:
description:
Expand All @@ -267,7 +262,7 @@
description:
- The VirtualWAN to which the vpnSite belongs.
returned: always
type: dict
type: complex
contains:
id:
description:
Expand All @@ -279,8 +274,8 @@
description:
- The device properties.
returned: always
type: dict
sample:
type: complex
contains:
device_vendor:
description:
- Name of the device Vendor.
Expand Down Expand Up @@ -319,17 +314,16 @@ class Actions:
class AzureRMVpnSite(AzureRMModuleBaseExt):
def __init__(self):
self.module_arg_spec = dict(
resource_group_name=dict(
resource_group=dict(
type='str',
required=True
),
vpn_site_name=dict(
name=dict(
type='str',
required=True
),
location=dict(
type='str',
required=True
type='str'
),
virtual_wan=dict(
type='dict',
Expand All @@ -354,7 +348,7 @@ def __init__(self):
disposition='device_model'
),
link_speed_in_mbps=dict(
type='integer',
type='int',
disposition='link_speed_in_mbps'
)
)
Expand Down Expand Up @@ -383,15 +377,15 @@ def __init__(self):
disposition='/bgp_properties',
options=dict(
asn=dict(
type='integer',
type='int',
disposition='asn'
),
bgp_peering_address=dict(
type='str',
disposition='bgp_peering_address'
),
peer_weight=dict(
type='integer',
type='int',
disposition='peer_weight'
),
bgp_peering_addresses=dict(
Expand Down Expand Up @@ -446,7 +440,7 @@ def __init__(self):
disposition='link_provider_name'
),
link_speed_in_mbps=dict(
type='integer',
type='int',
disposition='link_speed_in_mbps'
)
)
Expand All @@ -464,7 +458,7 @@ def __init__(self):
disposition='bgp_properties',
options=dict(
asn=dict(
type='integer',
type='int',
disposition='asn'
),
bgp_peering_address=dict(
Expand Down Expand Up @@ -506,8 +500,9 @@ def __init__(self):
)
)

self.resource_group_name = None
self.vpn_site_name = None
self.resource_group = None
self.name = None
self.location = None
self.body = {}

self.results = dict(changed=False)
Expand All @@ -528,12 +523,17 @@ def exec_module(self, **kwargs):

self.inflate_parameters(self.module_arg_spec, self.body, 0)

resource_group = self.get_resource_group(self.resource_group)
if self.location is None:
# Set default location
self.location = resource_group.location
self.body['location'] = self.location
old_response = None
response = None

self.mgmt_client = self.get_mgmt_svc_client(NetworkManagementClient,
base_url=self._cloud_environment.endpoints.resource_manager,
api_version='2020-04-01')
api_version='2020-06-01')

old_response = self.get_resource()

Expand Down Expand Up @@ -571,8 +571,8 @@ def exec_module(self, **kwargs):

def create_update_resource(self):
try:
response = self.mgmt_client.vpn_sites.create_or_update(resource_group_name=self.resource_group_name,
vpn_site_name=self.vpn_site_name,
response = self.mgmt_client.vpn_sites.create_or_update(resource_group_name=self.resource_group,
vpn_site_name=self.name,
vpn_site_parameters=self.body)
if isinstance(response, AzureOperationPoller) or isinstance(response, LROPoller):
response = self.get_poller_result(response)
Expand All @@ -583,8 +583,8 @@ def create_update_resource(self):

def delete_resource(self):
try:
response = self.mgmt_client.vpn_sites.delete(resource_group_name=self.resource_group_name,
vpn_site_name=self.vpn_site_name)
response = self.mgmt_client.vpn_sites.delete(resource_group_name=self.resource_group,
vpn_site_name=self.name)
except CloudError as e:
self.log('Error attempting to delete the VpnSite instance.')
self.fail('Error deleting the VpnSite instance: {0}'.format(str(e)))
Expand All @@ -593,8 +593,8 @@ def delete_resource(self):

def get_resource(self):
try:
response = self.mgmt_client.vpn_sites.get(resource_group_name=self.resource_group_name,
vpn_site_name=self.vpn_site_name)
response = self.mgmt_client.vpn_sites.get(resource_group_name=self.resource_group,
vpn_site_name=self.name)
except CloudError as e:
return False
return response.as_dict()
Expand Down
Loading

0 comments on commit b0d8fe3

Please sign in to comment.