Add support for Azure Functions (#28566)

* add template for az func

* (wip) add basic azure functions support

* add support to add app settings to azure function

* add support for updating based off of app settings

* add integration tests and refactor required param

* support check mode and add facts module

* add test for azure functions facts module

* add necessary checks and registrations for web client

* fix documentation

* change return type from complex to dict

* disable azure_rm_functionapp tests until stable

* remove dict comprehension for py2.6

* pepe has whitespace tumor
This commit is contained in:
Thomas Stringer 2017-08-29 21:54:58 -04:00 committed by Matt Davis
parent ef660f87b0
commit 8a6ae51f90
7 changed files with 610 additions and 1 deletions

View file

@ -100,11 +100,13 @@ try:
from azure.mgmt.compute.version import VERSION as compute_client_version
from azure.mgmt.resource.version import VERSION as resource_client_version
from azure.mgmt.dns.version import VERSION as dns_client_version
from azure.mgmt.web.version import VERSION as web_client_version
from azure.mgmt.network import NetworkManagementClient
from azure.mgmt.resource.resources import ResourceManagementClient
from azure.mgmt.storage import StorageManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.dns import DnsManagementClient
from azure.mgmt.web import WebSiteManagementClient
from azure.mgmt.containerservice import ContainerServiceClient
from azure.storage.cloudstorageaccount import CloudStorageAccount
except ImportError as exc:
@ -135,7 +137,8 @@ AZURE_EXPECTED_VERSIONS = dict(
compute_client_version="1.0.0",
network_client_version="1.0.0",
resource_client_version="1.1.0",
dns_client_version="1.0.1"
dns_client_version="1.0.1",
web_client_version="0.32.0"
)
AZURE_MIN_RELEASE = '2.0.0'
@ -185,7 +188,9 @@ class AzureRMModuleBase(object):
self._resource_client = None
self._compute_client = None
self._dns_client = None
self._web_client = None
self._containerservice_client = None
self.check_mode = self.module.check_mode
self.facts_module = facts_module
# self.debug = self.module.params.get('debug')
@ -727,6 +732,19 @@ class AzureRMModuleBase(object):
self._register('Microsoft.Dns')
return self._dns_client
@property
def web_client(self):
self.log('Getting web client')
if not self._web_client:
self.check_client_version('web', web_client_version, AZURE_EXPECTED_VERSIONS['web_client_version'])
self._web_client = WebSiteManagementClient(
credentials=self.azure_credentials,
subscription_id=self.subscription_id,
base_url=self.base_url
)
self._register('Microsoft.Web')
return self._web_client
@property
def containerservice_client(self):
self.log('Getting container service client')