Skip to content

Commit

Permalink
[AutoPR] restapi_auto_eventgrid/data-plane (#1940)
Browse files Browse the repository at this point in the history
* [AutoPR eventgrid/data-plane] EventGrid data spec for Microsoft.Devices/Iothub (#1904)

* Generated from 09ac6b9005ddc1667bfc5b9d5b16a443ea2ad363

EventGrid data spec for Microsoft.Devices/Iothub

* Generated from f361f6c926150cd9b32b899b461820a29596af3d

Update to break out complex objection into smaller definitions

* Generated from 048ae64499ca8406a3757bd92caef9a19219a15e

Use allOf instead of flatten attribute

* Generated from ac94324824771806a34d4bb260ab169201d84a26

Using x-ms-client-name for properties with $ symbol

* [AutoPR eventgrid/data-plane] [EventGrid/ACR] Add schema of ACR events published to Event Grid (#1973)

* Generated from 68c7269bf112dbc1c3a9f685d456d49c083e7e01

Update readme file

* Generated from fb68356e498ecacce188fe42fa15aa7cacbb329d

Prefix class name with ContainerRegistry

* Generated from c67230b9d400baa1f6e88f8643fb8a716172dbc0 (#2476)

EventGrid Py conf to 1.0.0

* Packaging for EventGrid DT 1.0.0
  • Loading branch information
lmazuel authored Apr 26, 2018
1 parent 7e3bec2 commit 0e22811
Show file tree
Hide file tree
Showing 55 changed files with 2,261 additions and 143 deletions.
33 changes: 33 additions & 0 deletions azure-eventgrid/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,39 @@
Release History
===============

1.0.0 (2018-04-26)
++++++++++++++++++

**General Breaking changes**

This version uses a next-generation code generator that *might* introduce breaking changes.

- Model signatures now use only keyword-argument syntax. All positional arguments must be re-written as keyword-arguments.
To keep auto-completion in most cases, models are now generated for Python 2 and Python 3. Python 3 uses the "*" syntax for keyword-only arguments.
- Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to improve the behavior when unrecognized enum values are encountered.
While this is not a breaking change, the distinctions are important, and are documented here:
https://docs.python.org/3/library/enum.html#others
At a glance:

- "is" should not be used at all.
- "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered.

- New Long Running Operation:

- Return type changes from `msrestazure.azure_operation.AzureOperationPoller` to `msrest.polling.LROPoller`. External API is the same.
- Return type is now **always** a `msrest.polling.LROPoller`, regardless of the optional parameters used.
- The behavior has changed when using `raw=True`. Instead of returning the initial call result as `ClientRawResponse`,
without polling, now this returns an LROPoller. After polling, the final resource will be returned as a `ClientRawResponse`.
- New `polling` parameter. The default behavior is `Polling=True` which will poll using ARM algorithm. When `Polling=False`,
the response of the initial call will be returned without polling.
- `polling` parameter accepts instances of subclasses of `msrest.polling.PollingMethod`.
- `add_done_callback` will no longer raise if called after polling is finished, but will instead execute the callback right away.

**Features**

- Client class can be used as a context manager to keep the underlying HTTP session open for performance
- Support for consuming Azure Container Registry events and Azure IoT Hub events published to Event Grid.

0.1.0 (2018-01-30)
++++++++++++++++++

Expand Down
9 changes: 5 additions & 4 deletions azure-eventgrid/azure/eventgrid/event_grid_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import ServiceClient
from msrest.service_client import SDKClient
from msrest import Configuration, Serializer, Deserializer
from .version import VERSION
from msrest.pipeline import ClientRawResponse
Expand Down Expand Up @@ -41,7 +41,7 @@ def __init__(
self.credentials = credentials


class EventGridClient(object):
class EventGridClient(SDKClient):
"""EventGrid Client
:ivar config: Configuration for client.
Expand All @@ -56,7 +56,7 @@ def __init__(
self, credentials):

self.config = EventGridClientConfiguration(credentials)
self._client = ServiceClient(self.config.credentials, self.config)
super(EventGridClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-01-01'
Expand Down Expand Up @@ -84,7 +84,7 @@ def publish_events(
:class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
"""
# Construct URL
url = '/api/events'
url = self.publish_events.metadata['url']
path_format_arguments = {
'topicHostname': self._serialize.url("topic_hostname", topic_hostname, 'str', skip_quote=True)
}
Expand Down Expand Up @@ -114,3 +114,4 @@ def publish_events(
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
publish_events.metadata = {'url': '/api/events'}
77 changes: 67 additions & 10 deletions azure-eventgrid/azure/eventgrid/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,58 @@
# regenerated.
# --------------------------------------------------------------------------

from .storage_blob_created_event_data import StorageBlobCreatedEventData
from .storage_blob_deleted_event_data import StorageBlobDeletedEventData
from .event_hub_capture_file_created_event_data import EventHubCaptureFileCreatedEventData
from .resource_write_success_data import ResourceWriteSuccessData
from .resource_write_failure_data import ResourceWriteFailureData
from .resource_write_cancel_data import ResourceWriteCancelData
from .resource_delete_success_data import ResourceDeleteSuccessData
from .resource_delete_failure_data import ResourceDeleteFailureData
from .resource_delete_cancel_data import ResourceDeleteCancelData
from .event_grid_event import EventGridEvent
try:
from .storage_blob_created_event_data_py3 import StorageBlobCreatedEventData
from .storage_blob_deleted_event_data_py3 import StorageBlobDeletedEventData
from .event_hub_capture_file_created_event_data_py3 import EventHubCaptureFileCreatedEventData
from .resource_write_success_data_py3 import ResourceWriteSuccessData
from .resource_write_failure_data_py3 import ResourceWriteFailureData
from .resource_write_cancel_data_py3 import ResourceWriteCancelData
from .resource_delete_success_data_py3 import ResourceDeleteSuccessData
from .resource_delete_failure_data_py3 import ResourceDeleteFailureData
from .resource_delete_cancel_data_py3 import ResourceDeleteCancelData
from .event_grid_event_py3 import EventGridEvent
from .iot_hub_device_created_event_data_py3 import IotHubDeviceCreatedEventData
from .iot_hub_device_deleted_event_data_py3 import IotHubDeviceDeletedEventData
from .device_twin_metadata_py3 import DeviceTwinMetadata
from .device_twin_properties_py3 import DeviceTwinProperties
from .device_twin_info_properties_py3 import DeviceTwinInfoProperties
from .device_twin_info_x509_thumbprint_py3 import DeviceTwinInfoX509Thumbprint
from .device_twin_info_py3 import DeviceTwinInfo
from .device_life_cycle_event_properties_py3 import DeviceLifeCycleEventProperties
from .container_registry_image_pushed_event_data_py3 import ContainerRegistryImagePushedEventData
from .container_registry_image_deleted_event_data_py3 import ContainerRegistryImageDeletedEventData
from .container_registry_event_target_py3 import ContainerRegistryEventTarget
from .container_registry_event_request_py3 import ContainerRegistryEventRequest
from .container_registry_event_actor_py3 import ContainerRegistryEventActor
from .container_registry_event_source_py3 import ContainerRegistryEventSource
from .container_registry_event_data_py3 import ContainerRegistryEventData
except (SyntaxError, ImportError):
from .storage_blob_created_event_data import StorageBlobCreatedEventData
from .storage_blob_deleted_event_data import StorageBlobDeletedEventData
from .event_hub_capture_file_created_event_data import EventHubCaptureFileCreatedEventData
from .resource_write_success_data import ResourceWriteSuccessData
from .resource_write_failure_data import ResourceWriteFailureData
from .resource_write_cancel_data import ResourceWriteCancelData
from .resource_delete_success_data import ResourceDeleteSuccessData
from .resource_delete_failure_data import ResourceDeleteFailureData
from .resource_delete_cancel_data import ResourceDeleteCancelData
from .event_grid_event import EventGridEvent
from .iot_hub_device_created_event_data import IotHubDeviceCreatedEventData
from .iot_hub_device_deleted_event_data import IotHubDeviceDeletedEventData
from .device_twin_metadata import DeviceTwinMetadata
from .device_twin_properties import DeviceTwinProperties
from .device_twin_info_properties import DeviceTwinInfoProperties
from .device_twin_info_x509_thumbprint import DeviceTwinInfoX509Thumbprint
from .device_twin_info import DeviceTwinInfo
from .device_life_cycle_event_properties import DeviceLifeCycleEventProperties
from .container_registry_image_pushed_event_data import ContainerRegistryImagePushedEventData
from .container_registry_image_deleted_event_data import ContainerRegistryImageDeletedEventData
from .container_registry_event_target import ContainerRegistryEventTarget
from .container_registry_event_request import ContainerRegistryEventRequest
from .container_registry_event_actor import ContainerRegistryEventActor
from .container_registry_event_source import ContainerRegistryEventSource
from .container_registry_event_data import ContainerRegistryEventData

__all__ = [
'StorageBlobCreatedEventData',
Expand All @@ -31,4 +73,19 @@
'ResourceDeleteFailureData',
'ResourceDeleteCancelData',
'EventGridEvent',
'IotHubDeviceCreatedEventData',
'IotHubDeviceDeletedEventData',
'DeviceTwinMetadata',
'DeviceTwinProperties',
'DeviceTwinInfoProperties',
'DeviceTwinInfoX509Thumbprint',
'DeviceTwinInfo',
'DeviceLifeCycleEventProperties',
'ContainerRegistryImagePushedEventData',
'ContainerRegistryImageDeletedEventData',
'ContainerRegistryEventTarget',
'ContainerRegistryEventRequest',
'ContainerRegistryEventActor',
'ContainerRegistryEventSource',
'ContainerRegistryEventData',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ContainerRegistryEventActor(Model):
"""The agent that initiated the event. For most situations, this could be from
the authorization context of the request.
:param name: The subject or username associated with the request context
that generated the event.
:type name: str
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ContainerRegistryEventActor, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ContainerRegistryEventActor(Model):
"""The agent that initiated the event. For most situations, this could be from
the authorization context of the request.
:param name: The subject or username associated with the request context
that generated the event.
:type name: str
"""

_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}

def __init__(self, *, name: str=None, **kwargs) -> None:
super(ContainerRegistryEventActor, self).__init__(**kwargs)
self.name = name
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ContainerRegistryEventData(Model):
"""The content of the event request message.
:param id: The event ID.
:type id: str
:param timestamp: The time at which the event occurred.
:type timestamp: datetime
:param action: The action that encompasses the provided event.
:type action: str
:param target: The target of the event.
:type target: ~azure.eventgrid.models.ContainerRegistryEventTarget
:param request: The request that generated the event.
:type request: ~azure.eventgrid.models.ContainerRegistryEventRequest
:param actor: The agent that initiated the event. For most situations,
this could be from the authorization context of the request.
:type actor: ~azure.eventgrid.models.ContainerRegistryEventActor
:param source: The registry node that generated the event. Put
differently, while the actor initiates the event, the source generates it.
:type source: ~azure.eventgrid.models.ContainerRegistryEventSource
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'timestamp': {'key': 'timestamp', 'type': 'iso-8601'},
'action': {'key': 'action', 'type': 'str'},
'target': {'key': 'target', 'type': 'ContainerRegistryEventTarget'},
'request': {'key': 'request', 'type': 'ContainerRegistryEventRequest'},
'actor': {'key': 'actor', 'type': 'ContainerRegistryEventActor'},
'source': {'key': 'source', 'type': 'ContainerRegistryEventSource'},
}

def __init__(self, **kwargs):
super(ContainerRegistryEventData, self).__init__(**kwargs)
self.id = kwargs.get('id', None)
self.timestamp = kwargs.get('timestamp', None)
self.action = kwargs.get('action', None)
self.target = kwargs.get('target', None)
self.request = kwargs.get('request', None)
self.actor = kwargs.get('actor', None)
self.source = kwargs.get('source', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ContainerRegistryEventData(Model):
"""The content of the event request message.
:param id: The event ID.
:type id: str
:param timestamp: The time at which the event occurred.
:type timestamp: datetime
:param action: The action that encompasses the provided event.
:type action: str
:param target: The target of the event.
:type target: ~azure.eventgrid.models.ContainerRegistryEventTarget
:param request: The request that generated the event.
:type request: ~azure.eventgrid.models.ContainerRegistryEventRequest
:param actor: The agent that initiated the event. For most situations,
this could be from the authorization context of the request.
:type actor: ~azure.eventgrid.models.ContainerRegistryEventActor
:param source: The registry node that generated the event. Put
differently, while the actor initiates the event, the source generates it.
:type source: ~azure.eventgrid.models.ContainerRegistryEventSource
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'timestamp': {'key': 'timestamp', 'type': 'iso-8601'},
'action': {'key': 'action', 'type': 'str'},
'target': {'key': 'target', 'type': 'ContainerRegistryEventTarget'},
'request': {'key': 'request', 'type': 'ContainerRegistryEventRequest'},
'actor': {'key': 'actor', 'type': 'ContainerRegistryEventActor'},
'source': {'key': 'source', 'type': 'ContainerRegistryEventSource'},
}

def __init__(self, *, id: str=None, timestamp=None, action: str=None, target=None, request=None, actor=None, source=None, **kwargs) -> None:
super(ContainerRegistryEventData, self).__init__(**kwargs)
self.id = id
self.timestamp = timestamp
self.action = action
self.target = target
self.request = request
self.actor = actor
self.source = source
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class ContainerRegistryEventRequest(Model):
"""The request that generated the event.
:param id: The ID of the request that initiated the event.
:type id: str
:param addr: The IP or hostname and possibly port of the client connection
that initiated the event. This is the RemoteAddr from the standard http
request.
:type addr: str
:param host: The externally accessible hostname of the registry instance,
as specified by the http host header on incoming requests.
:type host: str
:param method: The request method that generated the event.
:type method: str
:param useragent: The user agent header of the request.
:type useragent: str
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'addr': {'key': 'addr', 'type': 'str'},
'host': {'key': 'host', 'type': 'str'},
'method': {'key': 'method', 'type': 'str'},
'useragent': {'key': 'useragent', 'type': 'str'},
}

def __init__(self, **kwargs):
super(ContainerRegistryEventRequest, self).__init__(**kwargs)
self.id = kwargs.get('id', None)
self.addr = kwargs.get('addr', None)
self.host = kwargs.get('host', None)
self.method = kwargs.get('method', None)
self.useragent = kwargs.get('useragent', None)
Loading

0 comments on commit 0e22811

Please sign in to comment.