Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade azure-mgmt-eventhubs to 10.1.0 #900

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/module_utils/azure_rm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,8 @@ def event_hub_client(self):
self._event_hub_client = self.get_mgmt_svc_client(
EventHubManagementClient,
base_url=self._cloud_environment.endpoints.resource_manager,
api_version='2018-05-04')
is_track2=True,
api_version='2021-11-01')
return self._event_hub_client

@property
Expand Down
14 changes: 7 additions & 7 deletions plugins/modules/azure_rm_eventhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@
'''

try:
from msrestazure.azure_exceptions import CloudError
from azure.core.exceptions import ResourceNotFoundError
from azure.mgmt.eventhub.models import Eventhub, EHNamespace
from azure.mgmt.eventhub.models.sku import Sku
from azure.mgmt.eventhub.models import Sku
except ImportError:
# This is handled in azure_rm_common
pass
Expand Down Expand Up @@ -304,7 +304,7 @@ def create_or_update_namespaces(self):
sku=Sku(name=self.sku),
tags=self.tags
)
result = self.event_hub_client.namespaces.create_or_update(
result = self.event_hub_client.namespaces.begin_create_or_update(
self.resource_group,
self.namespace_name,
namespace_params)
Expand All @@ -318,7 +318,7 @@ def create_or_update_namespaces(self):
self.resource_group,
self.namespace_name,
)
except CloudError as ex:
except Exception as ex:
self.fail("Failed to create namespace {0} in resource group {1}: {2}".format(
self.namespace_name, self.resource_group, str(ex)))
return namespace_to_dict(namespace)
Expand Down Expand Up @@ -357,7 +357,7 @@ def delete_event_hub(self):
try:
result = self.event_hub_client.event_hubs.delete(
self.resource_group, self.namespace_name, self.name)
except CloudError as e:
except Exception as e:
self.log('Error attempting to delete event hub.')
self.fail(
"Error deleting the event hub : {0}".format(str(e)))
Expand All @@ -370,9 +370,9 @@ def delete_namespace(self):
'''
self.log("Deleting the namespace {0}".format(self.namespace_name))
try:
result = self.event_hub_client.namespaces.delete(
result = self.event_hub_client.namespaces.begin_delete(
self.resource_group, self.namespace_name)
except CloudError as e:
except Exception as e:
self.log('Error attempting to delete namespace.')
self.fail(
"Error deleting the namespace : {0}".format(str(e)))
Expand Down
8 changes: 4 additions & 4 deletions plugins/modules/azure_rm_eventhub_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'''

try:
from msrestazure.azure_exceptions import CloudError
from azure.core.exceptions import ResourceNotFoundError
except ImportError:
# This is handled in azure_rm_common
pass
Expand Down Expand Up @@ -138,7 +138,7 @@ def get_namespace(self):
self.resource_group, self.namespace_name)
self.log("Response : {0}".format(response))

except CloudError as e:
except ResourceNotFoundError as e:
self.fail('Could not get info for namespace. {0}').format(
str(e))

Expand All @@ -157,7 +157,7 @@ def get_event_hub(self):
response = self.event_hub_client.event_hubs.get(
self.resource_group, self.namespace_name, self.name)

except CloudError as e:
except ResourceNotFoundError as e:
self.fail('Could not get info for event hub. {0}').format(
str(e))

Expand All @@ -174,7 +174,7 @@ def list_all_namespace(self):
response = self.event_hub_client.namespaces.list_by_resource_group(
self.resource_group)

except CloudError as exc:
except Exception as exc:
self.fail(
"Failed to list for resource group {0} - {1}".format(self.resource_group, str(exc)))

Expand Down
2 changes: 1 addition & 1 deletion requirements-azure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ azure-mgmt-iothub==0.7.0
azure-mgmt-recoveryservices==0.4.0
azure-mgmt-recoveryservicesbackup==0.6.0
azure-mgmt-notificationhubs==2.0.0
azure-mgmt-eventhub==2.0.0
azure-mgmt-eventhub==10.1.0