Skip to content

[AutoPR track2_azure-mgmt-eventgrid] changes for vault tier #5285

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

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 5 additions & 5 deletions sdk/eventgrid/azure-mgmt-eventgrid/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "288939a1c67efd5f129124ea0912ca17ff7b9d90",
"commit": "a231973a4fd49f699621dd74cb1b47d9d6fdcd13",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"autorest": "3.9.7",
"use": [
"@autorest/python@6.4.12",
"@autorest/modelerfour@4.24.3"
"@autorest/python@6.7.1",
"@autorest/modelerfour@4.26.2"
],
"autorest_command": "autorest specification/eventgrid/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.12 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
"autorest_command": "autorest specification/eventgrid/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False",
"readme": "specification/eventgrid/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class EventGridManagementClientConfiguration(Configuration): # pylint: disable=
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-06-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-12-15-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(EventGridManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-06-01-preview")
api_version: str = kwargs.pop("api_version", "2023-12-15-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
NamespaceTopicEventSubscriptionsOperations,
NamespaceTopicsOperations,
NamespacesOperations,
NetworkSecurityPerimeterConfigurationsOperations,
Operations,
PartnerConfigurationsOperations,
PartnerDestinationsOperations,
Expand Down Expand Up @@ -106,6 +107,10 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k
:vartype partner_registrations: azure.mgmt.eventgrid.operations.PartnerRegistrationsOperations
:ivar partner_topics: PartnerTopicsOperations operations
:vartype partner_topics: azure.mgmt.eventgrid.operations.PartnerTopicsOperations
:ivar network_security_perimeter_configurations:
NetworkSecurityPerimeterConfigurationsOperations operations
:vartype network_security_perimeter_configurations:
azure.mgmt.eventgrid.operations.NetworkSecurityPerimeterConfigurationsOperations
:ivar permission_bindings: PermissionBindingsOperations operations
:vartype permission_bindings: azure.mgmt.eventgrid.operations.PermissionBindingsOperations
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
Expand All @@ -132,7 +137,7 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-06-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-12-15-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand Down Expand Up @@ -200,6 +205,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.partner_topics = PartnerTopicsOperations(self._client, self._config, self._serialize, self._deserialize)
self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.permission_bindings = PermissionBindingsOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs):
_serialized.update(_new_attr) # type: ignore
_new_attr = _new_attr[k] # type: ignore
_serialized = _serialized[k]
except ValueError:
continue
except ValueError as err:
if isinstance(err, SerializationError):
raise

except (AttributeError, KeyError, TypeError) as err:
msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj))
Expand Down Expand Up @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs):

:param data: The data to be serialized.
:param str data_type: The type to be serialized from.
:keyword bool skip_quote: Whether to skip quote the serialized result.
Defaults to False.
:rtype: str
:raises: TypeError if serialization fails.
:raises: ValueError if data is None
Expand All @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs):
# Treat the list aside, since we don't want to encode the div separator
if data_type.startswith("["):
internal_data_type = data_type[1:-1]
data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data]
if not kwargs.get("skip_quote", False):
data = [quote(str(d), safe="") for d in data]
return str(self.serialize_iter(data, internal_data_type, **kwargs))
do_quote = not kwargs.get("skip_quote", False)
return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs))

# Not a list, regular serialization
output = self.serialize_data(data, data_type, **kwargs)
Expand Down Expand Up @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
not be None or empty.
:param str div: If set, this str will be used to combine the elements
in the iterable into a combined string. Default is 'None'.
:keyword bool do_quote: Whether to quote the serialized result of each iterable element.
Defaults to False.
:rtype: list, str
"""
if isinstance(data, str):
Expand All @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs):
for d in data:
try:
serialized.append(self.serialize_data(d, iter_type, **kwargs))
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized.append(None)

if kwargs.get("do_quote", False):
serialized = ["" if s is None else quote(str(s), safe="") for s in serialized]

if div:
serialized = ["" if s is None else str(s) for s in serialized]
serialized = div.join(serialized)
Expand Down Expand Up @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs):
for key, value in attr.items():
try:
serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs)
except ValueError:
except ValueError as err:
if isinstance(err, SerializationError):
raise
serialized[self.serialize_unicode(key)] = None

if "xml" in serialization_ctxt:
Expand Down
14 changes: 0 additions & 14 deletions sdk/eventgrid/azure-mgmt-eventgrid/azure/mgmt/eventgrid/_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from typing import List, cast

from azure.core.pipeline.transport import HttpRequest


Expand All @@ -16,15 +14,3 @@ def _convert_request(request, files=None):
if files:
request.set_formdata_body(files)
return request


def _format_url_section(template, **kwargs):
components = template.split("/")
while components:
try:
return template.format(**kwargs)
except KeyError as key:
# Need the cast, as for some reasons "split" is typed as list[str | Any]
formatted_components = cast(List[str], template.split("/"))
components = [c for c in formatted_components if "{}".format(key.args[0]) not in c]
template = "/".join(components)
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "10.3.0b2"
VERSION = "2.2.0"
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class EventGridManagementClientConfiguration(Configuration): # pylint: disable=
:param subscription_id: Subscription credentials that uniquely identify a Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-06-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-12-15-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(EventGridManagementClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-06-01-preview")
api_version: str = kwargs.pop("api_version", "2023-12-15-preview")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
NamespaceTopicEventSubscriptionsOperations,
NamespaceTopicsOperations,
NamespacesOperations,
NetworkSecurityPerimeterConfigurationsOperations,
Operations,
PartnerConfigurationsOperations,
PartnerDestinationsOperations,
Expand Down Expand Up @@ -108,6 +109,10 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k
azure.mgmt.eventgrid.aio.operations.PartnerRegistrationsOperations
:ivar partner_topics: PartnerTopicsOperations operations
:vartype partner_topics: azure.mgmt.eventgrid.aio.operations.PartnerTopicsOperations
:ivar network_security_perimeter_configurations:
NetworkSecurityPerimeterConfigurationsOperations operations
:vartype network_security_perimeter_configurations:
azure.mgmt.eventgrid.aio.operations.NetworkSecurityPerimeterConfigurationsOperations
:ivar permission_bindings: PermissionBindingsOperations operations
:vartype permission_bindings: azure.mgmt.eventgrid.aio.operations.PermissionBindingsOperations
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
Expand Down Expand Up @@ -135,7 +140,7 @@ class EventGridManagementClient: # pylint: disable=client-accepts-api-version-k
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-06-01-preview". Note that overriding
:keyword api_version: Api Version. Default value is "2023-12-15-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Expand Down Expand Up @@ -203,6 +208,9 @@ def __init__(
self._client, self._config, self._serialize, self._deserialize
)
self.partner_topics = PartnerTopicsOperations(self._client, self._config, self._serialize, self._deserialize)
self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.permission_bindings = PermissionBindingsOperations(
self._client, self._config, self._serialize, self._deserialize
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from ._partner_namespaces_operations import PartnerNamespacesOperations
from ._partner_registrations_operations import PartnerRegistrationsOperations
from ._partner_topics_operations import PartnerTopicsOperations
from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations
from ._permission_bindings_operations import PermissionBindingsOperations
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations
Expand Down Expand Up @@ -63,6 +64,7 @@
"PartnerNamespacesOperations",
"PartnerRegistrationsOperations",
"PartnerTopicsOperations",
"NetworkSecurityPerimeterConfigurationsOperations",
"PermissionBindingsOperations",
"PrivateEndpointConnectionsOperations",
"PrivateLinkResourcesOperations",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from ...operations._namespace_topic_event_subscriptions_operations import (
build_create_or_update_request,
build_delete_request,
build_get_delivery_attributes_request,
build_get_request,
build_list_by_namespace_topic_request,
build_update_request,
Expand Down Expand Up @@ -940,3 +941,83 @@ async def get_next(next_link=None):
list_by_namespace_topic.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions"
}

@distributed_trace_async
async def get_delivery_attributes(
self,
resource_group_name: str,
namespace_name: str,
topic_name: str,
event_subscription_name: str,
**kwargs: Any
) -> _models.DeliveryAttributeListResult:
"""Get delivery attributes for an event subscription of a namespace topic.

Get all delivery attributes for an event subscription of a namespace topic.

:param resource_group_name: The name of the resource group within the user's subscription.
Required.
:type resource_group_name: str
:param namespace_name: Name of the namespace. Required.
:type namespace_name: str
:param topic_name: Name of the namespace topic. Required.
:type topic_name: str
:param event_subscription_name: Name of the event subscription to be created. Event
subscription names must be between 3 and 100 characters in length and use alphanumeric letters
only. Required.
:type event_subscription_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DeliveryAttributeListResult or the result of cls(response)
:rtype: ~azure.mgmt.eventgrid.models.DeliveryAttributeListResult
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DeliveryAttributeListResult] = kwargs.pop("cls", None)

request = build_get_delivery_attributes_request(
resource_group_name=resource_group_name,
namespace_name=namespace_name,
topic_name=topic_name,
event_subscription_name=event_subscription_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_delivery_attributes.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)

_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)

response = pipeline_response.http_response

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize("DeliveryAttributeListResult", pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized

get_delivery_attributes.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/namespaces/{namespaceName}/topics/{topicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes"
}
Loading