def create_update_event_hub_raw_data_capture( namespace_name: str, event_hub_name: str, datalake_name: str, datetime_partition_level: "DateTimeLevels" = DateTimeLevels.NA, partition_id_level: "PartitionByIdLevel" = PartitionIdLevels.NA, max_file_in_minutes: int = None, max_file_in_MB: int = None): endpoint = next( obj for obj in list_event_hubs(namespace_name) if obj["EventHubNamespace"] == namespace_name and obj["Name"] == event_hub_name and obj['EndpointTypeId'] == 2) datastore = neuro_call('80', 'datastoremanager', 'getdatastores', {"StoreName": datalake_name})['DataStores'][0] request = { 'EndPointId': endpoint['EndPointId'], 'DataStoreId': datastore['DataStoreId'], 'PartitionByDateTimeLevel': datetime_partition_level.value, 'PartitionByIdLevel': partition_id_level.value, 'FileTimeMinutesMax': max_file_in_minutes, 'FileSizeMBMax': max_file_in_MB } neuro_call_v2(service='endpointmanager', method='PutRawData', requestbody=request, controller="endpointmanagement")
def list_iot_hub_devices(iot_hub_name: str): endpoint = next( obj for obj in list_iot_hubs()["EndPointInfo"] if obj["Name"] == iot_hub_name and obj['EndpointTypeId'] == 1) request = {'EndpointId': endpoint['EndPointId']} neuro_call_v2(service='endpointmanager', method='GetRegisterDevices', requestbody=request, controller="endpointmanagement")["DeviceInfo"]
def delete_event_hub_namespace(name: str): #Require interactive check = input("Are you sure you want to delete %s (y/n)" % name) if check == 'y': request = {"NameSpaceName": name} neuro_call_v2(service="endpointmanager", method="DeleteNamespace", requestbody=request, controller="endpointmanagement") return "%s has been deleted" % name
def create_iot_hub(iot_hub_name: str): request = { 'EndpointName': iot_hub_name, 'EndPointType': 1, 'Description': '', 'ScaleTierTypeId': 0, 'DataIngestionTypeId': 0 } neuro_call_v2(service='endpointmanager', method='CreateEndpoint', requestbody=request, controller="endpointmanagement")
def delete_iot_hub(iot_hub_name: str): endpoint = next( obj for obj in list_iot_hubs() if obj["Name"] == iot_hub_name and obj['EndpointTypeId'] == 1) #Require interactive check = input("Are you sure you want to delete %s (y/n)" % iot_hub_name) if check == 'y': request = {'EndPointId': endpoint['EndPointId']} neuro_call_v2(service='endpointmanager', method='DeleteEndpoint', requestbody=request, controller="endpointmanagement") return "%s has been deleted" % iot_hub_name
def delete_event_hub(namespace_name: str, event_hub_name: str): endpoint = next(obj for obj in list_event_hubs(namespace_name) if obj["EventHubNamespace"] == namespace_name and obj["Name"] == event_hub_name) #Require interactive check = input("Are you sure you want to delete %s:%s (y/n)" % (namespace_name, event_hub_name)) if check == 'y': request = {'EndPointId': endpoint['EndPointId']} neuro_call_v2(service='endpointmanager', method='DeleteEndpoint', requestbody=request, controller="endpointmanagement") return "%s:%s has been deleted" % (namespace_name, event_hub_name)
def create_notification_definition(name:str,delivery_descriptors:"list[delivery_descriptor]",description:str=None,notification_batching_period_in_seconds:int=None): """ Specify a notification definition. """ requestbody={"Name":name,"DeliveryDescriptors":delivery_descriptors,"Description":description,"NotificationBatchingPeriodInSeconds":notification_batching_period_in_seconds} response = neuro_call_v2("Notification", "CreateNotificationDefinition", requestbody) return {"Id":response['NotificationDefinitionId']}
def delete_notification_definition(notification_id:str): """ Delete a notification definition. """ requestbody={"NotificationDefinitionId":notification_id} response = neuro_call_v2("Notification", "DeleteNotificationDefinition", requestbody) return 'Successful'
def delete_event_monitor_feed(feed_id: str): """ Delete an event monitor feed. """ requestbody = {"EventMonitorFeedId": feed_id} response = neuro_call_v2("Event", "DeleteEventMonitorFeed", requestbody) return 'Successful'
def list_iot_hubs(): request = {} return [ hub for hub in neuro_call_v2(service='endpointmanager', method='GetEndpoints', requestbody=request, controller="endpointmanagement") ['EndPointInfo'] if hub['EndpointTypeId'] == 1 ]
def create_event_monitor_feed(name: str, filter_columns: "list[str]"): """ Specify an event monitor feed. """ requestbody = { "EventMonitorFeedName": name, "FilterColumns": filter_columns } response = neuro_call_v2("Event", "CreateEventMonitorFeed", requestbody) return {"Id": response['EventMonitorFeedId']}
def delete_event_definition(feed_id: str, event_id: str): """ Delete an event definition. """ requestbody = { "EventMonitorFeedId": feed_id, "EventDefinitionId": event_id } response = neuro_call_v2("Event", "DeleteEventDefinition", requestbody) return 'Successful'
def list_event_hubs(namespace_name: str): request = {} return [ hub for hub in neuro_call_v2( service='endpointmanager', method='GetEndpoints', requestbody=request, controller="endpointmanagement")['EndPointInfo'] if hub['EndpointTypeId'] == 2 and hub['EventHubNamespace'] == namespace_name ]
def list_event_monitor_feeds(): """ List event monitor feeds. """ requestbody = {} response = neuro_call_v2("Event", "ListEventMonitorFeeds", requestbody) return [{ "Id": r['EventMonitorFeedId'], "Name": r['EventMonitorFeedName'], "FilterColumns": r['FilterColumns'] } for r in response]
def list_notification_definitions(): """ List notification definitions """ requestbody={} response = neuro_call_v2("Notification", "ListNotificationDefinitions", requestbody) return [ { "Id":r['NotificationDefinitionId'], "Name":r['Name'], "DeliveryDescriptors":r['DeliveryDescriptors'], "Description":r['Description'], "NotificationBatchingPeriodInSeconds":r['NotificationBatchingPeriodInSeconds'] } for r in response]
def create_event_definition(feed_id: str, name: str, severity: int, sql_filter: str = None, notification_definition_id: str = None, description: str = '', notification_batching_filter_column: str = None): """ Specify an event monitor feed. """ requestbody = { "EventMonitorFeedId": feed_id, "EventDefinitionAlias": str(uuid.uuid4()).replace('-', ''), "EventDefinitionName": name, "EventDefinitionDescription": description, "EventDefinitionSeverity": severity, "SqlFilterQuery": sql_filter, "NotificationDefinitionId": notification_definition_id, "NotificationBatchingFilterColumn": notification_batching_filter_column } response = neuro_call_v2("Event", "CreateEventDefinition", requestbody) return {"Id": response['EventDefinitionId']}
def list_event_definitions(feed_id: str): """ List event definitions. """ requestbody = {"EventMonitorFeedId": feed_id} response = neuro_call_v2("Event", "ListEventDefinitions", requestbody) return [{ "Id": r['EventDefinitionId'], "Name": r['EventDefinitionName'], "Description": r['EventDefinitionDescription'], "SqlFilter": r['SqlFilterQuery'], "NotificationDefinitionId": r['NotificationDefinitionId'], "NotificationBatchingFilterColumn": r['NotificationBatchingFilterColumn'], "Severity": r['EventDefinitionSeverity'], "FeedId": r['EventMonitorFeedId'] } for r in response]
def list_event_hub_namespaces(): request = {} return neuro_call_v2(service="endpointmanager", method="GetNameSpace", requestbody=request, controller="endpointmanagement")['EventHubNamespaces']
def create_event_hub_namespace(name: str): request = {"NameSpaceName": name} neuro_call_v2(service="endpointmanager", method="createnamespace", requestbody=request, controller="endpointmanagement")