diff --git a/docs/nitric/api/events.html b/docs/nitric/api/events.html new file mode 100644 index 0000000..b1af7bd --- /dev/null +++ b/docs/nitric/api/events.html @@ -0,0 +1,370 @@ + + + + + + +nitric.api.events API documentation + + + + + + + + + + + +
+
+
+

Module nitric.api.events

+
+
+
+ +Expand source code + +
#
+# Copyright (c) 2021 Nitric Technologies Pty Ltd.
+#
+# This file is part of Nitric Python 3 SDK.
+# See https://github.com/nitrictech/python-sdk for further info.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from typing import List, Union
+from nitric.utils import new_default_channel, _struct_from_dict
+from nitric.proto.nitric.event.v1 import EventStub, NitricEvent, TopicStub
+from dataclasses import dataclass, field
+
+
+@dataclass(frozen=True, order=True)
+class Event(object):
+    """Represents a NitricEvent."""
+
+    payload: dict = field(default_factory=dict)
+    id: str = field(default=None)
+    payload_type: str = field(default=None)
+
+
+def _event_to_wire(event: Event) -> NitricEvent:
+    return NitricEvent(
+        id=event.id,
+        payload=_struct_from_dict(event.payload),
+        payload_type=event.payload_type,
+    )
+
+
+@dataclass(frozen=True, order=True)
+class Topic(object):
+    """A reference to a topic on an event service, used to perform operations on that topic."""
+
+    _stub: EventStub
+    name: str
+
+    async def publish(
+        self,
+        event: Union[Event, dict] = None,
+    ) -> Event:
+        """
+        Publish an event/message to a topic, which can be subscribed to by other services.
+
+        :param event: the event to publish
+        :return: the published event, with the id added if one was auto-generated
+        """
+        if event is None:
+            event = Event()
+
+        if isinstance(event, dict):
+            # TODO: handle events that are just a payload
+            event = Event(**event)
+
+        response = await self._stub.publish(topic=self.name, event=_event_to_wire(event))
+        return Event(**{**event.__dict__.copy(), **{"id": response.id}})
+
+
+class EventClient(object):
+    """
+    Nitric generic publish/subscribe event client.
+
+    This client insulates application code from stack specific event operations or SDKs.
+    """
+
+    def __init__(self):
+        """Construct a Nitric Event Client."""
+        channel = new_default_channel()
+        self._stub = EventStub(channel=channel)
+        self._topic_stub = TopicStub(channel=channel)
+
+    async def topics(self) -> List[Topic]:
+        """Get a list of topics available for publishing or subscription."""
+        response = await self._topic_stub.list()
+        return [self.topic(topic.name) for topic in response.topics]
+
+    def topic(self, name: str) -> Topic:
+        """Return a reference a topic from the connected event service."""
+        return Topic(_stub=self._stub, name=name)
+
+
+
+
+
+
+
+
+
+

Classes

+
+
+class Event +(payload: dict = <factory>, id: str = None, payload_type: str = None) +
+
+

Represents a NitricEvent.

+
+ +Expand source code + +
class Event(object):
+    """Represents a NitricEvent."""
+
+    payload: dict = field(default_factory=dict)
+    id: str = field(default=None)
+    payload_type: str = field(default=None)
+
+

Class variables

+
+
var id : str
+
+
+
+
var payload : dict
+
+
+
+
var payload_type : str
+
+
+
+
+
+
+class EventClient +
+
+

Nitric generic publish/subscribe event client.

+

This client insulates application code from stack specific event operations or SDKs.

+

Construct a Nitric Event Client.

+
+ +Expand source code + +<<<<<<< refs/remotes/origin/main:docs/nitric/api/models.html +
class FailedTask(Task):
+    """Represents a failed queue publish for an event."""
+=======
+
class EventClient(object):
+    """
+    Nitric generic publish/subscribe event client.
+
+    This client insulates application code from stack specific event operations or SDKs.
+    """
+
+    def __init__(self):
+        """Construct a Nitric Event Client."""
+        channel = new_default_channel()
+        self._stub = EventStub(channel=channel)
+        self._topic_stub = TopicStub(channel=channel)
+>>>>>>> feat: port faas.start to bi-di streaming with membrane:docs/nitric/api/events.html
+
+    async def topics(self) -> List[Topic]:
+        """Get a list of topics available for publishing or subscription."""
+        response = await self._topic_stub.list()
+        return [self.topic(topic.name) for topic in response.topics]
+
+    def topic(self, name: str) -> Topic:
+        """Return a reference a topic from the connected event service."""
+        return Topic(_stub=self._stub, name=name)
+
+

Methods

+
+
+def topic(self, name: str) ‑> Topic +
+
+

Return a reference a topic from the connected event service.

+
+ +Expand source code + +
def topic(self, name: str) -> Topic:
+    """Return a reference a topic from the connected event service."""
+    return Topic(_stub=self._stub, name=name)
+
+
+
+async def topics(self) ‑> List[Topic] +
+
+

Get a list of topics available for publishing or subscription.

+
+ +Expand source code + +
async def topics(self) -> List[Topic]:
+    """Get a list of topics available for publishing or subscription."""
+    response = await self._topic_stub.list()
+    return [self.topic(topic.name) for topic in response.topics]
+
+
+
+
+
+class Topic +(_stub: EventStub, name: str) +
+
+

A reference to a topic on an event service, used to perform operations on that topic.

+
+ +Expand source code + +<<<<<<< refs/remotes/origin/main:docs/nitric/api/models.html +
class Task(object):
+    """Represents a NitricTask."""
+=======
+
class Topic(object):
+    """A reference to a topic on an event service, used to perform operations on that topic."""
+
+    _stub: EventStub
+    name: str
+
+    async def publish(
+        self,
+        event: Union[Event, dict] = None,
+    ) -> Event:
+        """
+        Publish an event/message to a topic, which can be subscribed to by other services.
+
+        :param event: the event to publish
+        :return: the published event, with the id added if one was auto-generated
+        """
+        if event is None:
+            event = Event()
+
+        if isinstance(event, dict):
+            # TODO: handle events that are just a payload
+            event = Event(**event)
+>>>>>>> feat: port faas.start to bi-di streaming with membrane:docs/nitric/api/events.html
+
+        response = await self._stub.publish(topic=self.name, event=_event_to_wire(event))
+        return Event(**{**event.__dict__.copy(), **{"id": response.id}})
+
+

Class variables

+
+
var name : str
+
+
+
+
+

Methods

+
+
+async def publish(self, event: Union[Event, dict] = None) ‑> Event +
+
+

Publish an event/message to a topic, which can be subscribed to by other services.

+

:param event: the event to publish +:return: the published event, with the id added if one was auto-generated

+
+ +Expand source code + +<<<<<<< refs/remotes/origin/main:docs/nitric/api/models.html +
class Topic(object):
+    """Represents event topic metadata."""
+=======
+
async def publish(
+    self,
+    event: Union[Event, dict] = None,
+) -> Event:
+    """
+    Publish an event/message to a topic, which can be subscribed to by other services.
+
+    :param event: the event to publish
+    :return: the published event, with the id added if one was auto-generated
+    """
+    if event is None:
+        event = Event()
+
+    if isinstance(event, dict):
+        # TODO: handle events that are just a payload
+        event = Event(**event)
+>>>>>>> feat: port faas.start to bi-di streaming with membrane:docs/nitric/api/events.html
+
+    response = await self._stub.publish(topic=self.name, event=_event_to_wire(event))
+    return Event(**{**event.__dict__.copy(), **{"id": response.id}})
+
+
+
+
+
+
+
+ +
+ + + \ No newline at end of file diff --git a/docs/nitric/api/index.html b/docs/nitric/api/index.html index 2590509..4000717 100644 --- a/docs/nitric/api/index.html +++ b/docs/nitric/api/index.html @@ -46,15 +46,13 @@

Module nitric.api

# limitations under the License. # """Nitric API SDK.""" -from nitric.api.event import EventClient, TopicClient +from nitric.api.events import EventClient, Event, Topic from nitric.api.kv import KeyValueClient -from nitric.api.queue import QueueClient +from nitric.api.queues import QueueClient, Task, FailedTask from nitric.api.storage import StorageClient -from nitric.api.models import Event, Task, FailedTask, Topic __all__ = [ "EventClient", - "TopicClient", "KeyValueClient", "QueueClient", "StorageClient", @@ -68,7 +66,7 @@

Module nitric.api

Sub-modules

-
nitric.api.event
+
nitric.api.events
@@ -80,11 +78,7 @@

Sub-modules

-
nitric.api.models
-
-
-
-
nitric.api.queue
+
nitric.api.queues
@@ -103,7 +97,7 @@

Classes

class Event -(event_id: str, payload_type: str, payload: dict) +(payload: dict = <factory>, id: str = None, payload_type: str = None)

Represents a NitricEvent.

@@ -114,13 +108,13 @@

Classes

class Event(object):
     """Represents a NitricEvent."""
 
-    event_id: str
-    payload_type: str
-    payload: dict
+ payload: dict = field(default_factory=dict) + id: str = field(default=None) + payload_type: str = field(default=None)

Class variables

-
var event_id : str
+
var id : str
@@ -145,7 +139,7 @@

Class variables

Expand source code -
class EventClient(BaseClient):
+
class EventClient(object):
     """
     Nitric generic publish/subscribe event client.
 
@@ -154,86 +148,55 @@ 

Class variables

def __init__(self): """Construct a Nitric Event Client.""" - super(self.__class__, self).__init__() - self._stub = event_service.EventStub(self._channel) + channel = new_default_channel() + self._stub = EventStub(channel=channel) + self._topic_stub = TopicStub(channel=channel) - def publish( - self, - topic_name: str, - payload: dict = None, - payload_type: str = "", - event_id: str = None, - ) -> str: - """ - Publish an event/message to a topic, which can be subscribed to by other services. + async def topics(self) -> List[Topic]: + """Get a list of topics available for publishing or subscription.""" + response = await self._topic_stub.list() + return [self.topic(topic.name) for topic in response.topics] - :param topic_name: the name of the topic to publish to - :param payload: content of the message to send - :param payload_type: fully qualified name of the event payload type, e.g. io.nitric.example.customer.created - :param event_id: a unique id, used to ensure idempotent processing of events. Defaults to a version 4 UUID. - :return: the request id on successful publish - """ - if payload is None: - payload = {} - payload_struct = Struct() - payload_struct.update(payload) - nitric_event = NitricEvent(id=event_id, payload_type=payload_type, payload=payload_struct) - request = event_model.EventPublishRequest(topic=topic_name, event=nitric_event) - self._exec("Publish", request) - return event_id
+ def topic(self, name: str) -> Topic: + """Return a reference a topic from the connected event service.""" + return Topic(_stub=self._stub, name=name)
-

Ancestors

-
    -
  • nitric.api._base_client.BaseClient
  • -
  • abc.ABC
  • -

Methods

-
-def publish(self, topic_name: str, payload: dict = None, payload_type: str = '', event_id: str = None) ‑> str +
+def topic(self, name: str) ‑> Topic
-

Publish an event/message to a topic, which can be subscribed to by other services.

-

:param topic_name: the name of the topic to publish to -:param payload: content of the message to send -:param payload_type: fully qualified name of the event payload type, e.g. io.nitric.example.customer.created -:param event_id: a unique id, used to ensure idempotent processing of events. Defaults to a version 4 UUID. -:return: the request id on successful publish

+

Return a reference a topic from the connected event service.

Expand source code -
def publish(
-    self,
-    topic_name: str,
-    payload: dict = None,
-    payload_type: str = "",
-    event_id: str = None,
-) -> str:
-    """
-    Publish an event/message to a topic, which can be subscribed to by other services.
-
-    :param topic_name: the name of the topic to publish to
-    :param payload: content of the message to send
-    :param payload_type: fully qualified name of the event payload type, e.g. io.nitric.example.customer.created
-    :param event_id: a unique id, used to ensure idempotent processing of events. Defaults to a version 4 UUID.
-    :return: the request id on successful publish
-    """
-    if payload is None:
-        payload = {}
-    payload_struct = Struct()
-    payload_struct.update(payload)
-    nitric_event = NitricEvent(id=event_id, payload_type=payload_type, payload=payload_struct)
-    request = event_model.EventPublishRequest(topic=topic_name, event=nitric_event)
-    self._exec("Publish", request)
-    return event_id
+
def topic(self, name: str) -> Topic:
+    """Return a reference a topic from the connected event service."""
+    return Topic(_stub=self._stub, name=name)
+
+
+
+async def topics(self) ‑> List[Topic] +
+
+

Get a list of topics available for publishing or subscription.

+
+ +Expand source code + +
async def topics(self) -> List[Topic]:
+    """Get a list of topics available for publishing or subscription."""
+    response = await self._topic_stub.list()
+    return [self.topic(topic.name) for topic in response.topics]
class FailedTask -(task_id: str, payload_type: str, payload: dict, lease_id: str = None, message: str = '') +(id: str = None, payload_type: str = None, payload: dict = <factory>, lease_id: str = None, message: str = '')

Represents a failed queue publish for an event.

@@ -244,71 +207,79 @@

Methods

class FailedTask(Task):
     """Represents a failed queue publish for an event."""
 
+    lease_id: str = None  # failed tasks should never have a lease id.
     message: str = field(default="")

Ancestors

Class variables

+
var lease_id : str
+
+
+
var message : str
+

Inherited members

+
class KeyValueClient +(collection: str)

Nitric generic document store/db client.

This client insulates application code from stack specific document CRUD operations or SDKs.

-

Construct a new DocumentClient.

+

Construct a new DocumentClient.

+

:param collection: name of the key/value collection

Expand source code -
class KeyValueClient(BaseClient):
+
class KeyValueClient(object):
     """
     Nitric generic document store/db client.
 
     This client insulates application code from stack specific document CRUD operations or SDKs.
     """
 
-    def __init__(self):
-        """Construct a new DocumentClient."""
-        super(self.__class__, self).__init__()
-        self._stub = key_value_service.KeyValueStub(self._channel)
+    def __init__(self, collection: str):
+        """
+        Construct a new DocumentClient.
+
+        :param collection: name of the key/value collection
+        """
+        self.collection = collection
+        self._stub = KeyValueStub(channel=new_default_channel())
 
-    def put(self, collection: str, key: str, value: dict):
-        """Create a new document with the specified key in the specified collection."""
-        value_struct = Struct()
-        value_struct.update(value)
-        request = key_value.KeyValuePutRequest(collection=collection, key=key, value=value_struct)
-        return self._exec("Put", request)
+    async def put(self, key: str, value: dict):
+        """Create a new document with the specified key."""
+        await self._stub.put(collection=self.collection, key=key, value=_struct_from_dict(value))
 
-    def get(self, collection: str, key: str) -> dict:
-        """Retrieve a document from the specified collection by its key."""
-        request = key_value.KeyValueGetRequest(collection=collection, key=key)
-        reply: KeyValueGetResponse = self._exec("Get", request)
-        document = MessageToDict(reply)["value"]
-        return document
+    async def get(self, key: str) -> dict:
+        """Retrieve a document from the specified key."""
+        response = await self._stub.get(collection=self.collection, key=key)
+        return response.value.to_dict()
 
-    def delete(self, collection: str, key: str):
+    async def delete(self, key: str):
         """Delete the specified document from the collection."""
-        request = key_value.KeyValueDeleteRequest(collection=collection, key=key)
-        return self._exec("Delete", request)
+ await self._stub.delete(collection=self.collection, key=key)
-

Ancestors

-
    -
  • nitric.api._base_client.BaseClient
  • -
  • abc.ABC
  • -

Methods

-def delete(self, collection: str, key: str) +async def delete(self, key: str)

Delete the specified document from the collection.

@@ -316,44 +287,38 @@

Methods

Expand source code -
def delete(self, collection: str, key: str):
+
async def delete(self, key: str):
     """Delete the specified document from the collection."""
-    request = key_value.KeyValueDeleteRequest(collection=collection, key=key)
-    return self._exec("Delete", request)
+ await self._stub.delete(collection=self.collection, key=key)
-def get(self, collection: str, key: str) ‑> dict +async def get(self, key: str) ‑> dict
-

Retrieve a document from the specified collection by its key.

+

Retrieve a document from the specified key.

Expand source code -
def get(self, collection: str, key: str) -> dict:
-    """Retrieve a document from the specified collection by its key."""
-    request = key_value.KeyValueGetRequest(collection=collection, key=key)
-    reply: KeyValueGetResponse = self._exec("Get", request)
-    document = MessageToDict(reply)["value"]
-    return document
+
async def get(self, key: str) -> dict:
+    """Retrieve a document from the specified key."""
+    response = await self._stub.get(collection=self.collection, key=key)
+    return response.value.to_dict()
-def put(self, collection: str, key: str, value: dict) +async def put(self, key: str, value: dict)
-

Create a new document with the specified key in the specified collection.

+

Create a new document with the specified key.

Expand source code -
def put(self, collection: str, key: str, value: dict):
-    """Create a new document with the specified key in the specified collection."""
-    value_struct = Struct()
-    value_struct.update(value)
-    request = key_value.KeyValuePutRequest(collection=collection, key=key, value=value_struct)
-    return self._exec("Put", request)
+
async def put(self, key: str, value: dict):
+    """Create a new document with the specified key."""
+    await self._stub.put(collection=self.collection, key=key, value=_struct_from_dict(value))
@@ -369,7 +334,7 @@

Methods

Expand source code -
class QueueClient(BaseClient):
+
class QueueClient(object):
     """
     Nitric generic publish/subscribe tasking client.
 
@@ -378,184 +343,26 @@ 

Methods

def __init__(self): """Construct a Nitric Queue Client.""" - super(self.__class__, self).__init__() - self._stub = queue_service.QueueStub(self._channel) - - def _task_to_wire(self, task: Task) -> queue.NitricTask: - """ - Convert a Nitric Task to a Nitric Queue Task. + self._queue_stub = QueueStub(channel=new_default_channel()) - :param task: to convert - :return: converted task - """ - payload_struct = Struct() - payload_struct.update(task.payload) - - return queue.NitricTask( - id=task.task_id, - payload_type=task.payload_type, - payload=payload_struct, - ) - - def _wire_to_task(self, task: queue.NitricTask) -> Task: - """ - Convert a Nitric Queue Task (protobuf) to a Nitric Task (python SDK). - - :param task: to convert - :return: converted task - """ - return Task( - task_id=task.id, - payload_type=task.payload_type, - payload=MessageToDict(task.payload), - lease_id=task.lease_id, - ) - - def _wire_to_failed_task(self, failed_task: queue.FailedTask) -> FailedTask: - """ - Convert a queue task that failed to push into a Failed Task object. - - :param failed_task: the failed task - :return: the Failed Task with failure message - """ - task = self._wire_to_task(failed_task.task) - - return FailedTask( - task_id=task.task_id, - payload_type=task.payload_type, - payload=task.payload, - lease_id=task.lease_id, - message=failed_task.message, - ) - - def send_batch(self, queue_name: str, tasks: List[Task] = None) -> PushResponse: - """ - Push a collection of tasks to a queue, which can be retrieved by other services. - - :param queue_name: the name of the queue to publish to - :param tasks: The tasks to push to the queue - :return: PushResponse containing a list containing details of any messages that failed to publish. - """ - if tasks is None: - tasks = [] - wire_tasks = map(self._task_to_wire, tasks) - - request = queue.QueueSendBatchRequest(queue=queue_name, tasks=wire_tasks) - - response: queue.QueueSendBatchResponse = self._exec("SendBatch", request) - - failed_tasks = map(self._wire_to_failed_task, response.failedMessages) - - return PushResponse(failed_tasks=list(failed_tasks)) - - def receive(self, queue_name: str, depth: int = None) -> List[Task]: - """ - Pop 1 or more items from the specified queue up to the depth limit. - - Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on. - Once complete or failed they must be acknowledged using the request specific leaseId. - - If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be - returned to the queue for reprocessing. - - :param queue_name: Nitric name for the queue. This will be automatically resolved to the provider specific - identifier. - :param depth: The maximum number of queue items to return. Default: 1, Min: 1. - :return: Queue items popped from the specified queue. - """ - # Set the default and minimum depth to 1. - if depth is None or depth < 1: - depth = 1 - - request = queue.QueueReceiveRequest(queue=queue_name, depth=depth) - - response: queue.QueueReceiveResponse = self._exec("Receive", request) - - # Map the response protobuf response items to Python SDK Nitric Queue Items - return [self._wire_to_task(item) for item in response.items]
+ def queue(self, name: str): + """Return a reference to a queue from the connected queue service.""" + return Queue(_queue_stub=self._queue_stub, name=name)
-

Ancestors

-
    -
  • nitric.api._base_client.BaseClient
  • -
  • abc.ABC
  • -

Methods

-
-def receive(self, queue_name: str, depth: int = None) ‑> List[Task] +
+def queue(self, name: str)
-

Pop 1 or more items from the specified queue up to the depth limit.

-

Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on. -Once complete or failed they must be acknowledged using the request specific leaseId.

-

If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be -returned to the queue for reprocessing.

-

:param queue_name: Nitric name for the queue. This will be automatically resolved to the provider specific -identifier. -:param depth: The maximum number of queue items to return. Default: 1, Min: 1. -:return: Queue items popped from the specified queue.

+

Return a reference to a queue from the connected queue service.

Expand source code -
def receive(self, queue_name: str, depth: int = None) -> List[Task]:
-    """
-    Pop 1 or more items from the specified queue up to the depth limit.
-
-    Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on.
-    Once complete or failed they must be acknowledged using the request specific leaseId.
-
-    If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be
-    returned to the queue for reprocessing.
-
-    :param queue_name: Nitric name for the queue. This will be automatically resolved to the provider specific
-    identifier.
-    :param depth: The maximum number of queue items to return. Default: 1, Min: 1.
-    :return: Queue items popped from the specified queue.
-    """
-    # Set the default and minimum depth to 1.
-    if depth is None or depth < 1:
-        depth = 1
-
-    request = queue.QueueReceiveRequest(queue=queue_name, depth=depth)
-
-    response: queue.QueueReceiveResponse = self._exec("Receive", request)
-
-    # Map the response protobuf response items to Python SDK Nitric Queue Items
-    return [self._wire_to_task(item) for item in response.items]
-
-
-
-def send_batch(self, queue_name: str, tasks: List[Task] = None) ‑> PushResponse -
-
-

Push a collection of tasks to a queue, which can be retrieved by other services.

-

:param queue_name: the name of the queue to publish to -:param tasks: The tasks to push to the queue -:return: PushResponse containing a list containing details of any messages that failed to publish.

-
- -Expand source code - -
def send_batch(self, queue_name: str, tasks: List[Task] = None) -> PushResponse:
-    """
-    Push a collection of tasks to a queue, which can be retrieved by other services.
-
-    :param queue_name: the name of the queue to publish to
-    :param tasks: The tasks to push to the queue
-    :return: PushResponse containing a list containing details of any messages that failed to publish.
-    """
-    if tasks is None:
-        tasks = []
-    wire_tasks = map(self._task_to_wire, tasks)
-
-    request = queue.QueueSendBatchRequest(queue=queue_name, tasks=wire_tasks)
-
-    response: queue.QueueSendBatchResponse = self._exec("SendBatch", request)
-
-    failed_tasks = map(self._wire_to_failed_task, response.failedMessages)
-
-    return PushResponse(failed_tasks=list(failed_tasks))
+
def queue(self, name: str):
+    """Return a reference to a queue from the connected queue service."""
+    return Queue(_queue_stub=self._queue_stub, name=name)
@@ -566,12 +373,12 @@

Methods

Nitric generic blob storage client.

This client insulates application code from stack specific blob store operations or SDKs.

-

Construct a new StorageClient.

+

Construct a Nitric Storage Client.

Expand source code -
class StorageClient(BaseClient):
+
class StorageClient(object):
     """
     Nitric generic blob storage client.
 
@@ -579,99 +386,34 @@ 

Methods

""" def __init__(self): - """Construct a new StorageClient.""" - super(self.__class__, self).__init__() - self._stub = storage_service.StorageStub(self._channel) + """Construct a Nitric Storage Client.""" + self._storage_stub = StorageStub(channel=new_default_channel()) - def write(self, bucket_name: str, key: str, body: bytes): - """ - Store a file. - - :param bucket_name: name of the bucket to store the data in. - :param key: key within the bucket, where the file should be stored. - :param body: data to be stored. - :return: storage result. - """ - request = storage.StorageWriteRequest(bucket_name=bucket_name, key=key, body=body) - response = self._exec("Write", request) - return response - - def read(self, bucket_name: str, key: str) -> bytes: - """ - Retrieve an existing file. - - :param bucket_name: name of the bucket where the file was stored. - :param key: key for the file to retrieve. - :return: the file as bytes. - """ - request = storage.StorageReadRequest(bucket_name=bucket_name, key=key) - response = self._exec("Read", request) - return response.body
+ def bucket(self, name: str): + """Return a reference to a bucket from the connected storage service.""" + return Bucket(_storage_stub=self._storage_stub, name=name)
-

Ancestors

-
    -
  • nitric.api._base_client.BaseClient
  • -
  • abc.ABC
  • -

Methods

-
-def read(self, bucket_name: str, key: str) ‑> bytes +
+def bucket(self, name: str)
-

Retrieve an existing file.

-

:param bucket_name: name of the bucket where the file was stored. -:param key: key for the file to retrieve. -:return: the file as bytes.

+

Return a reference to a bucket from the connected storage service.

Expand source code -
def read(self, bucket_name: str, key: str) -> bytes:
-    """
-    Retrieve an existing file.
-
-    :param bucket_name: name of the bucket where the file was stored.
-    :param key: key for the file to retrieve.
-    :return: the file as bytes.
-    """
-    request = storage.StorageReadRequest(bucket_name=bucket_name, key=key)
-    response = self._exec("Read", request)
-    return response.body
-
-
-
-def write(self, bucket_name: str, key: str, body: bytes) -
-
-

Store a file.

-

:param bucket_name: name of the bucket to store the data in. -:param key: key within the bucket, where the file should be stored. -:param body: data to be stored. -:return: storage result.

-
- -Expand source code - -
def write(self, bucket_name: str, key: str, body: bytes):
-    """
-    Store a file.
-
-    :param bucket_name: name of the bucket to store the data in.
-    :param key: key within the bucket, where the file should be stored.
-    :param body: data to be stored.
-    :return: storage result.
-    """
-    request = storage.StorageWriteRequest(bucket_name=bucket_name, key=key, body=body)
-    response = self._exec("Write", request)
-    return response
+
def bucket(self, name: str):
+    """Return a reference to a bucket from the connected storage service."""
+    return Bucket(_storage_stub=self._storage_stub, name=name)
class Task -(task_id: str, payload_type: str, payload: dict, lease_id: str = None) +(id: str = None, payload_type: str = None, payload: dict = <factory>, lease_id: str = None)

Represents a NitricTask.

@@ -682,17 +424,34 @@

Methods

class Task(object):
     """Represents a NitricTask."""
 
-    task_id: str
-    payload_type: str
-    payload: dict
-    lease_id: str = field(default=None)
+ id: str = field(default=None) + payload_type: str = field(default=None) + payload: dict = field(default_factory=dict) + lease_id: str = field(default=None) + _queue_stub: QueueStub = field(default=None) + _queue: str = field(default=None) + + async def complete(self): + """Mark this task as complete and remove it from the queue.""" + if self._queue_stub is None or self._queue is None or self._queue == "": + raise Exception("Task was not created via Queue.") + if self.lease_id is None: + raise Exception( + "No lease_id available for task. Tasks must be received using Queue.receive to have a " + "valid lease_id." + ) + await self._queue_stub.complete(queue=self._queue, lease_id=self.lease_id)

Subclasses

Class variables

+
var id : str
+
+
+
var lease_id : str
@@ -705,26 +464,71 @@

Class variables

-
var task_id : str
+
+

Methods

+
+
+async def complete(self) +
-
+

Mark this task as complete and remove it from the queue.

+
+ +Expand source code + +
async def complete(self):
+    """Mark this task as complete and remove it from the queue."""
+    if self._queue_stub is None or self._queue is None or self._queue == "":
+        raise Exception("Task was not created via Queue.")
+    if self.lease_id is None:
+        raise Exception(
+            "No lease_id available for task. Tasks must be received using Queue.receive to have a "
+            "valid lease_id."
+        )
+    await self._queue_stub.complete(queue=self._queue, lease_id=self.lease_id)
+
class Topic -(name: str) +(_stub: EventStub, name: str)
-

Represents event topic metadata.

+

A reference to a topic on an event service, used to perform operations on that topic.

Expand source code
class Topic(object):
+<<<<<<< refs/remotes/origin/main
     """Represents event topic metadata."""
+=======
+    """A reference to a topic on an event service, used to perform operations on that topic."""
+
+    _stub: EventStub
+    name: str
+
+    async def publish(
+        self,
+        event: Union[Event, dict] = None,
+    ) -> Event:
+        """
+        Publish an event/message to a topic, which can be subscribed to by other services.
+
+        :param event: the event to publish
+        :return: the published event, with the id added if one was auto-generated
+        """
+        if event is None:
+            event = Event()
+
+        if isinstance(event, dict):
+            # TODO: handle events that are just a payload
+            event = Event(**event)
+>>>>>>> feat: port faas.start to bi-di streaming with membrane
 
-    name: str
+ response = await self._stub.publish(topic=self.name, event=_event_to_wire(event)) + return Event(**{**event.__dict__.copy(), **{"id": response.id}})

Class variables

@@ -733,57 +537,38 @@

Class variables

- -
-class TopicClient +

Methods

+
+
+async def publish(self, event: Union[Event, dict] = None) ‑> Event
-

Nitric generic event topic client.

-

This client insulates application code from stack specific topic operations or SDKs.

-

Construct a Nitric Topic Client.

+

Publish an event/message to a topic, which can be subscribed to by other services.

+

:param event: the event to publish +:return: the published event, with the id added if one was auto-generated

Expand source code -
class TopicClient(BaseClient):
+
async def publish(
+    self,
+    event: Union[Event, dict] = None,
+) -> Event:
     """
-    Nitric generic event topic client.
+    Publish an event/message to a topic, which can be subscribed to by other services.
 
-    This client insulates application code from stack specific topic operations or SDKs.
+    :param event: the event to publish
+    :return: the published event, with the id added if one was auto-generated
     """
+    if event is None:
+        event = Event()
 
-    def __init__(self):
-        """Construct a Nitric Topic Client."""
-        super(self.__class__, self).__init__()
-        self._stub = event_service.TopicStub(self._channel)
+    if isinstance(event, dict):
+        # TODO: handle events that are just a payload
+        event = Event(**event)
 
-    def get_topics(self) -> List[Topic]:
-        """Get a list of topics available for publishing or subscription."""
-        response: event.TopicListResponse = self._exec("List")
-        topics = [Topic(name=topic.name) for topic in response.topics]
-        return topics
-
-

Ancestors

-
    -
  • nitric.api._base_client.BaseClient
  • -
  • abc.ABC
  • -
-

Methods

-
-
-def get_topics(self) ‑> List[Topic] -
-
-

Get a list of topics available for publishing or subscription.

-
- -Expand source code - -
def get_topics(self) -> List[Topic]:
-    """Get a list of topics available for publishing or subscription."""
-    response: event.TopicListResponse = self._exec("List")
-    topics = [Topic(name=topic.name) for topic in response.topics]
-    return topics
+ response = await self._stub.publish(topic=self.name, event=_event_to_wire(event)) + return Event(**{**event.__dict__.copy(), **{"id": response.id}})
@@ -804,11 +589,10 @@

Index

  • Sub-modules

  • @@ -817,7 +601,7 @@

    Index

  • Event

    @@ -825,12 +609,14 @@

    Event<
  • EventClient

  • FailedTask

  • @@ -845,36 +631,30 @@

    QueueClient

  • StorageClient

  • Task

  • Topic

    -
  • -
  • -

    TopicClient

    -
  • diff --git a/docs/nitric/api/kv.html b/docs/nitric/api/kv.html index c614e70..57e530b 100644 --- a/docs/nitric/api/kv.html +++ b/docs/nitric/api/kv.html @@ -44,44 +44,38 @@

    Module nitric.api.kv

    # See the License for the specific language governing permissions and # limitations under the License. # -from nitric.proto import key_value -from nitric.proto import key_value_service -from nitric.api._base_client import BaseClient -from google.protobuf.struct_pb2 import Struct -from google.protobuf.json_format import MessageToDict -from nitric.proto.kv.v1.kv_pb2 import KeyValueGetResponse +from nitric.utils import new_default_channel, _struct_from_dict +from nitric.proto.nitric.kv.v1 import KeyValueStub -class KeyValueClient(BaseClient): +class KeyValueClient(object): """ Nitric generic document store/db client. This client insulates application code from stack specific document CRUD operations or SDKs. """ - def __init__(self): - """Construct a new DocumentClient.""" - super(self.__class__, self).__init__() - self._stub = key_value_service.KeyValueStub(self._channel) + def __init__(self, collection: str): + """ + Construct a new DocumentClient. - def put(self, collection: str, key: str, value: dict): - """Create a new document with the specified key in the specified collection.""" - value_struct = Struct() - value_struct.update(value) - request = key_value.KeyValuePutRequest(collection=collection, key=key, value=value_struct) - return self._exec("Put", request) + :param collection: name of the key/value collection + """ + self.collection = collection + self._stub = KeyValueStub(channel=new_default_channel()) - def get(self, collection: str, key: str) -> dict: - """Retrieve a document from the specified collection by its key.""" - request = key_value.KeyValueGetRequest(collection=collection, key=key) - reply: KeyValueGetResponse = self._exec("Get", request) - document = MessageToDict(reply)["value"] - return document + async def put(self, key: str, value: dict): + """Create a new document with the specified key.""" + await self._stub.put(collection=self.collection, key=key, value=_struct_from_dict(value)) - def delete(self, collection: str, key: str): + async def get(self, key: str) -> dict: + """Retrieve a document from the specified key.""" + response = await self._stub.get(collection=self.collection, key=key) + return response.value.to_dict() + + async def delete(self, key: str): """Delete the specified document from the collection.""" - request = key_value.KeyValueDeleteRequest(collection=collection, key=key) - return self._exec("Delete", request)
    + await self._stub.delete(collection=self.collection, key=key)
    @@ -95,55 +89,50 @@

    Classes

    class KeyValueClient +(collection: str)

    Nitric generic document store/db client.

    This client insulates application code from stack specific document CRUD operations or SDKs.

    -

    Construct a new DocumentClient.

    +

    Construct a new DocumentClient.

    +

    :param collection: name of the key/value collection

    Expand source code -
    class KeyValueClient(BaseClient):
    +
    class KeyValueClient(object):
         """
         Nitric generic document store/db client.
     
         This client insulates application code from stack specific document CRUD operations or SDKs.
         """
     
    -    def __init__(self):
    -        """Construct a new DocumentClient."""
    -        super(self.__class__, self).__init__()
    -        self._stub = key_value_service.KeyValueStub(self._channel)
    +    def __init__(self, collection: str):
    +        """
    +        Construct a new DocumentClient.
    +
    +        :param collection: name of the key/value collection
    +        """
    +        self.collection = collection
    +        self._stub = KeyValueStub(channel=new_default_channel())
     
    -    def put(self, collection: str, key: str, value: dict):
    -        """Create a new document with the specified key in the specified collection."""
    -        value_struct = Struct()
    -        value_struct.update(value)
    -        request = key_value.KeyValuePutRequest(collection=collection, key=key, value=value_struct)
    -        return self._exec("Put", request)
    +    async def put(self, key: str, value: dict):
    +        """Create a new document with the specified key."""
    +        await self._stub.put(collection=self.collection, key=key, value=_struct_from_dict(value))
     
    -    def get(self, collection: str, key: str) -> dict:
    -        """Retrieve a document from the specified collection by its key."""
    -        request = key_value.KeyValueGetRequest(collection=collection, key=key)
    -        reply: KeyValueGetResponse = self._exec("Get", request)
    -        document = MessageToDict(reply)["value"]
    -        return document
    +    async def get(self, key: str) -> dict:
    +        """Retrieve a document from the specified key."""
    +        response = await self._stub.get(collection=self.collection, key=key)
    +        return response.value.to_dict()
     
    -    def delete(self, collection: str, key: str):
    +    async def delete(self, key: str):
             """Delete the specified document from the collection."""
    -        request = key_value.KeyValueDeleteRequest(collection=collection, key=key)
    -        return self._exec("Delete", request)
    + await self._stub.delete(collection=self.collection, key=key)
    -

    Ancestors

    -
      -
    • nitric.api._base_client.BaseClient
    • -
    • abc.ABC
    • -

    Methods

    -def delete(self, collection: str, key: str) +async def delete(self, key: str)

    Delete the specified document from the collection.

    @@ -151,38 +140,43 @@

    Methods

    Expand source code -
    def delete(self, collection: str, key: str):
    +
    async def delete(self, key: str):
         """Delete the specified document from the collection."""
    -    request = key_value.KeyValueDeleteRequest(collection=collection, key=key)
    -    return self._exec("Delete", request)
    + await self._stub.delete(collection=self.collection, key=key)
    -def get(self, collection: str, key: str) ‑> dict +async def get(self, key: str) ‑> dict
    -

    Retrieve a document from the specified collection by its key.

    +

    Retrieve a document from the specified key.

    Expand source code -
    def get(self, collection: str, key: str) -> dict:
    -    """Retrieve a document from the specified collection by its key."""
    -    request = key_value.KeyValueGetRequest(collection=collection, key=key)
    -    reply: KeyValueGetResponse = self._exec("Get", request)
    -    document = MessageToDict(reply)["value"]
    -    return document
    +
    async def get(self, key: str) -> dict:
    +    """Retrieve a document from the specified key."""
    +    response = await self._stub.get(collection=self.collection, key=key)
    +    return response.value.to_dict()
    +<<<<<<< refs/remotes/origin/main def put(self, collection: str, key: str, value: dict)

    Create a new document with the specified key in the specified collection.

    +======= +async def put(self, key: str, value: dict) +
    +
    +

    Create a new document with the specified key.

    +>>>>>>> feat: port faas.start to bi-di streaming with membrane
    Expand source code +<<<<<<< refs/remotes/origin/main
    def put(self, collection: str, key: str, value: dict):
         """Create a new document with the specified key in the specified collection."""
         value_struct = Struct()
    @@ -216,6 +210,12 @@ 

    Instance variables

    var value

    Field nitric.kv.v1.KeyValueGetResponse.value

    +======= +
    async def put(self, key: str, value: dict):
    +    """Create a new document with the specified key."""
    +    await self._stub.put(collection=self.collection, key=key, value=_struct_from_dict(value))
    +
    +>>>>>>> feat: port faas.start to bi-di streaming with membrane
    @@ -243,6 +243,7 @@

    put +<<<<<<< refs/remotes/origin/main
  • KeyValueGetResponse

      @@ -250,6 +251,8 @@

      value

  • +======= +>>>>>>> feat: port faas.start to bi-di streaming with membrane diff --git a/docs/nitric/api/models.html b/docs/nitric/api/models.html deleted file mode 100644 index dbb3e6f..0000000 --- a/docs/nitric/api/models.html +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - -nitric.api.models API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.api.models

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -from dataclasses import dataclass, field
    -
    -
    -@dataclass(frozen=True, order=True)
    -class Topic(object):
    -    """Represents event topic metadata."""
    -
    -    name: str
    -
    -
    -@dataclass(frozen=True, order=True)
    -class Event(object):
    -    """Represents a NitricEvent."""
    -
    -    event_id: str
    -    payload_type: str
    -    payload: dict
    -
    -
    -@dataclass(frozen=True, order=True)
    -class Task(object):
    -    """Represents a NitricTask."""
    -
    -    task_id: str
    -    payload_type: str
    -    payload: dict
    -    lease_id: str = field(default=None)
    -
    -
    -@dataclass(frozen=True, order=True)
    -class FailedTask(Task):
    -    """Represents a failed queue publish for an event."""
    -
    -    message: str = field(default="")
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class Event -(event_id: str, payload_type: str, payload: dict) -
    -
    -

    Represents a NitricEvent.

    -
    - -Expand source code - -
    class Event(object):
    -    """Represents a NitricEvent."""
    -
    -    event_id: str
    -    payload_type: str
    -    payload: dict
    -
    -

    Class variables

    -
    -
    var event_id : str
    -
    -
    -
    -
    var payload : dict
    -
    -
    -
    -
    var payload_type : str
    -
    -
    -
    -
    -
    -
    -class FailedTask -(task_id: str, payload_type: str, payload: dict, lease_id: str = None, message: str = '') -
    -
    -

    Represents a failed queue publish for an event.

    -
    - -Expand source code - -
    class FailedTask(Task):
    -    """Represents a failed queue publish for an event."""
    -
    -    message: str = field(default="")
    -
    -

    Ancestors

    - -

    Class variables

    -
    -
    var message : str
    -
    -
    -
    -
    -
    -
    -class Task -(task_id: str, payload_type: str, payload: dict, lease_id: str = None) -
    -
    -

    Represents a NitricTask.

    -
    - -Expand source code - -
    class Task(object):
    -    """Represents a NitricTask."""
    -
    -    task_id: str
    -    payload_type: str
    -    payload: dict
    -    lease_id: str = field(default=None)
    -
    -

    Subclasses

    - -

    Class variables

    -
    -
    var lease_id : str
    -
    -
    -
    -
    var payload : dict
    -
    -
    -
    -
    var payload_type : str
    -
    -
    -
    -
    var task_id : str
    -
    -
    -
    -
    -
    -
    -class Topic -(name: str) -
    -
    -

    Represents event topic metadata.

    -
    - -Expand source code - -
    class Topic(object):
    -    """Represents event topic metadata."""
    -
    -    name: str
    -
    -

    Class variables

    -
    -
    var name : str
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/api/queue.html b/docs/nitric/api/queue.html deleted file mode 100644 index 7993e8f..0000000 --- a/docs/nitric/api/queue.html +++ /dev/null @@ -1,437 +0,0 @@ - - - - - - -nitric.api.queue API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.api.queue

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -from typing import List
    -
    -from google.protobuf.json_format import MessageToDict
    -from google.protobuf.struct_pb2 import Struct
    -
    -from nitric.api._base_client import BaseClient
    -from nitric.api.models import FailedTask, Task
    -from nitric.proto import queue
    -from nitric.proto import queue_service
    -
    -
    -class PushResponse(object):
    -    """Represents the result of a Queue Push."""
    -
    -    def __init__(self, failed_tasks: List[FailedTask]):
    -        """Construct a Push Response."""
    -        self.failed_tasks = failed_tasks
    -
    -
    -class QueueClient(BaseClient):
    -    """
    -    Nitric generic publish/subscribe tasking client.
    -
    -    This client insulates application code from stack specific task/topic operations or SDKs.
    -    """
    -
    -    def __init__(self):
    -        """Construct a Nitric Queue Client."""
    -        super(self.__class__, self).__init__()
    -        self._stub = queue_service.QueueStub(self._channel)
    -
    -    def _task_to_wire(self, task: Task) -> queue.NitricTask:
    -        """
    -        Convert a Nitric Task to a Nitric Queue Task.
    -
    -        :param task: to convert
    -        :return: converted task
    -        """
    -        payload_struct = Struct()
    -        payload_struct.update(task.payload)
    -
    -        return queue.NitricTask(
    -            id=task.task_id,
    -            payload_type=task.payload_type,
    -            payload=payload_struct,
    -        )
    -
    -    def _wire_to_task(self, task: queue.NitricTask) -> Task:
    -        """
    -        Convert a Nitric Queue Task (protobuf) to a Nitric Task (python SDK).
    -
    -        :param task: to convert
    -        :return: converted task
    -        """
    -        return Task(
    -            task_id=task.id,
    -            payload_type=task.payload_type,
    -            payload=MessageToDict(task.payload),
    -            lease_id=task.lease_id,
    -        )
    -
    -    def _wire_to_failed_task(self, failed_task: queue.FailedTask) -> FailedTask:
    -        """
    -        Convert a queue task that failed to push into a Failed Task object.
    -
    -        :param failed_task: the failed task
    -        :return: the Failed Task with failure message
    -        """
    -        task = self._wire_to_task(failed_task.task)
    -
    -        return FailedTask(
    -            task_id=task.task_id,
    -            payload_type=task.payload_type,
    -            payload=task.payload,
    -            lease_id=task.lease_id,
    -            message=failed_task.message,
    -        )
    -
    -    def send_batch(self, queue_name: str, tasks: List[Task] = None) -> PushResponse:
    -        """
    -        Push a collection of tasks to a queue, which can be retrieved by other services.
    -
    -        :param queue_name: the name of the queue to publish to
    -        :param tasks: The tasks to push to the queue
    -        :return: PushResponse containing a list containing details of any messages that failed to publish.
    -        """
    -        if tasks is None:
    -            tasks = []
    -        wire_tasks = map(self._task_to_wire, tasks)
    -
    -        request = queue.QueueSendBatchRequest(queue=queue_name, tasks=wire_tasks)
    -
    -        response: queue.QueueSendBatchResponse = self._exec("SendBatch", request)
    -
    -        failed_tasks = map(self._wire_to_failed_task, response.failedMessages)
    -
    -        return PushResponse(failed_tasks=list(failed_tasks))
    -
    -    def receive(self, queue_name: str, depth: int = None) -> List[Task]:
    -        """
    -        Pop 1 or more items from the specified queue up to the depth limit.
    -
    -        Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on.
    -        Once complete or failed they must be acknowledged using the request specific leaseId.
    -
    -        If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be
    -        returned to the queue for reprocessing.
    -
    -        :param queue_name: Nitric name for the queue. This will be automatically resolved to the provider specific
    -        identifier.
    -        :param depth: The maximum number of queue items to return. Default: 1, Min: 1.
    -        :return: Queue items popped from the specified queue.
    -        """
    -        # Set the default and minimum depth to 1.
    -        if depth is None or depth < 1:
    -            depth = 1
    -
    -        request = queue.QueueReceiveRequest(queue=queue_name, depth=depth)
    -
    -        response: queue.QueueReceiveResponse = self._exec("Receive", request)
    -
    -        # Map the response protobuf response items to Python SDK Nitric Queue Items
    -        return [self._wire_to_task(item) for item in response.items]
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class PushResponse -(failed_tasks: List[FailedTask]) -
    -
    -

    Represents the result of a Queue Push.

    -

    Construct a Push Response.

    -
    - -Expand source code - -
    class PushResponse(object):
    -    """Represents the result of a Queue Push."""
    -
    -    def __init__(self, failed_tasks: List[FailedTask]):
    -        """Construct a Push Response."""
    -        self.failed_tasks = failed_tasks
    -
    -
    -
    -class QueueClient -
    -
    -

    Nitric generic publish/subscribe tasking client.

    -

    This client insulates application code from stack specific task/topic operations or SDKs.

    -

    Construct a Nitric Queue Client.

    -
    - -Expand source code - -
    class QueueClient(BaseClient):
    -    """
    -    Nitric generic publish/subscribe tasking client.
    -
    -    This client insulates application code from stack specific task/topic operations or SDKs.
    -    """
    -
    -    def __init__(self):
    -        """Construct a Nitric Queue Client."""
    -        super(self.__class__, self).__init__()
    -        self._stub = queue_service.QueueStub(self._channel)
    -
    -    def _task_to_wire(self, task: Task) -> queue.NitricTask:
    -        """
    -        Convert a Nitric Task to a Nitric Queue Task.
    -
    -        :param task: to convert
    -        :return: converted task
    -        """
    -        payload_struct = Struct()
    -        payload_struct.update(task.payload)
    -
    -        return queue.NitricTask(
    -            id=task.task_id,
    -            payload_type=task.payload_type,
    -            payload=payload_struct,
    -        )
    -
    -    def _wire_to_task(self, task: queue.NitricTask) -> Task:
    -        """
    -        Convert a Nitric Queue Task (protobuf) to a Nitric Task (python SDK).
    -
    -        :param task: to convert
    -        :return: converted task
    -        """
    -        return Task(
    -            task_id=task.id,
    -            payload_type=task.payload_type,
    -            payload=MessageToDict(task.payload),
    -            lease_id=task.lease_id,
    -        )
    -
    -    def _wire_to_failed_task(self, failed_task: queue.FailedTask) -> FailedTask:
    -        """
    -        Convert a queue task that failed to push into a Failed Task object.
    -
    -        :param failed_task: the failed task
    -        :return: the Failed Task with failure message
    -        """
    -        task = self._wire_to_task(failed_task.task)
    -
    -        return FailedTask(
    -            task_id=task.task_id,
    -            payload_type=task.payload_type,
    -            payload=task.payload,
    -            lease_id=task.lease_id,
    -            message=failed_task.message,
    -        )
    -
    -    def send_batch(self, queue_name: str, tasks: List[Task] = None) -> PushResponse:
    -        """
    -        Push a collection of tasks to a queue, which can be retrieved by other services.
    -
    -        :param queue_name: the name of the queue to publish to
    -        :param tasks: The tasks to push to the queue
    -        :return: PushResponse containing a list containing details of any messages that failed to publish.
    -        """
    -        if tasks is None:
    -            tasks = []
    -        wire_tasks = map(self._task_to_wire, tasks)
    -
    -        request = queue.QueueSendBatchRequest(queue=queue_name, tasks=wire_tasks)
    -
    -        response: queue.QueueSendBatchResponse = self._exec("SendBatch", request)
    -
    -        failed_tasks = map(self._wire_to_failed_task, response.failedMessages)
    -
    -        return PushResponse(failed_tasks=list(failed_tasks))
    -
    -    def receive(self, queue_name: str, depth: int = None) -> List[Task]:
    -        """
    -        Pop 1 or more items from the specified queue up to the depth limit.
    -
    -        Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on.
    -        Once complete or failed they must be acknowledged using the request specific leaseId.
    -
    -        If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be
    -        returned to the queue for reprocessing.
    -
    -        :param queue_name: Nitric name for the queue. This will be automatically resolved to the provider specific
    -        identifier.
    -        :param depth: The maximum number of queue items to return. Default: 1, Min: 1.
    -        :return: Queue items popped from the specified queue.
    -        """
    -        # Set the default and minimum depth to 1.
    -        if depth is None or depth < 1:
    -            depth = 1
    -
    -        request = queue.QueueReceiveRequest(queue=queue_name, depth=depth)
    -
    -        response: queue.QueueReceiveResponse = self._exec("Receive", request)
    -
    -        # Map the response protobuf response items to Python SDK Nitric Queue Items
    -        return [self._wire_to_task(item) for item in response.items]
    -
    -

    Ancestors

    -
      -
    • nitric.api._base_client.BaseClient
    • -
    • abc.ABC
    • -
    -

    Methods

    -
    -
    -def receive(self, queue_name: str, depth: int = None) ‑> List[Task] -
    -
    -

    Pop 1 or more items from the specified queue up to the depth limit.

    -

    Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on. -Once complete or failed they must be acknowledged using the request specific leaseId.

    -

    If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be -returned to the queue for reprocessing.

    -

    :param queue_name: Nitric name for the queue. This will be automatically resolved to the provider specific -identifier. -:param depth: The maximum number of queue items to return. Default: 1, Min: 1. -:return: Queue items popped from the specified queue.

    -
    - -Expand source code - -
    def receive(self, queue_name: str, depth: int = None) -> List[Task]:
    -    """
    -    Pop 1 or more items from the specified queue up to the depth limit.
    -
    -    Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on.
    -    Once complete or failed they must be acknowledged using the request specific leaseId.
    -
    -    If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be
    -    returned to the queue for reprocessing.
    -
    -    :param queue_name: Nitric name for the queue. This will be automatically resolved to the provider specific
    -    identifier.
    -    :param depth: The maximum number of queue items to return. Default: 1, Min: 1.
    -    :return: Queue items popped from the specified queue.
    -    """
    -    # Set the default and minimum depth to 1.
    -    if depth is None or depth < 1:
    -        depth = 1
    -
    -    request = queue.QueueReceiveRequest(queue=queue_name, depth=depth)
    -
    -    response: queue.QueueReceiveResponse = self._exec("Receive", request)
    -
    -    # Map the response protobuf response items to Python SDK Nitric Queue Items
    -    return [self._wire_to_task(item) for item in response.items]
    -
    -
    -
    -def send_batch(self, queue_name: str, tasks: List[Task] = None) ‑> PushResponse -
    -
    -

    Push a collection of tasks to a queue, which can be retrieved by other services.

    -

    :param queue_name: the name of the queue to publish to -:param tasks: The tasks to push to the queue -:return: PushResponse containing a list containing details of any messages that failed to publish.

    -
    - -Expand source code - -
    def send_batch(self, queue_name: str, tasks: List[Task] = None) -> PushResponse:
    -    """
    -    Push a collection of tasks to a queue, which can be retrieved by other services.
    -
    -    :param queue_name: the name of the queue to publish to
    -    :param tasks: The tasks to push to the queue
    -    :return: PushResponse containing a list containing details of any messages that failed to publish.
    -    """
    -    if tasks is None:
    -        tasks = []
    -    wire_tasks = map(self._task_to_wire, tasks)
    -
    -    request = queue.QueueSendBatchRequest(queue=queue_name, tasks=wire_tasks)
    -
    -    response: queue.QueueSendBatchResponse = self._exec("SendBatch", request)
    -
    -    failed_tasks = map(self._wire_to_failed_task, response.failedMessages)
    -
    -    return PushResponse(failed_tasks=list(failed_tasks))
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/api/queues.html b/docs/nitric/api/queues.html new file mode 100644 index 0000000..0eb1f2a --- /dev/null +++ b/docs/nitric/api/queues.html @@ -0,0 +1,615 @@ + + + + + + +nitric.api.queues API documentation + + + + + + + + + + + +
    +
    +
    +

    Module nitric.api.queues

    +
    +
    +
    + +Expand source code + +
    #
    +# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    +#
    +# This file is part of Nitric Python 3 SDK.
    +# See https://github.com/nitrictech/python-sdk for further info.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +from typing import List, Union
    +from nitric.utils import new_default_channel, _struct_from_dict
    +from nitric.proto.nitric.queue.v1 import QueueStub, NitricTask, FailedTask as WireFailedTask
    +from dataclasses import dataclass, field
    +
    +
    +@dataclass(frozen=True, order=True)
    +class Task(object):
    +    """Represents a NitricTask."""
    +
    +    id: str = field(default=None)
    +    payload_type: str = field(default=None)
    +    payload: dict = field(default_factory=dict)
    +    lease_id: str = field(default=None)
    +    _queue_stub: QueueStub = field(default=None)
    +    _queue: str = field(default=None)
    +
    +    async def complete(self):
    +        """Mark this task as complete and remove it from the queue."""
    +        if self._queue_stub is None or self._queue is None or self._queue == "":
    +            raise Exception("Task was not created via Queue.")
    +        if self.lease_id is None:
    +            raise Exception(
    +                "No lease_id available for task. Tasks must be received using Queue.receive to have a "
    +                "valid lease_id."
    +            )
    +        await self._queue_stub.complete(queue=self._queue, lease_id=self.lease_id)
    +
    +
    +@dataclass(frozen=True, order=True)
    +class FailedTask(Task):
    +    """Represents a failed queue publish for an event."""
    +
    +    lease_id: str = None  # failed tasks should never have a lease id.
    +    message: str = field(default="")
    +
    +
    +def _task_to_wire(task: Task) -> NitricTask:
    +    """
    +    Convert a Nitric Task to a Nitric Queue Task.
    +
    +    :param task: to convert
    +    :return: converted task
    +    """
    +    return NitricTask(
    +        id=task.id,
    +        payload_type=task.payload_type,
    +        payload=_struct_from_dict(task.payload),
    +    )
    +
    +
    +def _wire_to_task(task: NitricTask) -> Task:
    +    """
    +    Convert a Nitric Queue Task (protobuf) to a Nitric Task (python SDK).
    +
    +    :param task: to convert
    +    :return: converted task
    +    """
    +    return Task(
    +        id=task.id,
    +        payload_type=task.payload_type,
    +        payload=task.payload.to_dict(),
    +        lease_id=task.lease_id,
    +    )
    +
    +
    +def _wire_to_failed_task(failed_task: WireFailedTask) -> FailedTask:
    +    """
    +    Convert a queue task that failed to push into a Failed Task object.
    +
    +    :param failed_task: the failed task
    +    :return: the Failed Task with failure message
    +    """
    +    task = _wire_to_task(failed_task.task)
    +
    +    return FailedTask(
    +        id=task.id,
    +        payload_type=task.payload_type,
    +        payload=task.payload,
    +        lease_id=task.lease_id,
    +        message=failed_task.message,
    +    )
    +
    +
    +@dataclass(frozen=True, order=True)
    +class Queue(object):
    +    """A reference to a queue from a queue service, used to perform operations on that queue."""
    +
    +    _queue_stub: QueueStub
    +    name: str
    +
    +    async def send(
    +        self, tasks: Union[Task, dict, List[Union[Task, dict]]] = None
    +    ) -> Union[Task, List[Union[Task, FailedTask]]]:
    +        """
    +        Send one or more tasks to this queue.
    +
    +        If a list of tasks is provided this function will return a list containing any tasks that failed to be sent to
    +        the queue.
    +
    +        :param tasks: A task or list of tasks to send to the queue.
    +        """
    +        if isinstance(tasks, list):
    +            return await self._send_batch(tasks)
    +
    +        task = tasks
    +        if task is None:
    +            task = Task()
    +
    +        if isinstance(task, dict):
    +            # TODO: handle tasks that are just a payload
    +            task = Task(**task)
    +
    +        await self._queue_stub.send(queue=self.name, task=_task_to_wire(task))
    +
    +    async def _send_batch(
    +        self, tasks: List[Union[Task, dict]] = None, raise_on_failure: bool = True
    +    ) -> List[FailedTask]:
    +        """
    +        Push a collection of tasks to a queue, which can be retrieved by other services.
    +
    +        :param tasks: The tasks to push to the queue
    +        :param raise_on_failure: Whether to raise an exception when one or more tasks fails to send
    +        :return: PushResponse containing a list containing details of any messages that failed to publish.
    +        """
    +        if tasks is None:
    +            tasks = []
    +
    +        wire_tasks = [_task_to_wire(Task(**task) if isinstance(task, dict) else task) for task in tasks]
    +
    +        response = await self._queue_stub.send_batch(queue=self.name, tasks=wire_tasks)
    +
    +        return [_wire_to_failed_task(failed_task) for failed_task in response.failed_tasks]
    +
    +    async def receive(self, limit: int = None) -> List[Task]:
    +        """
    +        Pop 1 or more items from the specified queue up to the depth limit.
    +
    +        Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on.
    +        Once complete or failed they must be acknowledged using the request specific leaseId.
    +
    +        If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be
    +        returned to the queue for reprocessing.
    +
    +        :param limit: The maximum number of queue items to return. Default: 1, Min: 1.
    +        :return: Queue items popped from the specified queue.
    +        """
    +        # Set the default and minimum depth to 1.
    +        if limit is None or limit < 1:
    +            limit = 1
    +
    +        response = await self._queue_stub.receive(queue=self.name, depth=limit)
    +
    +        # Map the response protobuf response items to Python SDK Nitric Tasks
    +        return [_wire_to_task(task) for task in response.tasks]
    +
    +
    +class QueueClient(object):
    +    """
    +    Nitric generic publish/subscribe tasking client.
    +
    +    This client insulates application code from stack specific task/topic operations or SDKs.
    +    """
    +
    +    def __init__(self):
    +        """Construct a Nitric Queue Client."""
    +        self._queue_stub = QueueStub(channel=new_default_channel())
    +
    +    def queue(self, name: str):
    +        """Return a reference to a queue from the connected queue service."""
    +        return Queue(_queue_stub=self._queue_stub, name=name)
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Classes

    +
    +
    +class FailedTask +(id: str = None, payload_type: str = None, payload: dict = <factory>, lease_id: str = None, message: str = '') +
    +
    +

    Represents a failed queue publish for an event.

    +
    + +Expand source code + +
    class FailedTask(Task):
    +    """Represents a failed queue publish for an event."""
    +
    +    lease_id: str = None  # failed tasks should never have a lease id.
    +    message: str = field(default="")
    +
    +

    Ancestors

    + +

    Class variables

    +
    +
    var lease_id : str
    +
    +
    +
    +
    var message : str
    +
    +
    +
    +
    +

    Inherited members

    + +
    +
    +class Queue +(_queue_stub: QueueStub, name: str) +
    +
    +

    A reference to a queue from a queue service, used to perform operations on that queue.

    +
    + +Expand source code + +
    class Queue(object):
    +    """A reference to a queue from a queue service, used to perform operations on that queue."""
    +
    +    _queue_stub: QueueStub
    +    name: str
    +
    +    async def send(
    +        self, tasks: Union[Task, dict, List[Union[Task, dict]]] = None
    +    ) -> Union[Task, List[Union[Task, FailedTask]]]:
    +        """
    +        Send one or more tasks to this queue.
    +
    +        If a list of tasks is provided this function will return a list containing any tasks that failed to be sent to
    +        the queue.
    +
    +        :param tasks: A task or list of tasks to send to the queue.
    +        """
    +        if isinstance(tasks, list):
    +            return await self._send_batch(tasks)
    +
    +        task = tasks
    +        if task is None:
    +            task = Task()
    +
    +        if isinstance(task, dict):
    +            # TODO: handle tasks that are just a payload
    +            task = Task(**task)
    +
    +        await self._queue_stub.send(queue=self.name, task=_task_to_wire(task))
    +
    +    async def _send_batch(
    +        self, tasks: List[Union[Task, dict]] = None, raise_on_failure: bool = True
    +    ) -> List[FailedTask]:
    +        """
    +        Push a collection of tasks to a queue, which can be retrieved by other services.
    +
    +        :param tasks: The tasks to push to the queue
    +        :param raise_on_failure: Whether to raise an exception when one or more tasks fails to send
    +        :return: PushResponse containing a list containing details of any messages that failed to publish.
    +        """
    +        if tasks is None:
    +            tasks = []
    +
    +        wire_tasks = [_task_to_wire(Task(**task) if isinstance(task, dict) else task) for task in tasks]
    +
    +        response = await self._queue_stub.send_batch(queue=self.name, tasks=wire_tasks)
    +
    +        return [_wire_to_failed_task(failed_task) for failed_task in response.failed_tasks]
    +
    +    async def receive(self, limit: int = None) -> List[Task]:
    +        """
    +        Pop 1 or more items from the specified queue up to the depth limit.
    +
    +        Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on.
    +        Once complete or failed they must be acknowledged using the request specific leaseId.
    +
    +        If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be
    +        returned to the queue for reprocessing.
    +
    +        :param limit: The maximum number of queue items to return. Default: 1, Min: 1.
    +        :return: Queue items popped from the specified queue.
    +        """
    +        # Set the default and minimum depth to 1.
    +        if limit is None or limit < 1:
    +            limit = 1
    +
    +        response = await self._queue_stub.receive(queue=self.name, depth=limit)
    +
    +        # Map the response protobuf response items to Python SDK Nitric Tasks
    +        return [_wire_to_task(task) for task in response.tasks]
    +
    +

    Class variables

    +
    +
    var name : str
    +
    +
    +
    +
    +

    Methods

    +
    +
    +async def receive(self, limit: int = None) ‑> List[Task] +
    +
    +

    Pop 1 or more items from the specified queue up to the depth limit.

    +

    Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on. +Once complete or failed they must be acknowledged using the request specific leaseId.

    +

    If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be +returned to the queue for reprocessing.

    +

    :param limit: The maximum number of queue items to return. Default: 1, Min: 1. +:return: Queue items popped from the specified queue.

    +
    + +Expand source code + +
    async def receive(self, limit: int = None) -> List[Task]:
    +    """
    +    Pop 1 or more items from the specified queue up to the depth limit.
    +
    +    Queue items are Nitric Tasks that are leased for a limited period of time, where they may be worked on.
    +    Once complete or failed they must be acknowledged using the request specific leaseId.
    +
    +    If the lease on a queue item expires before it is acknowledged or the lease is extended the task will be
    +    returned to the queue for reprocessing.
    +
    +    :param limit: The maximum number of queue items to return. Default: 1, Min: 1.
    +    :return: Queue items popped from the specified queue.
    +    """
    +    # Set the default and minimum depth to 1.
    +    if limit is None or limit < 1:
    +        limit = 1
    +
    +    response = await self._queue_stub.receive(queue=self.name, depth=limit)
    +
    +    # Map the response protobuf response items to Python SDK Nitric Tasks
    +    return [_wire_to_task(task) for task in response.tasks]
    +
    +
    +
    +async def send(self, tasks: Union[Task, dict, List[Union[Task, dict]]] = None) ‑> Union[Task, List[Union[TaskFailedTask]]] +
    +
    +

    Send one or more tasks to this queue.

    +

    If a list of tasks is provided this function will return a list containing any tasks that failed to be sent to +the queue.

    +

    :param tasks: A task or list of tasks to send to the queue.

    +
    + +Expand source code + +
    async def send(
    +    self, tasks: Union[Task, dict, List[Union[Task, dict]]] = None
    +) -> Union[Task, List[Union[Task, FailedTask]]]:
    +    """
    +    Send one or more tasks to this queue.
    +
    +    If a list of tasks is provided this function will return a list containing any tasks that failed to be sent to
    +    the queue.
    +
    +    :param tasks: A task or list of tasks to send to the queue.
    +    """
    +    if isinstance(tasks, list):
    +        return await self._send_batch(tasks)
    +
    +    task = tasks
    +    if task is None:
    +        task = Task()
    +
    +    if isinstance(task, dict):
    +        # TODO: handle tasks that are just a payload
    +        task = Task(**task)
    +
    +    await self._queue_stub.send(queue=self.name, task=_task_to_wire(task))
    +
    +
    +
    +
    +
    +class QueueClient +
    +
    +

    Nitric generic publish/subscribe tasking client.

    +

    This client insulates application code from stack specific task/topic operations or SDKs.

    +

    Construct a Nitric Queue Client.

    +
    + +Expand source code + +
    class QueueClient(object):
    +    """
    +    Nitric generic publish/subscribe tasking client.
    +
    +    This client insulates application code from stack specific task/topic operations or SDKs.
    +    """
    +
    +    def __init__(self):
    +        """Construct a Nitric Queue Client."""
    +        self._queue_stub = QueueStub(channel=new_default_channel())
    +
    +    def queue(self, name: str):
    +        """Return a reference to a queue from the connected queue service."""
    +        return Queue(_queue_stub=self._queue_stub, name=name)
    +
    +

    Methods

    +
    +
    +def queue(self, name: str) +
    +
    +

    Return a reference to a queue from the connected queue service.

    +
    + +Expand source code + +
    def queue(self, name: str):
    +    """Return a reference to a queue from the connected queue service."""
    +    return Queue(_queue_stub=self._queue_stub, name=name)
    +
    +
    +
    +
    +
    +class Task +(id: str = None, payload_type: str = None, payload: dict = <factory>, lease_id: str = None) +
    +
    +

    Represents a NitricTask.

    +
    + +Expand source code + +
    class Task(object):
    +    """Represents a NitricTask."""
    +
    +    id: str = field(default=None)
    +    payload_type: str = field(default=None)
    +    payload: dict = field(default_factory=dict)
    +    lease_id: str = field(default=None)
    +    _queue_stub: QueueStub = field(default=None)
    +    _queue: str = field(default=None)
    +
    +    async def complete(self):
    +        """Mark this task as complete and remove it from the queue."""
    +        if self._queue_stub is None or self._queue is None or self._queue == "":
    +            raise Exception("Task was not created via Queue.")
    +        if self.lease_id is None:
    +            raise Exception(
    +                "No lease_id available for task. Tasks must be received using Queue.receive to have a "
    +                "valid lease_id."
    +            )
    +        await self._queue_stub.complete(queue=self._queue, lease_id=self.lease_id)
    +
    +

    Subclasses

    + +

    Class variables

    +
    +
    var id : str
    +
    +
    +
    +
    var lease_id : str
    +
    +
    +
    +
    var payload : dict
    +
    +
    +
    +
    var payload_type : str
    +
    +
    +
    +
    +

    Methods

    +
    +
    +async def complete(self) +
    +
    +

    Mark this task as complete and remove it from the queue.

    +
    + +Expand source code + +
    async def complete(self):
    +    """Mark this task as complete and remove it from the queue."""
    +    if self._queue_stub is None or self._queue is None or self._queue == "":
    +        raise Exception("Task was not created via Queue.")
    +    if self.lease_id is None:
    +        raise Exception(
    +            "No lease_id available for task. Tasks must be received using Queue.receive to have a "
    +            "valid lease_id."
    +        )
    +    await self._queue_stub.complete(queue=self._queue, lease_id=self.lease_id)
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/docs/nitric/api/storage.html b/docs/nitric/api/storage.html index c8c59a1..4b78a51 100644 --- a/docs/nitric/api/storage.html +++ b/docs/nitric/api/storage.html @@ -44,12 +44,13 @@

    Module nitric.api.storage

    # See the License for the specific language governing permissions and # limitations under the License. # -from nitric.proto import storage -from nitric.proto import storage_service -from nitric.api._base_client import BaseClient +from dataclasses import dataclass +from nitric.utils import new_default_channel +from nitric.proto.nitric.storage.v1 import StorageStub -class StorageClient(BaseClient): + +class StorageClient(object): """ Nitric generic blob storage client. @@ -57,34 +58,50 @@

    Module nitric.api.storage

    """ def __init__(self): - """Construct a new StorageClient.""" - super(self.__class__, self).__init__() - self._stub = storage_service.StorageStub(self._channel) + """Construct a Nitric Storage Client.""" + self._storage_stub = StorageStub(channel=new_default_channel()) - def write(self, bucket_name: str, key: str, body: bytes): - """ - Store a file. + def bucket(self, name: str): + """Return a reference to a bucket from the connected storage service.""" + return Bucket(_storage_stub=self._storage_stub, name=name) + + +@dataclass(frozen=True, order=True) +class Bucket(object): + """A reference to a bucket in a storage service, used to the perform operations on that bucket.""" + + _storage_stub: StorageStub + name: str + + def file(self, key: str): + """Return a reference to a file in this bucket.""" + return File(_storage_stub=self._storage_stub, _bucket=self.name, key=key) - :param bucket_name: name of the bucket to store the data in. - :param key: key within the bucket, where the file should be stored. - :param body: data to be stored. - :return: storage result. - """ - request = storage.StorageWriteRequest(bucket_name=bucket_name, key=key, body=body) - response = self._exec("Write", request) - return response - def read(self, bucket_name: str, key: str) -> bytes: +@dataclass(frozen=True, order=True) +class File(object): + """A reference to a file in a bucket, used to perform operations on that file.""" + + _storage_stub: StorageStub + _bucket: str + key: str + + async def write(self, body: bytes): """ - Retrieve an existing file. + Write the bytes as the content of this file. - :param bucket_name: name of the bucket where the file was stored. - :param key: key for the file to retrieve. - :return: the file as bytes. + Will create the file if it doesn't already exist. """ - request = storage.StorageReadRequest(bucket_name=bucket_name, key=key) - response = self._exec("Read", request) - return response.body
    + await self._storage_stub.write(bucket_name=self._bucket, key=self.key, body=body) + + async def read(self) -> bytes: + """Read this files contents from the bucket.""" + response = await self._storage_stub.read(bucket_name=self._bucket, key=self.key) + return response.body + + async def delete(self): + """Delete this file from the bucket.""" + await self._storage_stub.delete(bucket_name=self._bucket, key=self.key)
    @@ -96,111 +113,184 @@

    Module nitric.api.storage

    Classes

    -
    -class StorageClient +
    +class Bucket +(_storage_stub: StorageStub, name: str)
    -

    Nitric generic blob storage client.

    -

    This client insulates application code from stack specific blob store operations or SDKs.

    -

    Construct a new StorageClient.

    +

    A reference to a bucket in a storage service, used to the perform operations on that bucket.

    Expand source code -
    class StorageClient(BaseClient):
    -    """
    -    Nitric generic blob storage client.
    +
    class Bucket(object):
    +    """A reference to a bucket in a storage service, used to the perform operations on that bucket."""
     
    -    This client insulates application code from stack specific blob store operations or SDKs.
    -    """
    +    _storage_stub: StorageStub
    +    name: str
     
    -    def __init__(self):
    -        """Construct a new StorageClient."""
    -        super(self.__class__, self).__init__()
    -        self._stub = storage_service.StorageStub(self._channel)
    +    def file(self, key: str):
    +        """Return a reference to a file in this bucket."""
    +        return File(_storage_stub=self._storage_stub, _bucket=self.name, key=key)
    +
    +

    Class variables

    +
    +
    var name : str
    +
    +
    +
    +
    +

    Methods

    +
    +
    +def file(self, key: str) +
    +
    +

    Return a reference to a file in this bucket.

    +
    + +Expand source code + +
    def file(self, key: str):
    +    """Return a reference to a file in this bucket."""
    +    return File(_storage_stub=self._storage_stub, _bucket=self.name, key=key)
    +
    +
    +
    +
    +
    +class File +(_storage_stub: StorageStub, _bucket: str, key: str) +
    +
    +

    A reference to a file in a bucket, used to perform operations on that file.

    +
    + +Expand source code + +
    class File(object):
    +    """A reference to a file in a bucket, used to perform operations on that file."""
     
    -    def write(self, bucket_name: str, key: str, body: bytes):
    -        """
    -        Store a file.
    +    _storage_stub: StorageStub
    +    _bucket: str
    +    key: str
     
    -        :param bucket_name: name of the bucket to store the data in.
    -        :param key: key within the bucket, where the file should be stored.
    -        :param body: data to be stored.
    -        :return: storage result.
    +    async def write(self, body: bytes):
             """
    -        request = storage.StorageWriteRequest(bucket_name=bucket_name, key=key, body=body)
    -        response = self._exec("Write", request)
    -        return response
    +        Write the bytes as the content of this file.
     
    -    def read(self, bucket_name: str, key: str) -> bytes:
    +        Will create the file if it doesn't already exist.
             """
    -        Retrieve an existing file.
    +        await self._storage_stub.write(bucket_name=self._bucket, key=self.key, body=body)
     
    -        :param bucket_name: name of the bucket where the file was stored.
    -        :param key: key for the file to retrieve.
    -        :return: the file as bytes.
    -        """
    -        request = storage.StorageReadRequest(bucket_name=bucket_name, key=key)
    -        response = self._exec("Read", request)
    -        return response.body
    + async def read(self) -> bytes: + """Read this files contents from the bucket.""" + response = await self._storage_stub.read(bucket_name=self._bucket, key=self.key) + return response.body + + async def delete(self): + """Delete this file from the bucket.""" + await self._storage_stub.delete(bucket_name=self._bucket, key=self.key)
    -

    Ancestors

    -
      -
    • nitric.api._base_client.BaseClient
    • -
    • abc.ABC
    • -
    +

    Class variables

    +
    +
    var key : str
    +
    +
    +
    +

    Methods

    -
    -def read(self, bucket_name: str, key: str) ‑> bytes +
    +async def delete(self) +
    +
    +

    Delete this file from the bucket.

    +
    + +Expand source code + +
    async def delete(self):
    +    """Delete this file from the bucket."""
    +    await self._storage_stub.delete(bucket_name=self._bucket, key=self.key)
    +
    +
    +
    +async def read(self) ‑> bytes +
    +
    +

    Read this files contents from the bucket.

    +
    + +Expand source code + +
    async def read(self) -> bytes:
    +    """Read this files contents from the bucket."""
    +    response = await self._storage_stub.read(bucket_name=self._bucket, key=self.key)
    +    return response.body
    +
    +
    +
    +async def write(self, body: bytes)
    -

    Retrieve an existing file.

    -

    :param bucket_name: name of the bucket where the file was stored. -:param key: key for the file to retrieve. -:return: the file as bytes.

    +

    Write the bytes as the content of this file.

    +

    Will create the file if it doesn't already exist.

    Expand source code -
    def read(self, bucket_name: str, key: str) -> bytes:
    +
    async def write(self, body: bytes):
         """
    -    Retrieve an existing file.
    +    Write the bytes as the content of this file.
     
    -    :param bucket_name: name of the bucket where the file was stored.
    -    :param key: key for the file to retrieve.
    -    :return: the file as bytes.
    +    Will create the file if it doesn't already exist.
         """
    -    request = storage.StorageReadRequest(bucket_name=bucket_name, key=key)
    -    response = self._exec("Read", request)
    -    return response.body
    + await self._storage_stub.write(bucket_name=self._bucket, key=self.key, body=body)
    -
    -def write(self, bucket_name: str, key: str, body: bytes) +
    +
    +
    +class StorageClient
    -

    Store a file.

    -

    :param bucket_name: name of the bucket to store the data in. -:param key: key within the bucket, where the file should be stored. -:param body: data to be stored. -:return: storage result.

    +

    Nitric generic blob storage client.

    +

    This client insulates application code from stack specific blob store operations or SDKs.

    +

    Construct a Nitric Storage Client.

    Expand source code -
    def write(self, bucket_name: str, key: str, body: bytes):
    +
    class StorageClient(object):
         """
    -    Store a file.
    +    Nitric generic blob storage client.
     
    -    :param bucket_name: name of the bucket to store the data in.
    -    :param key: key within the bucket, where the file should be stored.
    -    :param body: data to be stored.
    -    :return: storage result.
    +    This client insulates application code from stack specific blob store operations or SDKs.
         """
    -    request = storage.StorageWriteRequest(bucket_name=bucket_name, key=key, body=body)
    -    response = self._exec("Write", request)
    -    return response
    + + def __init__(self): + """Construct a Nitric Storage Client.""" + self._storage_stub = StorageStub(channel=new_default_channel()) + + def bucket(self, name: str): + """Return a reference to a bucket from the connected storage service.""" + return Bucket(_storage_stub=self._storage_stub, name=name)
    +
    +

    Methods

    +
    +
    +def bucket(self, name: str) +
    +
    +

    Return a reference to a bucket from the connected storage service.

    +
    + +Expand source code + +
    def bucket(self, name: str):
    +    """Return a reference to a bucket from the connected storage service."""
    +    return Bucket(_storage_stub=self._storage_stub, name=name)
    @@ -222,10 +312,25 @@

    Index

  • Classes

    diff --git a/docs/nitric/faas/faas.html b/docs/nitric/faas/faas.html index 936a025..09e23be 100644 --- a/docs/nitric/faas/faas.html +++ b/docs/nitric/faas/faas.html @@ -44,119 +44,85 @@

    Module nitric.faas.faas

    # See the License for the specific language governing permissions and # limitations under the License. # -from typing import Callable, Union +import traceback +from typing import Callable, Union, Coroutine, Any -from flask import Flask, request -from waitress import serve +import betterproto +from betterproto.grpc.util.async_channel import AsyncChannel -from nitric.proto.faas.v1.faas_pb2 import TriggerRequest, TriggerResponse -from nitric.config import settings +from nitric.utils import new_default_channel from nitric.faas import Trigger, Response -from google.protobuf import json_format +from nitric.proto.nitric.faas.v1 import FaasStub, InitRequest, ClientMessage +import asyncio -def construct_request() -> TriggerRequest: - """Construct a Nitric Request object from the Flask HTTP Request.""" - # full_path used to better match behavior in other SDKs - # return TriggerRequest(dict(request.headers), request.get_data(), path=request.full_path) - message = json_format.Parse(request.get_data(), TriggerRequest(), ignore_unknown_fields=False) - return message - - -def http_response(response: TriggerResponse): +async def _register_faas_worker( + func: Callable[[Trigger], Union[Coroutine[Any, Any, Union[Response, None, dict]], Union[Response, None, dict]]] +): """ - Return a full HTTP response tuple based on the Nitric Response contents. + Register a new FaaS worker with the Membrane, using the provided function as the handler. - The response includes a body, status and headers as appropriate. + :param func: handler function for incoming triggers. Can be sync or async, async is preferred. """ - headers = {"Content-Type": "application/json"} - - return json_format.MessageToJson(response), 200, headers - - -def exception_to_html(): - """Return a traceback as HTML.""" - import traceback - import sys - import html - - limit = None - exception_type, value, tb = sys.exc_info() - trace_list = traceback.format_tb(tb, limit) + traceback.format_exception_only(exception_type, value) - body = "Traceback:\n" + "%-20s %s" % ("".join(trace_list[:-1]), trace_list[-1]) - return ( - "<html><head><title>Error</title></head><body><h2>An Error Occurred:</h2>\n<pre>" - + html.escape(body) - + "</pre></body></html>\n" - ) - - -class Handler(object): - """Nitric Function handler.""" - - def __init__(self, func: Callable[[Trigger], Union[Response, str]]): - """Construct a new handler using the provided function to handle new requests.""" - self.func = func - - def __call__(self, path="", *args): - """Construct Nitric Request from HTTP Request.""" - trigger_request = construct_request() - - grpc_trigger_response: TriggerResponse - - # convert it to a trigger - trigger = Trigger.from_trigger_request(trigger_request) - - try: - # Execute the handler function - response: Union[Response, str] = self.func(trigger) - - final_response: Response - if isinstance(response, str): - final_response = trigger.default_response() - final_response.data = response.encode() - elif isinstance(response, Response): - final_response = response + channel = new_default_channel() + client = FaasStub(channel) + request_channel = AsyncChannel(close=True) + # We can start be sending all the requests we already have + try: + await request_channel.send(ClientMessage(init_request=InitRequest())) + async for srv_msg in client.trigger_stream(request_channel): + # The response iterator will remain active until the connection is closed + msg_type, val = betterproto.which_one_of(srv_msg, "content") + + if msg_type == "init_response": + print("function connected to Membrane") + # We don't need to reply + # proceed to the next available message + continue + if msg_type == "trigger_request": + trigger = Trigger.from_trigger_request(srv_msg.trigger_request) + try: + response = await func(trigger) if asyncio.iscoroutinefunction(func) else func(trigger) + except Exception: + print("Error calling handler function") + traceback.print_exc() + response = trigger.default_response() + if response.context.is_http(): + response.context.as_http().status = 500 + else: + response.context.as_topic().success = False + + # Handle lite responses with just data, assume a success in these cases + if not isinstance(response, Response): + full_response = trigger.default_response() + full_response.data = bytes(str(response), "utf-8") + response = full_response + + # Send function response back to server + await request_channel.send( + ClientMessage(id=srv_msg.id, trigger_response=response.to_grpc_trigger_response_context()) + ) else: - # assume None - final_response = trigger.default_response() - final_response.data = "".encode() - - grpc_trigger_response = final_response.to_grpc_trigger_response_context() - - except Exception: - trigger_response = trigger.default_response() - if trigger_response.context.is_http(): - trigger_response.context.as_http().status = 500 - trigger_response.context.as_http().headers = {"Content-Type": "text/html"} - trigger_response.data = exception_to_html().encode() - elif trigger_response.context.is_topic(): - trigger_response.data = "Error processing message" - trigger_response.context.as_topic().success = False - - grpc_trigger_response = trigger_response.to_grpc_trigger_response_context() - - return http_response(grpc_trigger_response) - - -def start(func: Callable[[Trigger], Union[Response, str]]): + print("unhandled message type {0}, skipping".format(msg_type)) + continue + if request_channel.done(): + break + except Exception: + traceback.print_exc() + finally: + print("stream from Membrane closed, closing client stream") + # The channel must be closed to complete the gRPC connection + request_channel.close() + channel.close() + + +def start(handler: Callable[[Trigger], Coroutine[Any, Any, Union[Response, None, dict]]]): """ - Register the provided function as the request handler and starts handling new requests. + Register the provided function as the trigger handler and starts handling new trigger requests. - :param func: to use to handle new requests + :param handler: handler function for incoming triggers. Can be sync or async, async is preferred. """ - app = Flask(__name__) - app.add_url_rule("/", "index", Handler(func), methods=["GET", "PUT", "POST", "PATCH", "DELETE"]) - app.add_url_rule( - "/<path:path>", - "path", - Handler(func), - methods=["GET", "PUT", "POST", "PATCH", "DELETE"], - ) - - host, port = f"{settings.CHILD_ADDRESS}".split(":") - # Start the function HTTP server - serve(app, host=host, port=int(port))
    + asyncio.run(_register_faas_worker(handler))
  • @@ -166,103 +132,29 @@

    Module nitric.faas.faas

    Functions

    -
    -def construct_request() ‑> faas.v1.faas_pb2.TriggerRequest -
    -
    -

    Construct a Nitric Request object from the Flask HTTP Request.

    -
    - -Expand source code - -
    def construct_request() -> TriggerRequest:
    -    """Construct a Nitric Request object from the Flask HTTP Request."""
    -    # full_path used to better match behavior in other SDKs
    -    # return TriggerRequest(dict(request.headers), request.get_data(), path=request.full_path)
    -    message = json_format.Parse(request.get_data(), TriggerRequest(), ignore_unknown_fields=False)
    -    return message
    -
    -
    -
    -def exception_to_html() -
    -
    -

    Return a traceback as HTML.

    -
    - -Expand source code - -
    def exception_to_html():
    -    """Return a traceback as HTML."""
    -    import traceback
    -    import sys
    -    import html
    -
    -    limit = None
    -    exception_type, value, tb = sys.exc_info()
    -    trace_list = traceback.format_tb(tb, limit) + traceback.format_exception_only(exception_type, value)
    -    body = "Traceback:\n" + "%-20s %s" % ("".join(trace_list[:-1]), trace_list[-1])
    -    return (
    -        "<html><head><title>Error</title></head><body><h2>An Error Occurred:</h2>\n<pre>"
    -        + html.escape(body)
    -        + "</pre></body></html>\n"
    -    )
    -
    -
    -
    -def http_response(response: faas.v1.faas_pb2.TriggerResponse) -
    -
    -

    Return a full HTTP response tuple based on the Nitric Response contents.

    -

    The response includes a body, status and headers as appropriate.

    -
    - -Expand source code - -
    def http_response(response: TriggerResponse):
    -    """
    -    Return a full HTTP response tuple based on the Nitric Response contents.
    -
    -    The response includes a body, status and headers as appropriate.
    -    """
    -    headers = {"Content-Type": "application/json"}
    -
    -    return json_format.MessageToJson(response), 200, headers
    -
    -
    -def start(func: Callable[[Trigger], Union[Response, str]]) +def start(handler: Callable[[Trigger], Coroutine[Any, Any, Union[Response, NoneType, dict]]])
    -

    Register the provided function as the request handler and starts handling new requests.

    -

    :param func: to use to handle new requests

    +

    Register the provided function as the trigger handler and starts handling new trigger requests.

    +

    :param handler: handler function for incoming triggers. Can be sync or async, async is preferred.

    Expand source code -
    def start(func: Callable[[Trigger], Union[Response, str]]):
    +
    def start(handler: Callable[[Trigger], Coroutine[Any, Any, Union[Response, None, dict]]]):
         """
    -    Register the provided function as the request handler and starts handling new requests.
    +    Register the provided function as the trigger handler and starts handling new trigger requests.
     
    -    :param func: to use to handle new requests
    +    :param handler: handler function for incoming triggers. Can be sync or async, async is preferred.
         """
    -    app = Flask(__name__)
    -    app.add_url_rule("/", "index", Handler(func), methods=["GET", "PUT", "POST", "PATCH", "DELETE"])
    -    app.add_url_rule(
    -        "/<path:path>",
    -        "path",
    -        Handler(func),
    -        methods=["GET", "PUT", "POST", "PATCH", "DELETE"],
    -    )
    -
    -    host, port = f"{settings.CHILD_ADDRESS}".split(":")
    -    # Start the function HTTP server
    -    serve(app, host=host, port=int(port))
    + asyncio.run(_register_faas_worker(handler))
    +<<<<<<< refs/remotes/origin/main

    Classes

    @@ -397,6 +289,8 @@

    Instance variables

    +======= +>>>>>>> feat: port faas.start to bi-di streaming with membrane
    @@ -684,6 +703,12 @@

    Index

    diff --git a/docs/nitric/index.html b/docs/nitric/index.html index 4b52622..4db1f09 100644 --- a/docs/nitric/index.html +++ b/docs/nitric/index.html @@ -67,6 +67,10 @@

    Sub-modules

    +
    nitric.utils
    +
    +
    +
    @@ -88,6 +92,7 @@

    Index

  • nitric.config
  • nitric.faas
  • nitric.proto
  • +
  • nitric.utils
  • diff --git a/docs/nitric/proto/auth/v1/auth_pb2.html b/docs/nitric/proto/auth/v1/auth_pb2.html deleted file mode 100644 index 3ed5f5b..0000000 --- a/docs/nitric/proto/auth/v1/auth_pb2.html +++ /dev/null @@ -1,309 +0,0 @@ - - - - - - -nitric.proto.auth.v1.auth_pb2 API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.auth.v1.auth_pb2

    -
    -
    -

    Generated protocol buffer code.

    -
    - -Expand source code - -
    # -*- coding: utf-8 -*-
    -#
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -# Generated by the protocol buffer compiler.  DO NOT EDIT!
    -# source: auth/v1/auth.proto
    -"""Generated protocol buffer code."""
    -from google.protobuf import descriptor as _descriptor
    -from google.protobuf import message as _message
    -from google.protobuf import reflection as _reflection
    -from google.protobuf import symbol_database as _symbol_database
    -# @@protoc_insertion_point(imports)
    -
    -_sym_db = _symbol_database.Default()
    -
    -
    -
    -
    -DESCRIPTOR = _descriptor.FileDescriptor(
    -  name='auth/v1/auth.proto',
    -  package='nitric.auth.v1',
    -  syntax='proto3',
    -  serialized_options=b'\n\027io.nitric.proto.auth.v1B\004AuthP\001Z\014nitric/v1;v1\252\002\024Nitric.Proto.Auth.v1\312\002\024Nitric\\Proto\\Auth\\V1',
    -  create_key=_descriptor._internal_create_key,
    -  serialized_pb=b'\n\x12\x61uth/v1/auth.proto\x12\x0enitric.auth.v1\"P\n\x11UserCreateRequest\x12\x0e\n\x06tenant\x18\x01 \x01(\t\x12\n\n\x02id\x18\x02 \x01(\t\x12\r\n\x05\x65mail\x18\x03 \x01(\t\x12\x10\n\x08password\x18\x04 \x01(\t\"\x14\n\x12UserCreateResponse2W\n\x04User\x12O\n\x06\x43reate\x12!.nitric.auth.v1.UserCreateRequest\x1a\".nitric.auth.v1.UserCreateResponseB]\n\x17io.nitric.proto.auth.v1B\x04\x41uthP\x01Z\x0cnitric/v1;v1\xaa\x02\x14Nitric.Proto.Auth.v1\xca\x02\x14Nitric\\Proto\\Auth\\V1b\x06proto3'
    -)
    -
    -
    -
    -
    -_USERCREATEREQUEST = _descriptor.Descriptor(
    -  name='UserCreateRequest',
    -  full_name='nitric.auth.v1.UserCreateRequest',
    -  filename=None,
    -  file=DESCRIPTOR,
    -  containing_type=None,
    -  create_key=_descriptor._internal_create_key,
    -  fields=[
    -    _descriptor.FieldDescriptor(
    -      name='tenant', full_name='nitric.auth.v1.UserCreateRequest.tenant', index=0,
    -      number=1, type=9, cpp_type=9, label=1,
    -      has_default_value=False, default_value=b"".decode('utf-8'),
    -      message_type=None, enum_type=None, containing_type=None,
    -      is_extension=False, extension_scope=None,
    -      serialized_options=None, file=DESCRIPTOR,  create_key=_descriptor._internal_create_key),
    -    _descriptor.FieldDescriptor(
    -      name='id', full_name='nitric.auth.v1.UserCreateRequest.id', index=1,
    -      number=2, type=9, cpp_type=9, label=1,
    -      has_default_value=False, default_value=b"".decode('utf-8'),
    -      message_type=None, enum_type=None, containing_type=None,
    -      is_extension=False, extension_scope=None,
    -      serialized_options=None, file=DESCRIPTOR,  create_key=_descriptor._internal_create_key),
    -    _descriptor.FieldDescriptor(
    -      name='email', full_name='nitric.auth.v1.UserCreateRequest.email', index=2,
    -      number=3, type=9, cpp_type=9, label=1,
    -      has_default_value=False, default_value=b"".decode('utf-8'),
    -      message_type=None, enum_type=None, containing_type=None,
    -      is_extension=False, extension_scope=None,
    -      serialized_options=None, file=DESCRIPTOR,  create_key=_descriptor._internal_create_key),
    -    _descriptor.FieldDescriptor(
    -      name='password', full_name='nitric.auth.v1.UserCreateRequest.password', index=3,
    -      number=4, type=9, cpp_type=9, label=1,
    -      has_default_value=False, default_value=b"".decode('utf-8'),
    -      message_type=None, enum_type=None, containing_type=None,
    -      is_extension=False, extension_scope=None,
    -      serialized_options=None, file=DESCRIPTOR,  create_key=_descriptor._internal_create_key),
    -  ],
    -  extensions=[
    -  ],
    -  nested_types=[],
    -  enum_types=[
    -  ],
    -  serialized_options=None,
    -  is_extendable=False,
    -  syntax='proto3',
    -  extension_ranges=[],
    -  oneofs=[
    -  ],
    -  serialized_start=38,
    -  serialized_end=118,
    -)
    -
    -
    -_USERCREATERESPONSE = _descriptor.Descriptor(
    -  name='UserCreateResponse',
    -  full_name='nitric.auth.v1.UserCreateResponse',
    -  filename=None,
    -  file=DESCRIPTOR,
    -  containing_type=None,
    -  create_key=_descriptor._internal_create_key,
    -  fields=[
    -  ],
    -  extensions=[
    -  ],
    -  nested_types=[],
    -  enum_types=[
    -  ],
    -  serialized_options=None,
    -  is_extendable=False,
    -  syntax='proto3',
    -  extension_ranges=[],
    -  oneofs=[
    -  ],
    -  serialized_start=120,
    -  serialized_end=140,
    -)
    -
    -DESCRIPTOR.message_types_by_name['UserCreateRequest'] = _USERCREATEREQUEST
    -DESCRIPTOR.message_types_by_name['UserCreateResponse'] = _USERCREATERESPONSE
    -_sym_db.RegisterFileDescriptor(DESCRIPTOR)
    -
    -UserCreateRequest = _reflection.GeneratedProtocolMessageType('UserCreateRequest', (_message.Message,), {
    -  'DESCRIPTOR' : _USERCREATEREQUEST,
    -  '__module__' : 'auth.v1.auth_pb2'
    -  # @@protoc_insertion_point(class_scope:nitric.auth.v1.UserCreateRequest)
    -  })
    -_sym_db.RegisterMessage(UserCreateRequest)
    -
    -UserCreateResponse = _reflection.GeneratedProtocolMessageType('UserCreateResponse', (_message.Message,), {
    -  'DESCRIPTOR' : _USERCREATERESPONSE,
    -  '__module__' : 'auth.v1.auth_pb2'
    -  # @@protoc_insertion_point(class_scope:nitric.auth.v1.UserCreateResponse)
    -  })
    -_sym_db.RegisterMessage(UserCreateResponse)
    -
    -
    -DESCRIPTOR._options = None
    -
    -_USER = _descriptor.ServiceDescriptor(
    -  name='User',
    -  full_name='nitric.auth.v1.User',
    -  file=DESCRIPTOR,
    -  index=0,
    -  serialized_options=None,
    -  create_key=_descriptor._internal_create_key,
    -  serialized_start=142,
    -  serialized_end=229,
    -  methods=[
    -  _descriptor.MethodDescriptor(
    -    name='Create',
    -    full_name='nitric.auth.v1.User.Create',
    -    index=0,
    -    containing_service=None,
    -    input_type=_USERCREATEREQUEST,
    -    output_type=_USERCREATERESPONSE,
    -    serialized_options=None,
    -    create_key=_descriptor._internal_create_key,
    -  ),
    -])
    -_sym_db.RegisterServiceDescriptor(_USER)
    -
    -DESCRIPTOR.services_by_name['User'] = _USER
    -
    -# @@protoc_insertion_point(module_scope)
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class UserCreateRequest -(*args, **kwargs) -
    -
    -

    A ProtocolMessage

    -

    Ancestors

    -
      -
    • google.protobuf.pyext._message.CMessage
    • -
    • google.protobuf.message.Message
    • -
    -

    Class variables

    -
    -
    var DESCRIPTOR
    -
    -
    -
    -
    -

    Instance variables

    -
    -
    var email
    -
    -

    Field nitric.auth.v1.UserCreateRequest.email

    -
    -
    var id
    -
    -

    Field nitric.auth.v1.UserCreateRequest.id

    -
    -
    var password
    -
    -

    Field nitric.auth.v1.UserCreateRequest.password

    -
    -
    var tenant
    -
    -

    Field nitric.auth.v1.UserCreateRequest.tenant

    -
    -
    -
    -
    -class UserCreateResponse -(*args, **kwargs) -
    -
    -

    A ProtocolMessage

    -

    Ancestors

    -
      -
    • google.protobuf.pyext._message.CMessage
    • -
    • google.protobuf.message.Message
    • -
    -

    Class variables

    -
    -
    var DESCRIPTOR
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/auth/v1/auth_pb2_grpc.html b/docs/nitric/proto/auth/v1/auth_pb2_grpc.html deleted file mode 100644 index 205735f..0000000 --- a/docs/nitric/proto/auth/v1/auth_pb2_grpc.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - -nitric.proto.auth.v1.auth_pb2_grpc API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.auth.v1.auth_pb2_grpc

    -
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
    -"""Client and server classes corresponding to protobuf-defined services."""
    -import grpc
    -
    -from nitric.proto.auth.v1 import auth_pb2 as auth_dot_v1_dot_auth__pb2
    -
    -
    -class UserStub(object):
    -    """Service for user management activities, such as creating and deleting users
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Create = channel.unary_unary(
    -                '/nitric.auth.v1.User/Create',
    -                request_serializer=auth_dot_v1_dot_auth__pb2.UserCreateRequest.SerializeToString,
    -                response_deserializer=auth_dot_v1_dot_auth__pb2.UserCreateResponse.FromString,
    -                )
    -
    -
    -class UserServicer(object):
    -    """Service for user management activities, such as creating and deleting users
    -    """
    -
    -    def Create(self, request, context):
    -        """Create a new user in a tenant
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -
    -def add_UserServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Create': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Create,
    -                    request_deserializer=auth_dot_v1_dot_auth__pb2.UserCreateRequest.FromString,
    -                    response_serializer=auth_dot_v1_dot_auth__pb2.UserCreateResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.auth.v1.User', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    - # This class is part of an EXPERIMENTAL API.
    -class User(object):
    -    """Service for user management activities, such as creating and deleting users
    -    """
    -
    -    @staticmethod
    -    def Create(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.auth.v1.User/Create',
    -            auth_dot_v1_dot_auth__pb2.UserCreateRequest.SerializeToString,
    -            auth_dot_v1_dot_auth__pb2.UserCreateResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -
    -
    -

    Functions

    -
    -
    -def add_UserServicer_to_server(servicer, server) -
    -
    -
    -
    - -Expand source code - -
    def add_UserServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Create': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Create,
    -                    request_deserializer=auth_dot_v1_dot_auth__pb2.UserCreateRequest.FromString,
    -                    response_serializer=auth_dot_v1_dot_auth__pb2.UserCreateResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.auth.v1.User', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class User -
    -
    -

    Service for user management activities, such as creating and deleting users

    -
    - -Expand source code - -
    class User(object):
    -    """Service for user management activities, such as creating and deleting users
    -    """
    -
    -    @staticmethod
    -    def Create(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.auth.v1.User/Create',
    -            auth_dot_v1_dot_auth__pb2.UserCreateRequest.SerializeToString,
    -            auth_dot_v1_dot_auth__pb2.UserCreateResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -

    Static methods

    -
    -
    -def Create(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Create(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.auth.v1.User/Create',
    -        auth_dot_v1_dot_auth__pb2.UserCreateRequest.SerializeToString,
    -        auth_dot_v1_dot_auth__pb2.UserCreateResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -class UserServicer -
    -
    -

    Service for user management activities, such as creating and deleting users

    -
    - -Expand source code - -
    class UserServicer(object):
    -    """Service for user management activities, such as creating and deleting users
    -    """
    -
    -    def Create(self, request, context):
    -        """Create a new user in a tenant
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -

    Methods

    -
    -
    -def Create(self, request, context) -
    -
    -

    Create a new user in a tenant

    -
    - -Expand source code - -
    def Create(self, request, context):
    -    """Create a new user in a tenant
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -
    -
    -class UserStub -(channel) -
    -
    -

    Service for user management activities, such as creating and deleting users

    -

    Constructor.

    -

    Args

    -
    -
    channel
    -
    A grpc.Channel.
    -
    -
    - -Expand source code - -
    class UserStub(object):
    -    """Service for user management activities, such as creating and deleting users
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Create = channel.unary_unary(
    -                '/nitric.auth.v1.User/Create',
    -                request_serializer=auth_dot_v1_dot_auth__pb2.UserCreateRequest.SerializeToString,
    -                response_deserializer=auth_dot_v1_dot_auth__pb2.UserCreateResponse.FromString,
    -                )
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/auth/v1/index.html b/docs/nitric/proto/auth/v1/index.html deleted file mode 100644 index 80ff29f..0000000 --- a/docs/nitric/proto/auth/v1/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - -nitric.proto.auth.v1 API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.auth.v1

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -
    -
    -

    Sub-modules

    -
    -
    nitric.proto.auth.v1.auth_pb2
    -
    -

    Generated protocol buffer code.

    -
    -
    nitric.proto.auth.v1.auth_pb2_grpc
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/event/v1/event_pb2_grpc.html b/docs/nitric/proto/event/v1/event_pb2_grpc.html deleted file mode 100644 index cde6c86..0000000 --- a/docs/nitric/proto/event/v1/event_pb2_grpc.html +++ /dev/null @@ -1,573 +0,0 @@ - - - - - - -nitric.proto.event.v1.event_pb2_grpc API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.event.v1.event_pb2_grpc

    -
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
    -"""Client and server classes corresponding to protobuf-defined services."""
    -import grpc
    -
    -from nitric.proto.event.v1 import event_pb2 as event_dot_v1_dot_event__pb2
    -
    -
    -class EventStub(object):
    -    """Service for publishing asynchronous event
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Publish = channel.unary_unary(
    -                '/nitric.event.v1.Event/Publish',
    -                request_serializer=event_dot_v1_dot_event__pb2.EventPublishRequest.SerializeToString,
    -                response_deserializer=event_dot_v1_dot_event__pb2.EventPublishResponse.FromString,
    -                )
    -
    -
    -class EventServicer(object):
    -    """Service for publishing asynchronous event
    -    """
    -
    -    def Publish(self, request, context):
    -        """Publishes an message to a given topic
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -
    -def add_EventServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Publish': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Publish,
    -                    request_deserializer=event_dot_v1_dot_event__pb2.EventPublishRequest.FromString,
    -                    response_serializer=event_dot_v1_dot_event__pb2.EventPublishResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.event.v1.Event', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    - # This class is part of an EXPERIMENTAL API.
    -class Event(object):
    -    """Service for publishing asynchronous event
    -    """
    -
    -    @staticmethod
    -    def Publish(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.event.v1.Event/Publish',
    -            event_dot_v1_dot_event__pb2.EventPublishRequest.SerializeToString,
    -            event_dot_v1_dot_event__pb2.EventPublishResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -class TopicStub(object):
    -    """Service for management of event topics
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.List = channel.unary_unary(
    -                '/nitric.event.v1.Topic/List',
    -                request_serializer=event_dot_v1_dot_event__pb2.TopicListRequest.SerializeToString,
    -                response_deserializer=event_dot_v1_dot_event__pb2.TopicListResponse.FromString,
    -                )
    -
    -
    -class TopicServicer(object):
    -    """Service for management of event topics
    -    """
    -
    -    def List(self, request, context):
    -        """Return a list of existing topics in the provider environment
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -
    -def add_TopicServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'List': grpc.unary_unary_rpc_method_handler(
    -                    servicer.List,
    -                    request_deserializer=event_dot_v1_dot_event__pb2.TopicListRequest.FromString,
    -                    response_serializer=event_dot_v1_dot_event__pb2.TopicListResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.event.v1.Topic', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    - # This class is part of an EXPERIMENTAL API.
    -class Topic(object):
    -    """Service for management of event topics
    -    """
    -
    -    @staticmethod
    -    def List(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.event.v1.Topic/List',
    -            event_dot_v1_dot_event__pb2.TopicListRequest.SerializeToString,
    -            event_dot_v1_dot_event__pb2.TopicListResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -
    -
    -

    Functions

    -
    -
    -def add_EventServicer_to_server(servicer, server) -
    -
    -
    -
    - -Expand source code - -
    def add_EventServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Publish': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Publish,
    -                    request_deserializer=event_dot_v1_dot_event__pb2.EventPublishRequest.FromString,
    -                    response_serializer=event_dot_v1_dot_event__pb2.EventPublishResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.event.v1.Event', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    -
    -def add_TopicServicer_to_server(servicer, server) -
    -
    -
    -
    - -Expand source code - -
    def add_TopicServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'List': grpc.unary_unary_rpc_method_handler(
    -                    servicer.List,
    -                    request_deserializer=event_dot_v1_dot_event__pb2.TopicListRequest.FromString,
    -                    response_serializer=event_dot_v1_dot_event__pb2.TopicListResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.event.v1.Topic', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class Event -
    -
    -

    Service for publishing asynchronous event

    -
    - -Expand source code - -
    class Event(object):
    -    """Service for publishing asynchronous event
    -    """
    -
    -    @staticmethod
    -    def Publish(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.event.v1.Event/Publish',
    -            event_dot_v1_dot_event__pb2.EventPublishRequest.SerializeToString,
    -            event_dot_v1_dot_event__pb2.EventPublishResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -

    Static methods

    -
    -
    -def Publish(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Publish(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.event.v1.Event/Publish',
    -        event_dot_v1_dot_event__pb2.EventPublishRequest.SerializeToString,
    -        event_dot_v1_dot_event__pb2.EventPublishResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -class EventServicer -
    -
    -

    Service for publishing asynchronous event

    -
    - -Expand source code - -
    class EventServicer(object):
    -    """Service for publishing asynchronous event
    -    """
    -
    -    def Publish(self, request, context):
    -        """Publishes an message to a given topic
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -

    Methods

    -
    -
    -def Publish(self, request, context) -
    -
    -

    Publishes an message to a given topic

    -
    - -Expand source code - -
    def Publish(self, request, context):
    -    """Publishes an message to a given topic
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -
    -
    -class EventStub -(channel) -
    -
    -

    Service for publishing asynchronous event

    -

    Constructor.

    -

    Args

    -
    -
    channel
    -
    A grpc.Channel.
    -
    -
    - -Expand source code - -
    class EventStub(object):
    -    """Service for publishing asynchronous event
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Publish = channel.unary_unary(
    -                '/nitric.event.v1.Event/Publish',
    -                request_serializer=event_dot_v1_dot_event__pb2.EventPublishRequest.SerializeToString,
    -                response_deserializer=event_dot_v1_dot_event__pb2.EventPublishResponse.FromString,
    -                )
    -
    -
    -
    -class Topic -
    -
    -

    Service for management of event topics

    -
    - -Expand source code - -
    class Topic(object):
    -    """Service for management of event topics
    -    """
    -
    -    @staticmethod
    -    def List(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.event.v1.Topic/List',
    -            event_dot_v1_dot_event__pb2.TopicListRequest.SerializeToString,
    -            event_dot_v1_dot_event__pb2.TopicListResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -

    Static methods

    -
    -
    -def List(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def List(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.event.v1.Topic/List',
    -        event_dot_v1_dot_event__pb2.TopicListRequest.SerializeToString,
    -        event_dot_v1_dot_event__pb2.TopicListResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -class TopicServicer -
    -
    -

    Service for management of event topics

    -
    - -Expand source code - -
    class TopicServicer(object):
    -    """Service for management of event topics
    -    """
    -
    -    def List(self, request, context):
    -        """Return a list of existing topics in the provider environment
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -

    Methods

    -
    -
    -def List(self, request, context) -
    -
    -

    Return a list of existing topics in the provider environment

    -
    - -Expand source code - -
    def List(self, request, context):
    -    """Return a list of existing topics in the provider environment
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -
    -
    -class TopicStub -(channel) -
    -
    -

    Service for management of event topics

    -

    Constructor.

    -

    Args

    -
    -
    channel
    -
    A grpc.Channel.
    -
    -
    - -Expand source code - -
    class TopicStub(object):
    -    """Service for management of event topics
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.List = channel.unary_unary(
    -                '/nitric.event.v1.Topic/List',
    -                request_serializer=event_dot_v1_dot_event__pb2.TopicListRequest.SerializeToString,
    -                response_deserializer=event_dot_v1_dot_event__pb2.TopicListResponse.FromString,
    -                )
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/event/v1/index.html b/docs/nitric/proto/event/v1/index.html deleted file mode 100644 index 771c64c..0000000 --- a/docs/nitric/proto/event/v1/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - -nitric.proto.event.v1 API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.event.v1

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -
    -
    -

    Sub-modules

    -
    -
    nitric.proto.event.v1.event_pb2
    -
    -

    Generated protocol buffer code.

    -
    -
    nitric.proto.event.v1.event_pb2_grpc
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/faas/v1/faas_pb2_grpc.html b/docs/nitric/proto/faas/v1/faas_pb2_grpc.html deleted file mode 100644 index 05f1070..0000000 --- a/docs/nitric/proto/faas/v1/faas_pb2_grpc.html +++ /dev/null @@ -1,335 +0,0 @@ - - - - - - -nitric.proto.faas.v1.faas_pb2_grpc API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.faas.v1.faas_pb2_grpc

    -
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
    -"""Client and server classes corresponding to protobuf-defined services."""
    -import grpc
    -
    -from nitric.proto.faas.v1 import faas_pb2 as faas_dot_v1_dot_faas__pb2
    -
    -
    -class FaasStub(object):
    -    """Service for streaming communication with gRPC FaaS implementations
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.TriggerStream = channel.stream_stream(
    -                '/nitric.faas.v1.Faas/TriggerStream',
    -                request_serializer=faas_dot_v1_dot_faas__pb2.ClientMessage.SerializeToString,
    -                response_deserializer=faas_dot_v1_dot_faas__pb2.ServerMessage.FromString,
    -                )
    -
    -
    -class FaasServicer(object):
    -    """Service for streaming communication with gRPC FaaS implementations
    -    """
    -
    -    def TriggerStream(self, request_iterator, context):
    -        """Begin streaming triggers/response to/from the membrane
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -
    -def add_FaasServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'TriggerStream': grpc.stream_stream_rpc_method_handler(
    -                    servicer.TriggerStream,
    -                    request_deserializer=faas_dot_v1_dot_faas__pb2.ClientMessage.FromString,
    -                    response_serializer=faas_dot_v1_dot_faas__pb2.ServerMessage.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.faas.v1.Faas', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    - # This class is part of an EXPERIMENTAL API.
    -class Faas(object):
    -    """Service for streaming communication with gRPC FaaS implementations
    -    """
    -
    -    @staticmethod
    -    def TriggerStream(request_iterator,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.stream_stream(request_iterator, target, '/nitric.faas.v1.Faas/TriggerStream',
    -            faas_dot_v1_dot_faas__pb2.ClientMessage.SerializeToString,
    -            faas_dot_v1_dot_faas__pb2.ServerMessage.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -
    -
    -

    Functions

    -
    -
    -def add_FaasServicer_to_server(servicer, server) -
    -
    -
    -
    - -Expand source code - -
    def add_FaasServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'TriggerStream': grpc.stream_stream_rpc_method_handler(
    -                    servicer.TriggerStream,
    -                    request_deserializer=faas_dot_v1_dot_faas__pb2.ClientMessage.FromString,
    -                    response_serializer=faas_dot_v1_dot_faas__pb2.ServerMessage.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.faas.v1.Faas', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class Faas -
    -
    -

    Service for streaming communication with gRPC FaaS implementations

    -
    - -Expand source code - -
    class Faas(object):
    -    """Service for streaming communication with gRPC FaaS implementations
    -    """
    -
    -    @staticmethod
    -    def TriggerStream(request_iterator,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.stream_stream(request_iterator, target, '/nitric.faas.v1.Faas/TriggerStream',
    -            faas_dot_v1_dot_faas__pb2.ClientMessage.SerializeToString,
    -            faas_dot_v1_dot_faas__pb2.ServerMessage.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -

    Static methods

    -
    -
    -def TriggerStream(request_iterator, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def TriggerStream(request_iterator,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.stream_stream(request_iterator, target, '/nitric.faas.v1.Faas/TriggerStream',
    -        faas_dot_v1_dot_faas__pb2.ClientMessage.SerializeToString,
    -        faas_dot_v1_dot_faas__pb2.ServerMessage.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -class FaasServicer -
    -
    -

    Service for streaming communication with gRPC FaaS implementations

    -
    - -Expand source code - -
    class FaasServicer(object):
    -    """Service for streaming communication with gRPC FaaS implementations
    -    """
    -
    -    def TriggerStream(self, request_iterator, context):
    -        """Begin streaming triggers/response to/from the membrane
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -

    Methods

    -
    -
    -def TriggerStream(self, request_iterator, context) -
    -
    -

    Begin streaming triggers/response to/from the membrane

    -
    - -Expand source code - -
    def TriggerStream(self, request_iterator, context):
    -    """Begin streaming triggers/response to/from the membrane
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -
    -
    -class FaasStub -(channel) -
    -
    -

    Service for streaming communication with gRPC FaaS implementations

    -

    Constructor.

    -

    Args

    -
    -
    channel
    -
    A grpc.Channel.
    -
    -
    - -Expand source code - -
    class FaasStub(object):
    -    """Service for streaming communication with gRPC FaaS implementations
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.TriggerStream = channel.stream_stream(
    -                '/nitric.faas.v1.Faas/TriggerStream',
    -                request_serializer=faas_dot_v1_dot_faas__pb2.ClientMessage.SerializeToString,
    -                response_deserializer=faas_dot_v1_dot_faas__pb2.ServerMessage.FromString,
    -                )
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/faas/v1/index.html b/docs/nitric/proto/faas/v1/index.html deleted file mode 100644 index e8009d2..0000000 --- a/docs/nitric/proto/faas/v1/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - -nitric.proto.faas.v1 API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.faas.v1

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -
    -
    -

    Sub-modules

    -
    -
    nitric.proto.faas.v1.faas_pb2
    -
    -

    Generated protocol buffer code.

    -
    -
    nitric.proto.faas.v1.faas_pb2_grpc
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/index.html b/docs/nitric/proto/index.html index 3342a7b..185a8d4 100644 --- a/docs/nitric/proto/index.html +++ b/docs/nitric/proto/index.html @@ -43,48 +43,13 @@

    Module nitric.proto

    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -from nitric.proto.event.v1 import event_pb2 as event -from nitric.proto.event.v1 import event_pb2_grpc as event_service -from nitric.proto.storage.v1 import storage_pb2 as storage -from nitric.proto.storage.v1 import storage_pb2_grpc as storage_service -from nitric.proto.kv.v1 import kv_pb2 as key_value -from nitric.proto.kv.v1 import kv_pb2_grpc as key_value_service -from nitric.proto.queue.v1 import queue_pb2 as queue -from nitric.proto.queue.v1 import queue_pb2_grpc as queue_service - -__all__ = [ - "event", - "event_service", - "storage", - "storage_service", - "key_value", - "key_value_service", - "queue", - "queue_service", -]
    +#

    Sub-modules

    -
    nitric.proto.event
    -
    -
    -
    -
    nitric.proto.faas
    -
    -
    -
    -
    nitric.proto.kv
    -
    -
    -
    -
    nitric.proto.queue
    -
    -
    -
    -
    nitric.proto.storage
    +
    nitric.proto.nitric
    @@ -110,11 +75,7 @@

    Index

  • Sub-modules

  • diff --git a/docs/nitric/proto/kv/v1/index.html b/docs/nitric/proto/kv/v1/index.html deleted file mode 100644 index 74a569e..0000000 --- a/docs/nitric/proto/kv/v1/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - -nitric.proto.kv.v1 API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.kv.v1

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -
    -
    -

    Sub-modules

    -
    -
    nitric.proto.kv.v1.kv_pb2
    -
    -

    Generated protocol buffer code.

    -
    -
    nitric.proto.kv.v1.kv_pb2_grpc
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/kv/v1/kv_pb2_grpc.html b/docs/nitric/proto/kv/v1/kv_pb2_grpc.html deleted file mode 100644 index 65e2be8..0000000 --- a/docs/nitric/proto/kv/v1/kv_pb2_grpc.html +++ /dev/null @@ -1,563 +0,0 @@ - - - - - - -nitric.proto.kv.v1.kv_pb2_grpc API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.kv.v1.kv_pb2_grpc

    -
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
    -"""Client and server classes corresponding to protobuf-defined services."""
    -import grpc
    -
    -from nitric.proto.kv.v1 import kv_pb2 as kv_dot_v1_dot_kv__pb2
    -
    -
    -class KeyValueStub(object):
    -    """Service for storage and retrieval of simple JSON keyValue
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Get = channel.unary_unary(
    -                '/nitric.kv.v1.KeyValue/Get',
    -                request_serializer=kv_dot_v1_dot_kv__pb2.KeyValueGetRequest.SerializeToString,
    -                response_deserializer=kv_dot_v1_dot_kv__pb2.KeyValueGetResponse.FromString,
    -                )
    -        self.Put = channel.unary_unary(
    -                '/nitric.kv.v1.KeyValue/Put',
    -                request_serializer=kv_dot_v1_dot_kv__pb2.KeyValuePutRequest.SerializeToString,
    -                response_deserializer=kv_dot_v1_dot_kv__pb2.KeyValuePutResponse.FromString,
    -                )
    -        self.Delete = channel.unary_unary(
    -                '/nitric.kv.v1.KeyValue/Delete',
    -                request_serializer=kv_dot_v1_dot_kv__pb2.KeyValueDeleteRequest.SerializeToString,
    -                response_deserializer=kv_dot_v1_dot_kv__pb2.KeyValueDeleteResponse.FromString,
    -                )
    -
    -
    -class KeyValueServicer(object):
    -    """Service for storage and retrieval of simple JSON keyValue
    -    """
    -
    -    def Get(self, request, context):
    -        """Get an existing key
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Put(self, request, context):
    -        """Create a new or overwrite and existing key
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Delete(self, request, context):
    -        """Delete an existing
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -
    -def add_KeyValueServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Get': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Get,
    -                    request_deserializer=kv_dot_v1_dot_kv__pb2.KeyValueGetRequest.FromString,
    -                    response_serializer=kv_dot_v1_dot_kv__pb2.KeyValueGetResponse.SerializeToString,
    -            ),
    -            'Put': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Put,
    -                    request_deserializer=kv_dot_v1_dot_kv__pb2.KeyValuePutRequest.FromString,
    -                    response_serializer=kv_dot_v1_dot_kv__pb2.KeyValuePutResponse.SerializeToString,
    -            ),
    -            'Delete': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Delete,
    -                    request_deserializer=kv_dot_v1_dot_kv__pb2.KeyValueDeleteRequest.FromString,
    -                    response_serializer=kv_dot_v1_dot_kv__pb2.KeyValueDeleteResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.kv.v1.KeyValue', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    - # This class is part of an EXPERIMENTAL API.
    -class KeyValue(object):
    -    """Service for storage and retrieval of simple JSON keyValue
    -    """
    -
    -    @staticmethod
    -    def Get(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Get',
    -            kv_dot_v1_dot_kv__pb2.KeyValueGetRequest.SerializeToString,
    -            kv_dot_v1_dot_kv__pb2.KeyValueGetResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Put(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Put',
    -            kv_dot_v1_dot_kv__pb2.KeyValuePutRequest.SerializeToString,
    -            kv_dot_v1_dot_kv__pb2.KeyValuePutResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Delete(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Delete',
    -            kv_dot_v1_dot_kv__pb2.KeyValueDeleteRequest.SerializeToString,
    -            kv_dot_v1_dot_kv__pb2.KeyValueDeleteResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -
    -
    -

    Functions

    -
    -
    -def add_KeyValueServicer_to_server(servicer, server) -
    -
    -
    -
    - -Expand source code - -
    def add_KeyValueServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Get': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Get,
    -                    request_deserializer=kv_dot_v1_dot_kv__pb2.KeyValueGetRequest.FromString,
    -                    response_serializer=kv_dot_v1_dot_kv__pb2.KeyValueGetResponse.SerializeToString,
    -            ),
    -            'Put': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Put,
    -                    request_deserializer=kv_dot_v1_dot_kv__pb2.KeyValuePutRequest.FromString,
    -                    response_serializer=kv_dot_v1_dot_kv__pb2.KeyValuePutResponse.SerializeToString,
    -            ),
    -            'Delete': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Delete,
    -                    request_deserializer=kv_dot_v1_dot_kv__pb2.KeyValueDeleteRequest.FromString,
    -                    response_serializer=kv_dot_v1_dot_kv__pb2.KeyValueDeleteResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.kv.v1.KeyValue', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class KeyValue -
    -
    -

    Service for storage and retrieval of simple JSON keyValue

    -
    - -Expand source code - -
    class KeyValue(object):
    -    """Service for storage and retrieval of simple JSON keyValue
    -    """
    -
    -    @staticmethod
    -    def Get(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Get',
    -            kv_dot_v1_dot_kv__pb2.KeyValueGetRequest.SerializeToString,
    -            kv_dot_v1_dot_kv__pb2.KeyValueGetResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Put(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Put',
    -            kv_dot_v1_dot_kv__pb2.KeyValuePutRequest.SerializeToString,
    -            kv_dot_v1_dot_kv__pb2.KeyValuePutResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Delete(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Delete',
    -            kv_dot_v1_dot_kv__pb2.KeyValueDeleteRequest.SerializeToString,
    -            kv_dot_v1_dot_kv__pb2.KeyValueDeleteResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -

    Static methods

    -
    -
    -def Delete(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Delete(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Delete',
    -        kv_dot_v1_dot_kv__pb2.KeyValueDeleteRequest.SerializeToString,
    -        kv_dot_v1_dot_kv__pb2.KeyValueDeleteResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -def Get(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Get(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Get',
    -        kv_dot_v1_dot_kv__pb2.KeyValueGetRequest.SerializeToString,
    -        kv_dot_v1_dot_kv__pb2.KeyValueGetResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -def Put(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Put(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.kv.v1.KeyValue/Put',
    -        kv_dot_v1_dot_kv__pb2.KeyValuePutRequest.SerializeToString,
    -        kv_dot_v1_dot_kv__pb2.KeyValuePutResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -class KeyValueServicer -
    -
    -

    Service for storage and retrieval of simple JSON keyValue

    -
    - -Expand source code - -
    class KeyValueServicer(object):
    -    """Service for storage and retrieval of simple JSON keyValue
    -    """
    -
    -    def Get(self, request, context):
    -        """Get an existing key
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Put(self, request, context):
    -        """Create a new or overwrite and existing key
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Delete(self, request, context):
    -        """Delete an existing
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -

    Methods

    -
    -
    -def Delete(self, request, context) -
    -
    -

    Delete an existing

    -
    - -Expand source code - -
    def Delete(self, request, context):
    -    """Delete an existing
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -def Get(self, request, context) -
    -
    -

    Get an existing key

    -
    - -Expand source code - -
    def Get(self, request, context):
    -    """Get an existing key
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -def Put(self, request, context) -
    -
    -

    Create a new or overwrite and existing key

    -
    - -Expand source code - -
    def Put(self, request, context):
    -    """Create a new or overwrite and existing key
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -
    -
    -class KeyValueStub -(channel) -
    -
    -

    Service for storage and retrieval of simple JSON keyValue

    -

    Constructor.

    -

    Args

    -
    -
    channel
    -
    A grpc.Channel.
    -
    -
    - -Expand source code - -
    class KeyValueStub(object):
    -    """Service for storage and retrieval of simple JSON keyValue
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Get = channel.unary_unary(
    -                '/nitric.kv.v1.KeyValue/Get',
    -                request_serializer=kv_dot_v1_dot_kv__pb2.KeyValueGetRequest.SerializeToString,
    -                response_deserializer=kv_dot_v1_dot_kv__pb2.KeyValueGetResponse.FromString,
    -                )
    -        self.Put = channel.unary_unary(
    -                '/nitric.kv.v1.KeyValue/Put',
    -                request_serializer=kv_dot_v1_dot_kv__pb2.KeyValuePutRequest.SerializeToString,
    -                response_deserializer=kv_dot_v1_dot_kv__pb2.KeyValuePutResponse.FromString,
    -                )
    -        self.Delete = channel.unary_unary(
    -                '/nitric.kv.v1.KeyValue/Delete',
    -                request_serializer=kv_dot_v1_dot_kv__pb2.KeyValueDeleteRequest.SerializeToString,
    -                response_deserializer=kv_dot_v1_dot_kv__pb2.KeyValueDeleteResponse.FromString,
    -                )
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/event/index.html b/docs/nitric/proto/nitric/event/index.html similarity index 93% rename from docs/nitric/proto/event/index.html rename to docs/nitric/proto/nitric/event/index.html index 0754604..29bdace 100644 --- a/docs/nitric/proto/event/index.html +++ b/docs/nitric/proto/nitric/event/index.html @@ -4,7 +4,7 @@ -nitric.proto.event API documentation +nitric.proto.nitric.event API documentation @@ -19,7 +19,7 @@
    -

    Module nitric.proto.event

    +

    Module nitric.proto.nitric.event

    @@ -49,7 +49,7 @@

    Module nitric.proto.event

    Sub-modules

    -
    nitric.proto.event.v1
    +
    nitric.proto.nitric.event.v1
    @@ -70,12 +70,12 @@

    Index

    diff --git a/docs/nitric/proto/nitric/event/v1/index.html b/docs/nitric/proto/nitric/event/v1/index.html new file mode 100644 index 0000000..6f896a6 --- /dev/null +++ b/docs/nitric/proto/nitric/event/v1/index.html @@ -0,0 +1,661 @@ + + + + + + +nitric.proto.nitric.event.v1 API documentation + + + + + + + + + + + +
    +
    +
    +

    Module nitric.proto.nitric.event.v1

    +
    +
    +
    + +Expand source code + +
    #
    +# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    +#
    +# This file is part of Nitric Python 3 SDK.
    +# See https://github.com/nitrictech/python-sdk for further info.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +# Generated by the protocol buffer compiler.  DO NOT EDIT!
    +# sources: event/v1/event.proto
    +# plugin: python-betterproto
    +from dataclasses import dataclass
    +from typing import Dict, List
    +
    +import betterproto
    +from betterproto.grpc.grpclib_server import ServiceBase
    +import grpclib
    +
    +
    +@dataclass(eq=False, repr=False)
    +class EventPublishRequest(betterproto.Message):
    +    """Request to publish an event to a topic"""
    +
    +    # The name of the topic to publish the event to
    +    topic: str = betterproto.string_field(1)
    +    # The event to be published
    +    event: "NitricEvent" = betterproto.message_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class EventPublishResponse(betterproto.Message):
    +    """Result of publishing an event"""
    +
    +    # The id of the published message When an id was not supplied one should be
    +    # automatically generated
    +    id: str = betterproto.string_field(1)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class TopicListRequest(betterproto.Message):
    +    """Request for the Topic List method"""
    +
    +    pass
    +
    +
    +@dataclass(eq=False, repr=False)
    +class TopicListResponse(betterproto.Message):
    +    """Topic List Response"""
    +
    +    # The list of found topics
    +    topics: List["NitricTopic"] = betterproto.message_field(1)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class NitricTopic(betterproto.Message):
    +    """Represents an event topic"""
    +
    +    # The Nitric name for the topic
    +    name: str = betterproto.string_field(1)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class NitricEvent(betterproto.Message):
    +    """Nitric Event Model"""
    +
    +    # A Unique ID for the Nitric Event
    +    id: str = betterproto.string_field(1)
    +    # A content hint for the events payload
    +    payload_type: str = betterproto.string_field(2)
    +    # The payload of the event
    +    payload: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(3)
    +
    +
    +class EventStub(betterproto.ServiceStub):
    +    async def publish(self, *, topic: str = "", event: "NitricEvent" = None) -> "EventPublishResponse":
    +
    +        request = EventPublishRequest()
    +        request.topic = topic
    +        if event is not None:
    +            request.event = event
    +
    +        return await self._unary_unary("/nitric.event.v1.Event/Publish", request, EventPublishResponse)
    +
    +
    +class TopicStub(betterproto.ServiceStub):
    +    async def list(self) -> "TopicListResponse":
    +
    +        request = TopicListRequest()
    +
    +        return await self._unary_unary("/nitric.event.v1.Topic/List", request, TopicListResponse)
    +
    +
    +class EventBase(ServiceBase):
    +    async def publish(self, topic: str, event: "NitricEvent") -> "EventPublishResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_publish(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "topic": request.topic,
    +            "event": request.event,
    +        }
    +
    +        response = await self.publish(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.event.v1.Event/Publish": grpclib.const.Handler(
    +                self.__rpc_publish,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                EventPublishRequest,
    +                EventPublishResponse,
    +            ),
    +        }
    +
    +
    +class TopicBase(ServiceBase):
    +    async def list(self) -> "TopicListResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_list(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {}
    +
    +        response = await self.list(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.event.v1.Topic/List": grpclib.const.Handler(
    +                self.__rpc_list,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                TopicListRequest,
    +                TopicListResponse,
    +            ),
    +        }
    +
    +
    +import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Classes

    +
    +
    +class EventBase +
    +
    +

    Base class for async gRPC servers.

    +
    + +Expand source code + +
    class EventBase(ServiceBase):
    +    async def publish(self, topic: str, event: "NitricEvent") -> "EventPublishResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_publish(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "topic": request.topic,
    +            "event": request.event,
    +        }
    +
    +        response = await self.publish(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.event.v1.Event/Publish": grpclib.const.Handler(
    +                self.__rpc_publish,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                EventPublishRequest,
    +                EventPublishResponse,
    +            ),
    +        }
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_server.ServiceBase
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def publish(self, topic: str, event: NitricEvent) ‑> EventPublishResponse +
    +
    +
    +
    + +Expand source code + +
    async def publish(self, topic: str, event: "NitricEvent") -> "EventPublishResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +
    +
    +class EventPublishRequest +(topic: str = <object object>, event: NitricEvent = <object object>) +
    +
    +

    Request to publish an event to a topic

    +
    + +Expand source code + +
    class EventPublishRequest(betterproto.Message):
    +    """Request to publish an event to a topic"""
    +
    +    # The name of the topic to publish the event to
    +    topic: str = betterproto.string_field(1)
    +    # The event to be published
    +    event: "NitricEvent" = betterproto.message_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var eventNitricEvent
    +
    +
    +
    +
    var topic : str
    +
    +
    +
    +
    +
    +
    +class EventPublishResponse +(id: str = <object object>) +
    +
    +

    Result of publishing an event

    +
    + +Expand source code + +
    class EventPublishResponse(betterproto.Message):
    +    """Result of publishing an event"""
    +
    +    # The id of the published message When an id was not supplied one should be
    +    # automatically generated
    +    id: str = betterproto.string_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var id : str
    +
    +
    +
    +
    +
    +
    +class EventStub +(channel: Channel, *, timeout: Union[float, NoneType] = None, deadline: Union[ForwardRef('Deadline'), NoneType] = None, metadata: Union[Mapping[str, Union[str, bytes]], Collection[Tuple[str, Union[str, bytes]]], NoneType] = None) +
    +
    +

    Base class for async gRPC clients.

    +
    + +Expand source code + +
    class EventStub(betterproto.ServiceStub):
    +    async def publish(self, *, topic: str = "", event: "NitricEvent" = None) -> "EventPublishResponse":
    +
    +        request = EventPublishRequest()
    +        request.topic = topic
    +        if event is not None:
    +            request.event = event
    +
    +        return await self._unary_unary("/nitric.event.v1.Event/Publish", request, EventPublishResponse)
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_client.ServiceStub
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def publish(self, *, topic: str = '', event: NitricEvent = None) ‑> EventPublishResponse +
    +
    +
    +
    + +Expand source code + +
    async def publish(self, *, topic: str = "", event: "NitricEvent" = None) -> "EventPublishResponse":
    +
    +    request = EventPublishRequest()
    +    request.topic = topic
    +    if event is not None:
    +        request.event = event
    +
    +    return await self._unary_unary("/nitric.event.v1.Event/Publish", request, EventPublishResponse)
    +
    +
    +
    +
    +
    +class NitricEvent +(id: str = <object object>, payload_type: str = <object object>, payload: betterproto_lib_google_protobuf.Struct = <object object>) +
    +
    +

    Nitric Event Model

    +
    + +Expand source code + +
    class NitricEvent(betterproto.Message):
    +    """Nitric Event Model"""
    +
    +    # A Unique ID for the Nitric Event
    +    id: str = betterproto.string_field(1)
    +    # A content hint for the events payload
    +    payload_type: str = betterproto.string_field(2)
    +    # The payload of the event
    +    payload: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(3)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var id : str
    +
    +
    +
    +
    var payload : betterproto.lib.google.protobuf.Struct
    +
    +
    +
    +
    var payload_type : str
    +
    +
    +
    +
    +
    +
    +class NitricTopic +(name: str = <object object>) +
    +
    +

    Represents an event topic

    +
    + +Expand source code + +
    class NitricTopic(betterproto.Message):
    +    """Represents an event topic"""
    +
    +    # The Nitric name for the topic
    +    name: str = betterproto.string_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var name : str
    +
    +
    +
    +
    +
    +
    +class TopicBase +
    +
    +

    Base class for async gRPC servers.

    +
    + +Expand source code + +
    class TopicBase(ServiceBase):
    +    async def list(self) -> "TopicListResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_list(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {}
    +
    +        response = await self.list(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.event.v1.Topic/List": grpclib.const.Handler(
    +                self.__rpc_list,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                TopicListRequest,
    +                TopicListResponse,
    +            ),
    +        }
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_server.ServiceBase
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def list(self) ‑> TopicListResponse +
    +
    +
    +
    + +Expand source code + +
    async def list(self) -> "TopicListResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +
    +
    +class TopicListRequest +
    +
    +

    Request for the Topic List method

    +
    + +Expand source code + +
    class TopicListRequest(betterproto.Message):
    +    """Request for the Topic List method"""
    +
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +class TopicListResponse +(topics: List[ForwardRef('NitricTopic')] = <object object>) +
    +
    +

    Topic List Response

    +
    + +Expand source code + +
    class TopicListResponse(betterproto.Message):
    +    """Topic List Response"""
    +
    +    # The list of found topics
    +    topics: List["NitricTopic"] = betterproto.message_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var topics : List[NitricTopic]
    +
    +
    +
    +
    +
    +
    +class TopicStub +(channel: Channel, *, timeout: Union[float, NoneType] = None, deadline: Union[ForwardRef('Deadline'), NoneType] = None, metadata: Union[Mapping[str, Union[str, bytes]], Collection[Tuple[str, Union[str, bytes]]], NoneType] = None) +
    +
    +

    Base class for async gRPC clients.

    +
    + +Expand source code + +
    class TopicStub(betterproto.ServiceStub):
    +    async def list(self) -> "TopicListResponse":
    +
    +        request = TopicListRequest()
    +
    +        return await self._unary_unary("/nitric.event.v1.Topic/List", request, TopicListResponse)
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_client.ServiceStub
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def list(self) ‑> TopicListResponse +
    +
    +
    +
    + +Expand source code + +
    async def list(self) -> "TopicListResponse":
    +
    +    request = TopicListRequest()
    +
    +    return await self._unary_unary("/nitric.event.v1.Topic/List", request, TopicListResponse)
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/docs/nitric/proto/kv/index.html b/docs/nitric/proto/nitric/faas/index.html similarity index 93% rename from docs/nitric/proto/kv/index.html rename to docs/nitric/proto/nitric/faas/index.html index 1b0c2a2..47bf2b3 100644 --- a/docs/nitric/proto/kv/index.html +++ b/docs/nitric/proto/nitric/faas/index.html @@ -4,7 +4,7 @@ -nitric.proto.kv API documentation +nitric.proto.nitric.faas API documentation @@ -19,7 +19,7 @@
    -

    Module nitric.proto.kv

    +

    Module nitric.proto.nitric.faas

    @@ -49,7 +49,7 @@

    Module nitric.proto.kv

    Sub-modules

    -
    nitric.proto.kv.v1
    +
    nitric.proto.nitric.faas.v1
    @@ -70,12 +70,12 @@

    Index

    diff --git a/docs/nitric/proto/nitric/faas/v1/index.html b/docs/nitric/proto/nitric/faas/v1/index.html new file mode 100644 index 0000000..0778488 --- /dev/null +++ b/docs/nitric/proto/nitric/faas/v1/index.html @@ -0,0 +1,777 @@ + + + + + + +nitric.proto.nitric.faas.v1 API documentation + + + + + + + + + + + +
    +
    +
    +

    Module nitric.proto.nitric.faas.v1

    +
    +
    +
    + +Expand source code + +
    #
    +# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    +#
    +# This file is part of Nitric Python 3 SDK.
    +# See https://github.com/nitrictech/python-sdk for further info.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +# Generated by the protocol buffer compiler.  DO NOT EDIT!
    +# sources: faas/v1/faas.proto
    +# plugin: python-betterproto
    +from dataclasses import dataclass
    +from typing import AsyncIterable, AsyncIterator, Dict, Iterable, Union
    +
    +import betterproto
    +from betterproto.grpc.grpclib_server import ServiceBase
    +import grpclib
    +
    +
    +@dataclass(eq=False, repr=False)
    +class ClientMessage(betterproto.Message):
    +    """Messages the client is able to send to the server"""
    +
    +    # Client message ID, used to pair requests/responses
    +    id: str = betterproto.string_field(1)
    +    # Client initialisation request
    +    init_request: "InitRequest" = betterproto.message_field(2, group="content")
    +    # Client responsding with result of a trigger
    +    trigger_response: "TriggerResponse" = betterproto.message_field(3, group="content")
    +
    +
    +@dataclass(eq=False, repr=False)
    +class ServerMessage(betterproto.Message):
    +    """Messages the server is able to send to the client"""
    +
    +    # Server message ID, used to pair requests/responses
    +    id: str = betterproto.string_field(1)
    +    # Server responding with client configuration details to an InitRequest
    +    init_response: "InitResponse" = betterproto.message_field(2, group="content")
    +    # Server requesting client to process a trigger
    +    trigger_request: "TriggerRequest" = betterproto.message_field(3, group="content")
    +
    +
    +@dataclass(eq=False, repr=False)
    +class InitRequest(betterproto.Message):
    +    """Placeholder message"""
    +
    +    pass
    +
    +
    +@dataclass(eq=False, repr=False)
    +class InitResponse(betterproto.Message):
    +    """Placeholder message"""
    +
    +    pass
    +
    +
    +@dataclass(eq=False, repr=False)
    +class TriggerRequest(betterproto.Message):
    +    """The server has a trigger for the client to handle"""
    +
    +    # The data in the trigger
    +    data: bytes = betterproto.bytes_field(1)
    +    # Should we supply a mime type for the data? Or rely on context?
    +    mime_type: str = betterproto.string_field(2)
    +    http: "HttpTriggerContext" = betterproto.message_field(3, group="context")
    +    topic: "TopicTriggerContext" = betterproto.message_field(4, group="context")
    +
    +
    +@dataclass(eq=False, repr=False)
    +class HttpTriggerContext(betterproto.Message):
    +    # The request method
    +    method: str = betterproto.string_field(1)
    +    # The path of the request
    +    path: str = betterproto.string_field(2)
    +    # The request headers
    +    headers: Dict[str, str] = betterproto.map_field(3, betterproto.TYPE_STRING, betterproto.TYPE_STRING)
    +    # The query params (if parseable by the membrane)
    +    query_params: Dict[str, str] = betterproto.map_field(4, betterproto.TYPE_STRING, betterproto.TYPE_STRING)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class TopicTriggerContext(betterproto.Message):
    +    # The topic the message was published for
    +    topic: str = betterproto.string_field(1)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class TriggerResponse(betterproto.Message):
    +    """The worker has successfully processed a trigger"""
    +
    +    # The data returned in the response
    +    data: bytes = betterproto.bytes_field(1)
    +    # response to a http request
    +    http: "HttpResponseContext" = betterproto.message_field(10, group="context")
    +    # response to a topic trigger
    +    topic: "TopicResponseContext" = betterproto.message_field(11, group="context")
    +
    +
    +@dataclass(eq=False, repr=False)
    +class HttpResponseContext(betterproto.Message):
    +    """
    +    Specific HttpResponse message Note this does not have to be handled by the
    +    User at all but they will have the option of control If they choose...
    +    """
    +
    +    # The request headers...
    +    headers: Dict[str, str] = betterproto.map_field(1, betterproto.TYPE_STRING, betterproto.TYPE_STRING)
    +    # The HTTP status of the request
    +    status: int = betterproto.int32_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class TopicResponseContext(betterproto.Message):
    +    """
    +    Specific event response message We do not accept responses for events only
    +    whether or not they were successfully processed
    +    """
    +
    +    # Success status of the handled event
    +    success: bool = betterproto.bool_field(1)
    +
    +
    +class FaasStub(betterproto.ServiceStub):
    +    async def trigger_stream(
    +        self,
    +        request_iterator: Union[AsyncIterable["ClientMessage"], Iterable["ClientMessage"]],
    +    ) -> AsyncIterator["ServerMessage"]:
    +
    +        async for response in self._stream_stream(
    +            "/nitric.faas.v1.Faas/TriggerStream",
    +            request_iterator,
    +            ClientMessage,
    +            ServerMessage,
    +        ):
    +            yield response
    +
    +
    +class FaasBase(ServiceBase):
    +    async def trigger_stream(self, request_iterator: AsyncIterator["ClientMessage"]) -> AsyncIterator["ServerMessage"]:
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_trigger_stream(self, stream: grpclib.server.Stream) -> None:
    +        request_kwargs = {"request_iterator": stream.__aiter__()}
    +
    +        await self._call_rpc_handler_server_stream(
    +            self.trigger_stream,
    +            stream,
    +            request_kwargs,
    +        )
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.faas.v1.Faas/TriggerStream": grpclib.const.Handler(
    +                self.__rpc_trigger_stream,
    +                grpclib.const.Cardinality.STREAM_STREAM,
    +                ClientMessage,
    +                ServerMessage,
    +            ),
    +        }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Classes

    +
    +
    +class ClientMessage +(id: str = <object object>, init_request: InitRequest = <object object>, trigger_response: TriggerResponse = <object object>) +
    +
    +

    Messages the client is able to send to the server

    +
    + +Expand source code + +
    class ClientMessage(betterproto.Message):
    +    """Messages the client is able to send to the server"""
    +
    +    # Client message ID, used to pair requests/responses
    +    id: str = betterproto.string_field(1)
    +    # Client initialisation request
    +    init_request: "InitRequest" = betterproto.message_field(2, group="content")
    +    # Client responsding with result of a trigger
    +    trigger_response: "TriggerResponse" = betterproto.message_field(3, group="content")
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var id : str
    +
    +
    +
    +
    var init_requestInitRequest
    +
    +
    +
    +
    var trigger_responseTriggerResponse
    +
    +
    +
    +
    +
    +
    +class FaasBase +
    +
    +

    Base class for async gRPC servers.

    +
    + +Expand source code + +
    class FaasBase(ServiceBase):
    +    async def trigger_stream(self, request_iterator: AsyncIterator["ClientMessage"]) -> AsyncIterator["ServerMessage"]:
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_trigger_stream(self, stream: grpclib.server.Stream) -> None:
    +        request_kwargs = {"request_iterator": stream.__aiter__()}
    +
    +        await self._call_rpc_handler_server_stream(
    +            self.trigger_stream,
    +            stream,
    +            request_kwargs,
    +        )
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.faas.v1.Faas/TriggerStream": grpclib.const.Handler(
    +                self.__rpc_trigger_stream,
    +                grpclib.const.Cardinality.STREAM_STREAM,
    +                ClientMessage,
    +                ServerMessage,
    +            ),
    +        }
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_server.ServiceBase
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def trigger_stream(self, request_iterator: AsyncIterator[ForwardRef('ClientMessage')]) ‑> AsyncIterator[ServerMessage] +
    +
    +
    +
    + +Expand source code + +
    async def trigger_stream(self, request_iterator: AsyncIterator["ClientMessage"]) -> AsyncIterator["ServerMessage"]:
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +
    +
    +class FaasStub +(channel: Channel, *, timeout: Union[float, NoneType] = None, deadline: Union[ForwardRef('Deadline'), NoneType] = None, metadata: Union[Mapping[str, Union[str, bytes]], Collection[Tuple[str, Union[str, bytes]]], NoneType] = None) +
    +
    +

    Base class for async gRPC clients.

    +
    + +Expand source code + +
    class FaasStub(betterproto.ServiceStub):
    +    async def trigger_stream(
    +        self,
    +        request_iterator: Union[AsyncIterable["ClientMessage"], Iterable["ClientMessage"]],
    +    ) -> AsyncIterator["ServerMessage"]:
    +
    +        async for response in self._stream_stream(
    +            "/nitric.faas.v1.Faas/TriggerStream",
    +            request_iterator,
    +            ClientMessage,
    +            ServerMessage,
    +        ):
    +            yield response
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_client.ServiceStub
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def trigger_stream(self, request_iterator: Union[AsyncIterable[ForwardRef('ClientMessage')], Iterable[ForwardRef('ClientMessage')]]) ‑> AsyncIterator[ServerMessage] +
    +
    +
    +
    + +Expand source code + +
    async def trigger_stream(
    +    self,
    +    request_iterator: Union[AsyncIterable["ClientMessage"], Iterable["ClientMessage"]],
    +) -> AsyncIterator["ServerMessage"]:
    +
    +    async for response in self._stream_stream(
    +        "/nitric.faas.v1.Faas/TriggerStream",
    +        request_iterator,
    +        ClientMessage,
    +        ServerMessage,
    +    ):
    +        yield response
    +
    +
    +
    +
    +
    +class HttpResponseContext +(headers: Dict[str, str] = <object object>, status: int = <object object>) +
    +
    +

    Specific HttpResponse message Note this does not have to be handled by the +User at all but they will have the option of control If they choose…

    +
    + +Expand source code + +
    class HttpResponseContext(betterproto.Message):
    +    """
    +    Specific HttpResponse message Note this does not have to be handled by the
    +    User at all but they will have the option of control If they choose...
    +    """
    +
    +    # The request headers...
    +    headers: Dict[str, str] = betterproto.map_field(1, betterproto.TYPE_STRING, betterproto.TYPE_STRING)
    +    # The HTTP status of the request
    +    status: int = betterproto.int32_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var headers : Dict[str, str]
    +
    +
    +
    +
    var status : int
    +
    +
    +
    +
    +
    +
    +class HttpTriggerContext +(method: str = <object object>, path: str = <object object>, headers: Dict[str, str] = <object object>, query_params: Dict[str, str] = <object object>) +
    +
    +

    HttpTriggerContext(method: str = , path: str = , headers: Dict[str, str] = , query_params: Dict[str, str] = )

    +
    + +Expand source code + +
    class HttpTriggerContext(betterproto.Message):
    +    # The request method
    +    method: str = betterproto.string_field(1)
    +    # The path of the request
    +    path: str = betterproto.string_field(2)
    +    # The request headers
    +    headers: Dict[str, str] = betterproto.map_field(3, betterproto.TYPE_STRING, betterproto.TYPE_STRING)
    +    # The query params (if parseable by the membrane)
    +    query_params: Dict[str, str] = betterproto.map_field(4, betterproto.TYPE_STRING, betterproto.TYPE_STRING)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var headers : Dict[str, str]
    +
    +
    +
    +
    var method : str
    +
    +
    +
    +
    var path : str
    +
    +
    +
    +
    var query_params : Dict[str, str]
    +
    +
    +
    +
    + +
    +class InitRequest +
    +
    +

    Placeholder message

    +
    + +Expand source code + +
    class InitRequest(betterproto.Message):
    +    """Placeholder message"""
    +
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +class InitResponse +
    +
    +

    Placeholder message

    +
    + +Expand source code + +
    class InitResponse(betterproto.Message):
    +    """Placeholder message"""
    +
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +class ServerMessage +(id: str = <object object>, init_response: InitResponse = <object object>, trigger_request: TriggerRequest = <object object>) +
    +
    +

    Messages the server is able to send to the client

    +
    + +Expand source code + +
    class ServerMessage(betterproto.Message):
    +    """Messages the server is able to send to the client"""
    +
    +    # Server message ID, used to pair requests/responses
    +    id: str = betterproto.string_field(1)
    +    # Server responding with client configuration details to an InitRequest
    +    init_response: "InitResponse" = betterproto.message_field(2, group="content")
    +    # Server requesting client to process a trigger
    +    trigger_request: "TriggerRequest" = betterproto.message_field(3, group="content")
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var id : str
    +
    +
    +
    +
    var init_responseInitResponse
    +
    +
    +
    +
    var trigger_requestTriggerRequest
    +
    +
    +
    +
    +
    +
    +class TopicResponseContext +(success: bool = <object object>) +
    +
    +

    Specific event response message We do not accept responses for events only +whether or not they were successfully processed

    +
    + +Expand source code + +
    class TopicResponseContext(betterproto.Message):
    +    """
    +    Specific event response message We do not accept responses for events only
    +    whether or not they were successfully processed
    +    """
    +
    +    # Success status of the handled event
    +    success: bool = betterproto.bool_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var success : bool
    +
    +
    +
    +
    +
    +
    +class TopicTriggerContext +(topic: str = <object object>) +
    +
    +

    TopicTriggerContext(topic: str = )

    +
    + +Expand source code + +
    class TopicTriggerContext(betterproto.Message):
    +    # The topic the message was published for
    +    topic: str = betterproto.string_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var topic : str
    +
    +
    +
    +
    + +
    +class TriggerRequest +(data: bytes = <object object>, mime_type: str = <object object>, http: HttpTriggerContext = <object object>, topic: TopicTriggerContext = <object object>) +
    +
    +

    The server has a trigger for the client to handle

    +
    + +Expand source code + +
    class TriggerRequest(betterproto.Message):
    +    """The server has a trigger for the client to handle"""
    +
    +    # The data in the trigger
    +    data: bytes = betterproto.bytes_field(1)
    +    # Should we supply a mime type for the data? Or rely on context?
    +    mime_type: str = betterproto.string_field(2)
    +    http: "HttpTriggerContext" = betterproto.message_field(3, group="context")
    +    topic: "TopicTriggerContext" = betterproto.message_field(4, group="context")
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var data : bytes
    +
    +
    +
    +
    var httpHttpTriggerContext
    +
    +
    +
    +
    var mime_type : str
    +
    +
    +
    +
    var topicTopicTriggerContext
    +
    +
    +
    +
    +
    +
    +class TriggerResponse +(data: bytes = <object object>, http: HttpResponseContext = <object object>, topic: TopicResponseContext = <object object>) +
    +
    +

    The worker has successfully processed a trigger

    +
    + +Expand source code + +
    class TriggerResponse(betterproto.Message):
    +    """The worker has successfully processed a trigger"""
    +
    +    # The data returned in the response
    +    data: bytes = betterproto.bytes_field(1)
    +    # response to a http request
    +    http: "HttpResponseContext" = betterproto.message_field(10, group="context")
    +    # response to a topic trigger
    +    topic: "TopicResponseContext" = betterproto.message_field(11, group="context")
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var data : bytes
    +
    +
    +
    +
    var httpHttpResponseContext
    +
    +
    +
    +
    var topicTopicResponseContext
    +
    +
    +
    +
    +
    + + + + + + + + \ No newline at end of file diff --git a/docs/nitric/proto/nitric/index.html b/docs/nitric/proto/nitric/index.html new file mode 100644 index 0000000..6b92d37 --- /dev/null +++ b/docs/nitric/proto/nitric/index.html @@ -0,0 +1,108 @@ + + + + + + +nitric.proto.nitric API documentation + + + + + + + + + + + +
    +
    +
    +

    Module nitric.proto.nitric

    +
    +
    +
    + +Expand source code + +
    #
    +# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    +#
    +# This file is part of Nitric Python 3 SDK.
    +# See https://github.com/nitrictech/python-sdk for further info.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +
    +
    +

    Sub-modules

    +
    +
    nitric.proto.nitric.event
    +
    +
    +
    +
    nitric.proto.nitric.faas
    +
    +
    +
    +
    nitric.proto.nitric.kv
    +
    +
    +
    +
    nitric.proto.nitric.queue
    +
    +
    +
    +
    nitric.proto.nitric.storage
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/docs/nitric/proto/faas/index.html b/docs/nitric/proto/nitric/kv/index.html similarity index 93% rename from docs/nitric/proto/faas/index.html rename to docs/nitric/proto/nitric/kv/index.html index 50878ee..e5c044e 100644 --- a/docs/nitric/proto/faas/index.html +++ b/docs/nitric/proto/nitric/kv/index.html @@ -4,7 +4,7 @@ -nitric.proto.faas API documentation +nitric.proto.nitric.kv API documentation @@ -19,7 +19,7 @@
    -

    Module nitric.proto.faas

    +

    Module nitric.proto.nitric.kv

    @@ -49,7 +49,7 @@

    Module nitric.proto.faas

    Sub-modules

    -
    nitric.proto.faas.v1
    +
    nitric.proto.nitric.kv.v1
    @@ -70,12 +70,12 @@

    Index

    diff --git a/docs/nitric/proto/nitric/kv/v1/index.html b/docs/nitric/proto/nitric/kv/v1/index.html new file mode 100644 index 0000000..1cf31ba --- /dev/null +++ b/docs/nitric/proto/nitric/kv/v1/index.html @@ -0,0 +1,700 @@ + + + + + + +nitric.proto.nitric.kv.v1 API documentation + + + + + + + + + + + +
    +
    +
    +

    Module nitric.proto.nitric.kv.v1

    +
    +
    +
    + +Expand source code + +
    #
    +# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    +#
    +# This file is part of Nitric Python 3 SDK.
    +# See https://github.com/nitrictech/python-sdk for further info.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +# Generated by the protocol buffer compiler.  DO NOT EDIT!
    +# sources: kv/v1/kv.proto
    +# plugin: python-betterproto
    +from dataclasses import dataclass
    +from typing import Dict
    +
    +import betterproto
    +from betterproto.grpc.grpclib_server import ServiceBase
    +import grpclib
    +
    +
    +@dataclass(eq=False, repr=False)
    +class KeyValueGetRequest(betterproto.Message):
    +    # The collection to retrieve the keyValue from
    +    collection: str = betterproto.string_field(1)
    +    # The unique key of the keyValue to retrieve
    +    key: str = betterproto.string_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class KeyValueGetResponse(betterproto.Message):
    +    # The retrieved value
    +    value: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(1)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class KeyValuePutRequest(betterproto.Message):
    +    # The collection containing the existing keyValue to be inserted or updated.
    +    collection: str = betterproto.string_field(1)
    +    # The unique key of the keyValue to put
    +    key: str = betterproto.string_field(2)
    +    # A simple JSON object
    +    value: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(3)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class KeyValuePutResponse(betterproto.Message):
    +    pass
    +
    +
    +@dataclass(eq=False, repr=False)
    +class KeyValueDeleteRequest(betterproto.Message):
    +    # The collection containing the existing keyValue to be deleted
    +    collection: str = betterproto.string_field(1)
    +    # The unique key of the keyValue to delete
    +    key: str = betterproto.string_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class KeyValueDeleteResponse(betterproto.Message):
    +    pass
    +
    +
    +class KeyValueStub(betterproto.ServiceStub):
    +    async def get(self, *, collection: str = "", key: str = "") -> "KeyValueGetResponse":
    +
    +        request = KeyValueGetRequest()
    +        request.collection = collection
    +        request.key = key
    +
    +        return await self._unary_unary("/nitric.kv.v1.KeyValue/Get", request, KeyValueGetResponse)
    +
    +    async def put(
    +        self,
    +        *,
    +        collection: str = "",
    +        key: str = "",
    +        value: "betterproto_lib_google_protobuf.Struct" = None,
    +    ) -> "KeyValuePutResponse":
    +
    +        request = KeyValuePutRequest()
    +        request.collection = collection
    +        request.key = key
    +        if value is not None:
    +            request.value = value
    +
    +        return await self._unary_unary("/nitric.kv.v1.KeyValue/Put", request, KeyValuePutResponse)
    +
    +    async def delete(self, *, collection: str = "", key: str = "") -> "KeyValueDeleteResponse":
    +
    +        request = KeyValueDeleteRequest()
    +        request.collection = collection
    +        request.key = key
    +
    +        return await self._unary_unary("/nitric.kv.v1.KeyValue/Delete", request, KeyValueDeleteResponse)
    +
    +
    +class KeyValueBase(ServiceBase):
    +    async def get(self, collection: str, key: str) -> "KeyValueGetResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def put(
    +        self, collection: str, key: str, value: "betterproto_lib_google_protobuf.Struct"
    +    ) -> "KeyValuePutResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def delete(self, collection: str, key: str) -> "KeyValueDeleteResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_get(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "collection": request.collection,
    +            "key": request.key,
    +        }
    +
    +        response = await self.get(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_put(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "collection": request.collection,
    +            "key": request.key,
    +            "value": request.value,
    +        }
    +
    +        response = await self.put(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_delete(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "collection": request.collection,
    +            "key": request.key,
    +        }
    +
    +        response = await self.delete(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.kv.v1.KeyValue/Get": grpclib.const.Handler(
    +                self.__rpc_get,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                KeyValueGetRequest,
    +                KeyValueGetResponse,
    +            ),
    +            "/nitric.kv.v1.KeyValue/Put": grpclib.const.Handler(
    +                self.__rpc_put,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                KeyValuePutRequest,
    +                KeyValuePutResponse,
    +            ),
    +            "/nitric.kv.v1.KeyValue/Delete": grpclib.const.Handler(
    +                self.__rpc_delete,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                KeyValueDeleteRequest,
    +                KeyValueDeleteResponse,
    +            ),
    +        }
    +
    +
    +import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Classes

    +
    +
    +class KeyValueBase +
    +
    +

    Base class for async gRPC servers.

    +
    + +Expand source code + +
    class KeyValueBase(ServiceBase):
    +    async def get(self, collection: str, key: str) -> "KeyValueGetResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def put(
    +        self, collection: str, key: str, value: "betterproto_lib_google_protobuf.Struct"
    +    ) -> "KeyValuePutResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def delete(self, collection: str, key: str) -> "KeyValueDeleteResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_get(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "collection": request.collection,
    +            "key": request.key,
    +        }
    +
    +        response = await self.get(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_put(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "collection": request.collection,
    +            "key": request.key,
    +            "value": request.value,
    +        }
    +
    +        response = await self.put(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_delete(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "collection": request.collection,
    +            "key": request.key,
    +        }
    +
    +        response = await self.delete(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.kv.v1.KeyValue/Get": grpclib.const.Handler(
    +                self.__rpc_get,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                KeyValueGetRequest,
    +                KeyValueGetResponse,
    +            ),
    +            "/nitric.kv.v1.KeyValue/Put": grpclib.const.Handler(
    +                self.__rpc_put,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                KeyValuePutRequest,
    +                KeyValuePutResponse,
    +            ),
    +            "/nitric.kv.v1.KeyValue/Delete": grpclib.const.Handler(
    +                self.__rpc_delete,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                KeyValueDeleteRequest,
    +                KeyValueDeleteResponse,
    +            ),
    +        }
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_server.ServiceBase
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def delete(self, collection: str, key: str) ‑> KeyValueDeleteResponse +
    +
    +
    +
    + +Expand source code + +
    async def delete(self, collection: str, key: str) -> "KeyValueDeleteResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +async def get(self, collection: str, key: str) ‑> KeyValueGetResponse +
    +
    +
    +
    + +Expand source code + +
    async def get(self, collection: str, key: str) -> "KeyValueGetResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +async def put(self, collection: str, key: str, value: betterproto_lib_google_protobuf.Struct) ‑> KeyValuePutResponse +
    +
    +
    +
    + +Expand source code + +
    async def put(
    +    self, collection: str, key: str, value: "betterproto_lib_google_protobuf.Struct"
    +) -> "KeyValuePutResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +
    +
    +class KeyValueDeleteRequest +(collection: str = <object object>, key: str = <object object>) +
    +
    +

    KeyValueDeleteRequest(collection: str = , key: str = )

    +
    + +Expand source code + +
    class KeyValueDeleteRequest(betterproto.Message):
    +    # The collection containing the existing keyValue to be deleted
    +    collection: str = betterproto.string_field(1)
    +    # The unique key of the keyValue to delete
    +    key: str = betterproto.string_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var collection : str
    +
    +
    +
    +
    var key : str
    +
    +
    +
    +
    + +
    +class KeyValueDeleteResponse +
    +
    +

    KeyValueDeleteResponse()

    +
    + +Expand source code + +
    class KeyValueDeleteResponse(betterproto.Message):
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +class KeyValueGetRequest +(collection: str = <object object>, key: str = <object object>) +
    +
    +

    KeyValueGetRequest(collection: str = , key: str = )

    +
    + +Expand source code + +
    class KeyValueGetRequest(betterproto.Message):
    +    # The collection to retrieve the keyValue from
    +    collection: str = betterproto.string_field(1)
    +    # The unique key of the keyValue to retrieve
    +    key: str = betterproto.string_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var collection : str
    +
    +
    +
    +
    var key : str
    +
    +
    +
    +
    + +
    +class KeyValueGetResponse +(value: betterproto_lib_google_protobuf.Struct = <object object>) +
    +
    +

    KeyValueGetResponse(value: 'betterproto_lib_google_protobuf.Struct' = )

    +
    + +Expand source code + +
    class KeyValueGetResponse(betterproto.Message):
    +    # The retrieved value
    +    value: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var value : betterproto.lib.google.protobuf.Struct
    +
    +
    +
    +
    + +
    +class KeyValuePutRequest +(collection: str = <object object>, key: str = <object object>, value: betterproto_lib_google_protobuf.Struct = <object object>) +
    +
    +

    KeyValuePutRequest(collection: str = , key: str = , value: 'betterproto_lib_google_protobuf.Struct' = )

    +
    + +Expand source code + +
    class KeyValuePutRequest(betterproto.Message):
    +    # The collection containing the existing keyValue to be inserted or updated.
    +    collection: str = betterproto.string_field(1)
    +    # The unique key of the keyValue to put
    +    key: str = betterproto.string_field(2)
    +    # A simple JSON object
    +    value: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(3)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var collection : str
    +
    +
    +
    +
    var key : str
    +
    +
    +
    +
    var value : betterproto.lib.google.protobuf.Struct
    +
    +
    +
    +
    + +
    +class KeyValuePutResponse +
    +
    +

    KeyValuePutResponse()

    +
    + +Expand source code + +
    class KeyValuePutResponse(betterproto.Message):
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +class KeyValueStub +(channel: Channel, *, timeout: Union[float, NoneType] = None, deadline: Union[ForwardRef('Deadline'), NoneType] = None, metadata: Union[Mapping[str, Union[str, bytes]], Collection[Tuple[str, Union[str, bytes]]], NoneType] = None) +
    +
    +

    Base class for async gRPC clients.

    +
    + +Expand source code + +
    class KeyValueStub(betterproto.ServiceStub):
    +    async def get(self, *, collection: str = "", key: str = "") -> "KeyValueGetResponse":
    +
    +        request = KeyValueGetRequest()
    +        request.collection = collection
    +        request.key = key
    +
    +        return await self._unary_unary("/nitric.kv.v1.KeyValue/Get", request, KeyValueGetResponse)
    +
    +    async def put(
    +        self,
    +        *,
    +        collection: str = "",
    +        key: str = "",
    +        value: "betterproto_lib_google_protobuf.Struct" = None,
    +    ) -> "KeyValuePutResponse":
    +
    +        request = KeyValuePutRequest()
    +        request.collection = collection
    +        request.key = key
    +        if value is not None:
    +            request.value = value
    +
    +        return await self._unary_unary("/nitric.kv.v1.KeyValue/Put", request, KeyValuePutResponse)
    +
    +    async def delete(self, *, collection: str = "", key: str = "") -> "KeyValueDeleteResponse":
    +
    +        request = KeyValueDeleteRequest()
    +        request.collection = collection
    +        request.key = key
    +
    +        return await self._unary_unary("/nitric.kv.v1.KeyValue/Delete", request, KeyValueDeleteResponse)
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_client.ServiceStub
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def delete(self, *, collection: str = '', key: str = '') ‑> KeyValueDeleteResponse +
    +
    +
    +
    + +Expand source code + +
    async def delete(self, *, collection: str = "", key: str = "") -> "KeyValueDeleteResponse":
    +
    +    request = KeyValueDeleteRequest()
    +    request.collection = collection
    +    request.key = key
    +
    +    return await self._unary_unary("/nitric.kv.v1.KeyValue/Delete", request, KeyValueDeleteResponse)
    +
    +
    +
    +async def get(self, *, collection: str = '', key: str = '') ‑> KeyValueGetResponse +
    +
    +
    +
    + +Expand source code + +
    async def get(self, *, collection: str = "", key: str = "") -> "KeyValueGetResponse":
    +
    +    request = KeyValueGetRequest()
    +    request.collection = collection
    +    request.key = key
    +
    +    return await self._unary_unary("/nitric.kv.v1.KeyValue/Get", request, KeyValueGetResponse)
    +
    +
    +
    +async def put(self, *, collection: str = '', key: str = '', value: betterproto_lib_google_protobuf.Struct = None) ‑> KeyValuePutResponse +
    +
    +
    +
    + +Expand source code + +
    async def put(
    +    self,
    +    *,
    +    collection: str = "",
    +    key: str = "",
    +    value: "betterproto_lib_google_protobuf.Struct" = None,
    +) -> "KeyValuePutResponse":
    +
    +    request = KeyValuePutRequest()
    +    request.collection = collection
    +    request.key = key
    +    if value is not None:
    +        request.value = value
    +
    +    return await self._unary_unary("/nitric.kv.v1.KeyValue/Put", request, KeyValuePutResponse)
    +
    +
    +
    +
    + + + + + + + + \ No newline at end of file diff --git a/docs/nitric/proto/auth/index.html b/docs/nitric/proto/nitric/queue/index.html similarity index 93% rename from docs/nitric/proto/auth/index.html rename to docs/nitric/proto/nitric/queue/index.html index 2cabb07..de96adb 100644 --- a/docs/nitric/proto/auth/index.html +++ b/docs/nitric/proto/nitric/queue/index.html @@ -4,7 +4,7 @@ -nitric.proto.auth API documentation +nitric.proto.nitric.queue API documentation @@ -19,7 +19,7 @@
    -

    Module nitric.proto.auth

    +

    Module nitric.proto.nitric.queue

    @@ -49,7 +49,7 @@

    Module nitric.proto.auth

    Sub-modules

    -
    nitric.proto.auth.v1
    +
    nitric.proto.nitric.queue.v1
    @@ -70,12 +70,12 @@

    Index

    diff --git a/docs/nitric/proto/nitric/queue/v1/index.html b/docs/nitric/proto/nitric/queue/v1/index.html new file mode 100644 index 0000000..00f1003 --- /dev/null +++ b/docs/nitric/proto/nitric/queue/v1/index.html @@ -0,0 +1,992 @@ + + + + + + +nitric.proto.nitric.queue.v1 API documentation + + + + + + + + + + + +
    +
    +
    +

    Module nitric.proto.nitric.queue.v1

    +
    +
    +
    + +Expand source code + +
    #
    +# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    +#
    +# This file is part of Nitric Python 3 SDK.
    +# See https://github.com/nitrictech/python-sdk for further info.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +# Generated by the protocol buffer compiler.  DO NOT EDIT!
    +# sources: queue/v1/queue.proto
    +# plugin: python-betterproto
    +from dataclasses import dataclass
    +from typing import Dict, List, Optional
    +
    +import betterproto
    +from betterproto.grpc.grpclib_server import ServiceBase
    +import grpclib
    +
    +
    +@dataclass(eq=False, repr=False)
    +class QueueSendRequest(betterproto.Message):
    +    """Request to push a single event to a queue"""
    +
    +    # The Nitric name for the queue this will automatically be resolved to the
    +    # provider specific queue identifier.
    +    queue: str = betterproto.string_field(1)
    +    # The task to push to the queue
    +    task: "NitricTask" = betterproto.message_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class QueueSendResponse(betterproto.Message):
    +    """Result of pushing a single task to a queue"""
    +
    +    pass
    +
    +
    +@dataclass(eq=False, repr=False)
    +class QueueSendBatchRequest(betterproto.Message):
    +    # The Nitric name for the queue this will automatically be resolved to the
    +    # provider specific queue identifier.
    +    queue: str = betterproto.string_field(1)
    +    # Array of tasks to push to the queue
    +    tasks: List["NitricTask"] = betterproto.message_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class QueueSendBatchResponse(betterproto.Message):
    +    """Response for sending a collection of tasks"""
    +
    +    # A list of tasks that failed to be queued
    +    failed_tasks: List["FailedTask"] = betterproto.message_field(1)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class QueueReceiveRequest(betterproto.Message):
    +    # The nitric name for the queue this will automatically be resolved to the
    +    # provider specific queue identifier.
    +    queue: str = betterproto.string_field(1)
    +    # The max number of items to pop off the queue, may be capped by provider
    +    # specific limitations
    +    depth: int = betterproto.int32_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class QueueReceiveResponse(betterproto.Message):
    +    # Array of tasks popped off the queue
    +    tasks: List["NitricTask"] = betterproto.message_field(1)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class QueueCompleteRequest(betterproto.Message):
    +    # The nitric name for the queue  this will automatically be resolved to the
    +    # provider specific queue identifier.
    +    queue: str = betterproto.string_field(1)
    +    # Lease id of the task to be completed
    +    lease_id: str = betterproto.string_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class QueueCompleteResponse(betterproto.Message):
    +    pass
    +
    +
    +@dataclass(eq=False, repr=False)
    +class FailedTask(betterproto.Message):
    +    # The task that failed to be pushed
    +    task: "NitricTask" = betterproto.message_field(1)
    +    # A message describing the failure
    +    message: str = betterproto.string_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class NitricTask(betterproto.Message):
    +    """A task to be sent or received from a queue."""
    +
    +    # A unique id for the task
    +    id: str = betterproto.string_field(1)
    +    # The lease id unique to the pop request, this must be used to complete,
    +    # extend the lease or release the task.
    +    lease_id: str = betterproto.string_field(2)
    +    # A content hint for the tasks payload
    +    payload_type: str = betterproto.string_field(3)
    +    # The payload of the task
    +    payload: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(4)
    +
    +
    +class QueueStub(betterproto.ServiceStub):
    +    async def send(self, *, queue: str = "", task: "NitricTask" = None) -> "QueueSendResponse":
    +
    +        request = QueueSendRequest()
    +        request.queue = queue
    +        if task is not None:
    +            request.task = task
    +
    +        return await self._unary_unary("/nitric.queue.v1.Queue/Send", request, QueueSendResponse)
    +
    +    async def send_batch(
    +        self, *, queue: str = "", tasks: Optional[List["NitricTask"]] = None
    +    ) -> "QueueSendBatchResponse":
    +        tasks = tasks or []
    +
    +        request = QueueSendBatchRequest()
    +        request.queue = queue
    +        if tasks is not None:
    +            request.tasks = tasks
    +
    +        return await self._unary_unary("/nitric.queue.v1.Queue/SendBatch", request, QueueSendBatchResponse)
    +
    +    async def receive(self, *, queue: str = "", depth: int = 0) -> "QueueReceiveResponse":
    +
    +        request = QueueReceiveRequest()
    +        request.queue = queue
    +        request.depth = depth
    +
    +        return await self._unary_unary("/nitric.queue.v1.Queue/Receive", request, QueueReceiveResponse)
    +
    +    async def complete(self, *, queue: str = "", lease_id: str = "") -> "QueueCompleteResponse":
    +
    +        request = QueueCompleteRequest()
    +        request.queue = queue
    +        request.lease_id = lease_id
    +
    +        return await self._unary_unary("/nitric.queue.v1.Queue/Complete", request, QueueCompleteResponse)
    +
    +
    +class QueueBase(ServiceBase):
    +    async def send(self, queue: str, task: "NitricTask") -> "QueueSendResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def send_batch(self, queue: str, tasks: Optional[List["NitricTask"]]) -> "QueueSendBatchResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def receive(self, queue: str, depth: int) -> "QueueReceiveResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def complete(self, queue: str, lease_id: str) -> "QueueCompleteResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_send(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "queue": request.queue,
    +            "task": request.task,
    +        }
    +
    +        response = await self.send(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_send_batch(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "queue": request.queue,
    +            "tasks": request.tasks,
    +        }
    +
    +        response = await self.send_batch(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_receive(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "queue": request.queue,
    +            "depth": request.depth,
    +        }
    +
    +        response = await self.receive(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_complete(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "queue": request.queue,
    +            "lease_id": request.lease_id,
    +        }
    +
    +        response = await self.complete(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.queue.v1.Queue/Send": grpclib.const.Handler(
    +                self.__rpc_send,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                QueueSendRequest,
    +                QueueSendResponse,
    +            ),
    +            "/nitric.queue.v1.Queue/SendBatch": grpclib.const.Handler(
    +                self.__rpc_send_batch,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                QueueSendBatchRequest,
    +                QueueSendBatchResponse,
    +            ),
    +            "/nitric.queue.v1.Queue/Receive": grpclib.const.Handler(
    +                self.__rpc_receive,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                QueueReceiveRequest,
    +                QueueReceiveResponse,
    +            ),
    +            "/nitric.queue.v1.Queue/Complete": grpclib.const.Handler(
    +                self.__rpc_complete,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                QueueCompleteRequest,
    +                QueueCompleteResponse,
    +            ),
    +        }
    +
    +
    +import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Classes

    +
    +
    +class FailedTask +(task: NitricTask = <object object>, message: str = <object object>) +
    +
    +

    FailedTask(task: 'NitricTask' = , message: str = )

    +
    + +Expand source code + +
    class FailedTask(betterproto.Message):
    +    # The task that failed to be pushed
    +    task: "NitricTask" = betterproto.message_field(1)
    +    # A message describing the failure
    +    message: str = betterproto.string_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var message : str
    +
    +
    +
    +
    var taskNitricTask
    +
    +
    +
    +
    + +
    +class NitricTask +(id: str = <object object>, lease_id: str = <object object>, payload_type: str = <object object>, payload: betterproto_lib_google_protobuf.Struct = <object object>) +
    +
    +

    A task to be sent or received from a queue.

    +
    + +Expand source code + +
    class NitricTask(betterproto.Message):
    +    """A task to be sent or received from a queue."""
    +
    +    # A unique id for the task
    +    id: str = betterproto.string_field(1)
    +    # The lease id unique to the pop request, this must be used to complete,
    +    # extend the lease or release the task.
    +    lease_id: str = betterproto.string_field(2)
    +    # A content hint for the tasks payload
    +    payload_type: str = betterproto.string_field(3)
    +    # The payload of the task
    +    payload: "betterproto_lib_google_protobuf.Struct" = betterproto.message_field(4)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var id : str
    +
    +
    +
    +
    var lease_id : str
    +
    +
    +
    +
    var payload : betterproto.lib.google.protobuf.Struct
    +
    +
    +
    +
    var payload_type : str
    +
    +
    +
    +
    +
    +
    +class QueueBase +
    +
    +

    Base class for async gRPC servers.

    +
    + +Expand source code + +
    class QueueBase(ServiceBase):
    +    async def send(self, queue: str, task: "NitricTask") -> "QueueSendResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def send_batch(self, queue: str, tasks: Optional[List["NitricTask"]]) -> "QueueSendBatchResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def receive(self, queue: str, depth: int) -> "QueueReceiveResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def complete(self, queue: str, lease_id: str) -> "QueueCompleteResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_send(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "queue": request.queue,
    +            "task": request.task,
    +        }
    +
    +        response = await self.send(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_send_batch(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "queue": request.queue,
    +            "tasks": request.tasks,
    +        }
    +
    +        response = await self.send_batch(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_receive(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "queue": request.queue,
    +            "depth": request.depth,
    +        }
    +
    +        response = await self.receive(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_complete(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "queue": request.queue,
    +            "lease_id": request.lease_id,
    +        }
    +
    +        response = await self.complete(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.queue.v1.Queue/Send": grpclib.const.Handler(
    +                self.__rpc_send,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                QueueSendRequest,
    +                QueueSendResponse,
    +            ),
    +            "/nitric.queue.v1.Queue/SendBatch": grpclib.const.Handler(
    +                self.__rpc_send_batch,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                QueueSendBatchRequest,
    +                QueueSendBatchResponse,
    +            ),
    +            "/nitric.queue.v1.Queue/Receive": grpclib.const.Handler(
    +                self.__rpc_receive,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                QueueReceiveRequest,
    +                QueueReceiveResponse,
    +            ),
    +            "/nitric.queue.v1.Queue/Complete": grpclib.const.Handler(
    +                self.__rpc_complete,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                QueueCompleteRequest,
    +                QueueCompleteResponse,
    +            ),
    +        }
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_server.ServiceBase
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def complete(self, queue: str, lease_id: str) ‑> QueueCompleteResponse +
    +
    +
    +
    + +Expand source code + +
    async def complete(self, queue: str, lease_id: str) -> "QueueCompleteResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +async def receive(self, queue: str, depth: int) ‑> QueueReceiveResponse +
    +
    +
    +
    + +Expand source code + +
    async def receive(self, queue: str, depth: int) -> "QueueReceiveResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +async def send(self, queue: str, task: NitricTask) ‑> QueueSendResponse +
    +
    +
    +
    + +Expand source code + +
    async def send(self, queue: str, task: "NitricTask") -> "QueueSendResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +async def send_batch(self, queue: str, tasks: Union[List[ForwardRef('NitricTask')], NoneType]) ‑> QueueSendBatchResponse +
    +
    +
    +
    + +Expand source code + +
    async def send_batch(self, queue: str, tasks: Optional[List["NitricTask"]]) -> "QueueSendBatchResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +
    +
    +class QueueCompleteRequest +(queue: str = <object object>, lease_id: str = <object object>) +
    +
    +

    QueueCompleteRequest(queue: str = , lease_id: str = )

    +
    + +Expand source code + +
    class QueueCompleteRequest(betterproto.Message):
    +    # The nitric name for the queue  this will automatically be resolved to the
    +    # provider specific queue identifier.
    +    queue: str = betterproto.string_field(1)
    +    # Lease id of the task to be completed
    +    lease_id: str = betterproto.string_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var lease_id : str
    +
    +
    +
    +
    var queue : str
    +
    +
    +
    +
    + +
    +class QueueCompleteResponse +
    +
    +

    QueueCompleteResponse()

    +
    + +Expand source code + +
    class QueueCompleteResponse(betterproto.Message):
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +class QueueReceiveRequest +(queue: str = <object object>, depth: int = <object object>) +
    +
    +

    QueueReceiveRequest(queue: str = , depth: int = )

    +
    + +Expand source code + +
    class QueueReceiveRequest(betterproto.Message):
    +    # The nitric name for the queue this will automatically be resolved to the
    +    # provider specific queue identifier.
    +    queue: str = betterproto.string_field(1)
    +    # The max number of items to pop off the queue, may be capped by provider
    +    # specific limitations
    +    depth: int = betterproto.int32_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var depth : int
    +
    +
    +
    +
    var queue : str
    +
    +
    +
    +
    + +
    +class QueueReceiveResponse +(tasks: List[ForwardRef('NitricTask')] = <object object>) +
    +
    +

    QueueReceiveResponse(tasks: List[ForwardRef('NitricTask')] = )

    +
    + +Expand source code + +
    class QueueReceiveResponse(betterproto.Message):
    +    # Array of tasks popped off the queue
    +    tasks: List["NitricTask"] = betterproto.message_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var tasks : List[NitricTask]
    +
    +
    +
    +
    + +
    +class QueueSendBatchRequest +(queue: str = <object object>, tasks: List[ForwardRef('NitricTask')] = <object object>) +
    +
    +

    QueueSendBatchRequest(queue: str = , tasks: List[ForwardRef('NitricTask')] = )

    +
    + +Expand source code + +
    class QueueSendBatchRequest(betterproto.Message):
    +    # The Nitric name for the queue this will automatically be resolved to the
    +    # provider specific queue identifier.
    +    queue: str = betterproto.string_field(1)
    +    # Array of tasks to push to the queue
    +    tasks: List["NitricTask"] = betterproto.message_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var queue : str
    +
    +
    +
    +
    var tasks : List[NitricTask]
    +
    +
    +
    +
    + +
    +class QueueSendBatchResponse +(failed_tasks: List[ForwardRef('FailedTask')] = <object object>) +
    +
    +

    Response for sending a collection of tasks

    +
    + +Expand source code + +
    class QueueSendBatchResponse(betterproto.Message):
    +    """Response for sending a collection of tasks"""
    +
    +    # A list of tasks that failed to be queued
    +    failed_tasks: List["FailedTask"] = betterproto.message_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var failed_tasks : List[FailedTask]
    +
    +
    +
    +
    +
    +
    +class QueueSendRequest +(queue: str = <object object>, task: NitricTask = <object object>) +
    +
    +

    Request to push a single event to a queue

    +
    + +Expand source code + +
    class QueueSendRequest(betterproto.Message):
    +    """Request to push a single event to a queue"""
    +
    +    # The Nitric name for the queue this will automatically be resolved to the
    +    # provider specific queue identifier.
    +    queue: str = betterproto.string_field(1)
    +    # The task to push to the queue
    +    task: "NitricTask" = betterproto.message_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var queue : str
    +
    +
    +
    +
    var taskNitricTask
    +
    +
    +
    +
    +
    +
    +class QueueSendResponse +
    +
    +

    Result of pushing a single task to a queue

    +
    + +Expand source code + +
    class QueueSendResponse(betterproto.Message):
    +    """Result of pushing a single task to a queue"""
    +
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +class QueueStub +(channel: Channel, *, timeout: Union[float, NoneType] = None, deadline: Union[ForwardRef('Deadline'), NoneType] = None, metadata: Union[Mapping[str, Union[str, bytes]], Collection[Tuple[str, Union[str, bytes]]], NoneType] = None) +
    +
    +

    Base class for async gRPC clients.

    +
    + +Expand source code + +
    class QueueStub(betterproto.ServiceStub):
    +    async def send(self, *, queue: str = "", task: "NitricTask" = None) -> "QueueSendResponse":
    +
    +        request = QueueSendRequest()
    +        request.queue = queue
    +        if task is not None:
    +            request.task = task
    +
    +        return await self._unary_unary("/nitric.queue.v1.Queue/Send", request, QueueSendResponse)
    +
    +    async def send_batch(
    +        self, *, queue: str = "", tasks: Optional[List["NitricTask"]] = None
    +    ) -> "QueueSendBatchResponse":
    +        tasks = tasks or []
    +
    +        request = QueueSendBatchRequest()
    +        request.queue = queue
    +        if tasks is not None:
    +            request.tasks = tasks
    +
    +        return await self._unary_unary("/nitric.queue.v1.Queue/SendBatch", request, QueueSendBatchResponse)
    +
    +    async def receive(self, *, queue: str = "", depth: int = 0) -> "QueueReceiveResponse":
    +
    +        request = QueueReceiveRequest()
    +        request.queue = queue
    +        request.depth = depth
    +
    +        return await self._unary_unary("/nitric.queue.v1.Queue/Receive", request, QueueReceiveResponse)
    +
    +    async def complete(self, *, queue: str = "", lease_id: str = "") -> "QueueCompleteResponse":
    +
    +        request = QueueCompleteRequest()
    +        request.queue = queue
    +        request.lease_id = lease_id
    +
    +        return await self._unary_unary("/nitric.queue.v1.Queue/Complete", request, QueueCompleteResponse)
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_client.ServiceStub
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def complete(self, *, queue: str = '', lease_id: str = '') ‑> QueueCompleteResponse +
    +
    +
    +
    + +Expand source code + +
    async def complete(self, *, queue: str = "", lease_id: str = "") -> "QueueCompleteResponse":
    +
    +    request = QueueCompleteRequest()
    +    request.queue = queue
    +    request.lease_id = lease_id
    +
    +    return await self._unary_unary("/nitric.queue.v1.Queue/Complete", request, QueueCompleteResponse)
    +
    +
    +
    +async def receive(self, *, queue: str = '', depth: int = 0) ‑> QueueReceiveResponse +
    +
    +
    +
    + +Expand source code + +
    async def receive(self, *, queue: str = "", depth: int = 0) -> "QueueReceiveResponse":
    +
    +    request = QueueReceiveRequest()
    +    request.queue = queue
    +    request.depth = depth
    +
    +    return await self._unary_unary("/nitric.queue.v1.Queue/Receive", request, QueueReceiveResponse)
    +
    +
    +
    +async def send(self, *, queue: str = '', task: NitricTask = None) ‑> QueueSendResponse +
    +
    +
    +
    + +Expand source code + +
    async def send(self, *, queue: str = "", task: "NitricTask" = None) -> "QueueSendResponse":
    +
    +    request = QueueSendRequest()
    +    request.queue = queue
    +    if task is not None:
    +        request.task = task
    +
    +    return await self._unary_unary("/nitric.queue.v1.Queue/Send", request, QueueSendResponse)
    +
    +
    +
    +async def send_batch(self, *, queue: str = '', tasks: Union[List[ForwardRef('NitricTask')], NoneType] = None) ‑> QueueSendBatchResponse +
    +
    +
    +
    + +Expand source code + +
    async def send_batch(
    +    self, *, queue: str = "", tasks: Optional[List["NitricTask"]] = None
    +) -> "QueueSendBatchResponse":
    +    tasks = tasks or []
    +
    +    request = QueueSendBatchRequest()
    +    request.queue = queue
    +    if tasks is not None:
    +        request.tasks = tasks
    +
    +    return await self._unary_unary("/nitric.queue.v1.Queue/SendBatch", request, QueueSendBatchResponse)
    +
    +
    +
    +
    + + + + + + + + \ No newline at end of file diff --git a/docs/nitric/proto/nitric/storage/index.html b/docs/nitric/proto/nitric/storage/index.html new file mode 100644 index 0000000..d936a53 --- /dev/null +++ b/docs/nitric/proto/nitric/storage/index.html @@ -0,0 +1,88 @@ + + + + + + +nitric.proto.nitric.storage API documentation + + + + + + + + + + + +
    +
    +
    +

    Module nitric.proto.nitric.storage

    +
    +
    +
    + +Expand source code + +
    #
    +# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    +#
    +# This file is part of Nitric Python 3 SDK.
    +# See https://github.com/nitrictech/python-sdk for further info.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +
    +
    +

    Sub-modules

    +
    +
    nitric.proto.nitric.storage.v1
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/docs/nitric/proto/nitric/storage/v1/index.html b/docs/nitric/proto/nitric/storage/v1/index.html new file mode 100644 index 0000000..c5c6abd --- /dev/null +++ b/docs/nitric/proto/nitric/storage/v1/index.html @@ -0,0 +1,698 @@ + + + + + + +nitric.proto.nitric.storage.v1 API documentation + + + + + + + + + + + +
    +
    +
    +

    Module nitric.proto.nitric.storage.v1

    +
    +
    +
    + +Expand source code + +
    #
    +# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    +#
    +# This file is part of Nitric Python 3 SDK.
    +# See https://github.com/nitrictech/python-sdk for further info.
    +#
    +# Licensed under the Apache License, Version 2.0 (the "License");
    +# you may not use this file except in compliance with the License.
    +# You may obtain a copy of the License at
    +#
    +#     http://www.apache.org/licenses/LICENSE-2.0
    +#
    +# Unless required by applicable law or agreed to in writing, software
    +# distributed under the License is distributed on an "AS IS" BASIS,
    +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    +# See the License for the specific language governing permissions and
    +# limitations under the License.
    +#
    +
    +# Generated by the protocol buffer compiler.  DO NOT EDIT!
    +# sources: storage/v1/storage.proto
    +# plugin: python-betterproto
    +from dataclasses import dataclass
    +from typing import Dict
    +
    +import betterproto
    +from betterproto.grpc.grpclib_server import ServiceBase
    +import grpclib
    +
    +
    +@dataclass(eq=False, repr=False)
    +class StorageWriteRequest(betterproto.Message):
    +    """Request to put (create/update) a storage item"""
    +
    +    # Nitric name of the bucket to store in  this will be automatically resolved
    +    # to the provider specific bucket identifier.
    +    bucket_name: str = betterproto.string_field(1)
    +    # Key to store the item under
    +    key: str = betterproto.string_field(2)
    +    # bytes array to store
    +    body: bytes = betterproto.bytes_field(3)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class StorageWriteResponse(betterproto.Message):
    +    """Result of putting a storage item"""
    +
    +    pass
    +
    +
    +@dataclass(eq=False, repr=False)
    +class StorageReadRequest(betterproto.Message):
    +    """Request to retrieve a storage item"""
    +
    +    # Nitric name of the bucket to retrieve from  this will be automatically
    +    # resolved to the provider specific bucket identifier.
    +    bucket_name: str = betterproto.string_field(1)
    +    # Key of item to retrieve
    +    key: str = betterproto.string_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class StorageReadResponse(betterproto.Message):
    +    """Returned storage item"""
    +
    +    # The body bytes of the retrieved storage item
    +    body: bytes = betterproto.bytes_field(1)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class StorageDeleteRequest(betterproto.Message):
    +    """Request to delete a storage item"""
    +
    +    # Name of the bucket to delete from
    +    bucket_name: str = betterproto.string_field(1)
    +    # Key of item to delete
    +    key: str = betterproto.string_field(2)
    +
    +
    +@dataclass(eq=False, repr=False)
    +class StorageDeleteResponse(betterproto.Message):
    +    """Result of deleting a storage item"""
    +
    +    pass
    +
    +
    +class StorageStub(betterproto.ServiceStub):
    +    async def read(self, *, bucket_name: str = "", key: str = "") -> "StorageReadResponse":
    +
    +        request = StorageReadRequest()
    +        request.bucket_name = bucket_name
    +        request.key = key
    +
    +        return await self._unary_unary("/nitric.storage.v1.Storage/Read", request, StorageReadResponse)
    +
    +    async def write(self, *, bucket_name: str = "", key: str = "", body: bytes = b"") -> "StorageWriteResponse":
    +
    +        request = StorageWriteRequest()
    +        request.bucket_name = bucket_name
    +        request.key = key
    +        request.body = body
    +
    +        return await self._unary_unary("/nitric.storage.v1.Storage/Write", request, StorageWriteResponse)
    +
    +    async def delete(self, *, bucket_name: str = "", key: str = "") -> "StorageDeleteResponse":
    +
    +        request = StorageDeleteRequest()
    +        request.bucket_name = bucket_name
    +        request.key = key
    +
    +        return await self._unary_unary("/nitric.storage.v1.Storage/Delete", request, StorageDeleteResponse)
    +
    +
    +class StorageBase(ServiceBase):
    +    async def read(self, bucket_name: str, key: str) -> "StorageReadResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def write(self, bucket_name: str, key: str, body: bytes) -> "StorageWriteResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def delete(self, bucket_name: str, key: str) -> "StorageDeleteResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_read(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "bucket_name": request.bucket_name,
    +            "key": request.key,
    +        }
    +
    +        response = await self.read(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_write(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "bucket_name": request.bucket_name,
    +            "key": request.key,
    +            "body": request.body,
    +        }
    +
    +        response = await self.write(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_delete(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "bucket_name": request.bucket_name,
    +            "key": request.key,
    +        }
    +
    +        response = await self.delete(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.storage.v1.Storage/Read": grpclib.const.Handler(
    +                self.__rpc_read,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                StorageReadRequest,
    +                StorageReadResponse,
    +            ),
    +            "/nitric.storage.v1.Storage/Write": grpclib.const.Handler(
    +                self.__rpc_write,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                StorageWriteRequest,
    +                StorageWriteResponse,
    +            ),
    +            "/nitric.storage.v1.Storage/Delete": grpclib.const.Handler(
    +                self.__rpc_delete,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                StorageDeleteRequest,
    +                StorageDeleteResponse,
    +            ),
    +        }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Classes

    +
    +
    +class StorageBase +
    +
    +

    Base class for async gRPC servers.

    +
    + +Expand source code + +
    class StorageBase(ServiceBase):
    +    async def read(self, bucket_name: str, key: str) -> "StorageReadResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def write(self, bucket_name: str, key: str, body: bytes) -> "StorageWriteResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def delete(self, bucket_name: str, key: str) -> "StorageDeleteResponse":
    +        raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +    async def __rpc_read(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "bucket_name": request.bucket_name,
    +            "key": request.key,
    +        }
    +
    +        response = await self.read(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_write(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "bucket_name": request.bucket_name,
    +            "key": request.key,
    +            "body": request.body,
    +        }
    +
    +        response = await self.write(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    async def __rpc_delete(self, stream: grpclib.server.Stream) -> None:
    +        request = await stream.recv_message()
    +
    +        request_kwargs = {
    +            "bucket_name": request.bucket_name,
    +            "key": request.key,
    +        }
    +
    +        response = await self.delete(**request_kwargs)
    +        await stream.send_message(response)
    +
    +    def __mapping__(self) -> Dict[str, grpclib.const.Handler]:
    +        return {
    +            "/nitric.storage.v1.Storage/Read": grpclib.const.Handler(
    +                self.__rpc_read,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                StorageReadRequest,
    +                StorageReadResponse,
    +            ),
    +            "/nitric.storage.v1.Storage/Write": grpclib.const.Handler(
    +                self.__rpc_write,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                StorageWriteRequest,
    +                StorageWriteResponse,
    +            ),
    +            "/nitric.storage.v1.Storage/Delete": grpclib.const.Handler(
    +                self.__rpc_delete,
    +                grpclib.const.Cardinality.UNARY_UNARY,
    +                StorageDeleteRequest,
    +                StorageDeleteResponse,
    +            ),
    +        }
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_server.ServiceBase
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def delete(self, bucket_name: str, key: str) ‑> StorageDeleteResponse +
    +
    +
    +
    + +Expand source code + +
    async def delete(self, bucket_name: str, key: str) -> "StorageDeleteResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +async def read(self, bucket_name: str, key: str) ‑> StorageReadResponse +
    +
    +
    +
    + +Expand source code + +
    async def read(self, bucket_name: str, key: str) -> "StorageReadResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +async def write(self, bucket_name: str, key: str, body: bytes) ‑> StorageWriteResponse +
    +
    +
    +
    + +Expand source code + +
    async def write(self, bucket_name: str, key: str, body: bytes) -> "StorageWriteResponse":
    +    raise grpclib.GRPCError(grpclib.const.Status.UNIMPLEMENTED)
    +
    +
    +
    +
    +
    +class StorageDeleteRequest +(bucket_name: str = <object object>, key: str = <object object>) +
    +
    +

    Request to delete a storage item

    +
    + +Expand source code + +
    class StorageDeleteRequest(betterproto.Message):
    +    """Request to delete a storage item"""
    +
    +    # Name of the bucket to delete from
    +    bucket_name: str = betterproto.string_field(1)
    +    # Key of item to delete
    +    key: str = betterproto.string_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var bucket_name : str
    +
    +
    +
    +
    var key : str
    +
    +
    +
    +
    +
    +
    +class StorageDeleteResponse +
    +
    +

    Result of deleting a storage item

    +
    + +Expand source code + +
    class StorageDeleteResponse(betterproto.Message):
    +    """Result of deleting a storage item"""
    +
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +class StorageReadRequest +(bucket_name: str = <object object>, key: str = <object object>) +
    +
    +

    Request to retrieve a storage item

    +
    + +Expand source code + +
    class StorageReadRequest(betterproto.Message):
    +    """Request to retrieve a storage item"""
    +
    +    # Nitric name of the bucket to retrieve from  this will be automatically
    +    # resolved to the provider specific bucket identifier.
    +    bucket_name: str = betterproto.string_field(1)
    +    # Key of item to retrieve
    +    key: str = betterproto.string_field(2)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var bucket_name : str
    +
    +
    +
    +
    var key : str
    +
    +
    +
    +
    +
    +
    +class StorageReadResponse +(body: bytes = <object object>) +
    +
    +

    Returned storage item

    +
    + +Expand source code + +
    class StorageReadResponse(betterproto.Message):
    +    """Returned storage item"""
    +
    +    # The body bytes of the retrieved storage item
    +    body: bytes = betterproto.bytes_field(1)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var body : bytes
    +
    +
    +
    +
    +
    +
    +class StorageStub +(channel: Channel, *, timeout: Union[float, NoneType] = None, deadline: Union[ForwardRef('Deadline'), NoneType] = None, metadata: Union[Mapping[str, Union[str, bytes]], Collection[Tuple[str, Union[str, bytes]]], NoneType] = None) +
    +
    +

    Base class for async gRPC clients.

    +
    + +Expand source code + +
    class StorageStub(betterproto.ServiceStub):
    +    async def read(self, *, bucket_name: str = "", key: str = "") -> "StorageReadResponse":
    +
    +        request = StorageReadRequest()
    +        request.bucket_name = bucket_name
    +        request.key = key
    +
    +        return await self._unary_unary("/nitric.storage.v1.Storage/Read", request, StorageReadResponse)
    +
    +    async def write(self, *, bucket_name: str = "", key: str = "", body: bytes = b"") -> "StorageWriteResponse":
    +
    +        request = StorageWriteRequest()
    +        request.bucket_name = bucket_name
    +        request.key = key
    +        request.body = body
    +
    +        return await self._unary_unary("/nitric.storage.v1.Storage/Write", request, StorageWriteResponse)
    +
    +    async def delete(self, *, bucket_name: str = "", key: str = "") -> "StorageDeleteResponse":
    +
    +        request = StorageDeleteRequest()
    +        request.bucket_name = bucket_name
    +        request.key = key
    +
    +        return await self._unary_unary("/nitric.storage.v1.Storage/Delete", request, StorageDeleteResponse)
    +
    +

    Ancestors

    +
      +
    • betterproto.grpc.grpclib_client.ServiceStub
    • +
    • abc.ABC
    • +
    +

    Methods

    +
    +
    +async def delete(self, *, bucket_name: str = '', key: str = '') ‑> StorageDeleteResponse +
    +
    +
    +
    + +Expand source code + +
    async def delete(self, *, bucket_name: str = "", key: str = "") -> "StorageDeleteResponse":
    +
    +    request = StorageDeleteRequest()
    +    request.bucket_name = bucket_name
    +    request.key = key
    +
    +    return await self._unary_unary("/nitric.storage.v1.Storage/Delete", request, StorageDeleteResponse)
    +
    +
    +
    +async def read(self, *, bucket_name: str = '', key: str = '') ‑> StorageReadResponse +
    +
    +
    +
    + +Expand source code + +
    async def read(self, *, bucket_name: str = "", key: str = "") -> "StorageReadResponse":
    +
    +    request = StorageReadRequest()
    +    request.bucket_name = bucket_name
    +    request.key = key
    +
    +    return await self._unary_unary("/nitric.storage.v1.Storage/Read", request, StorageReadResponse)
    +
    +
    +
    +async def write(self, *, bucket_name: str = '', key: str = '', body: bytes = b'') ‑> StorageWriteResponse +
    +
    +
    +
    + +Expand source code + +
    async def write(self, *, bucket_name: str = "", key: str = "", body: bytes = b"") -> "StorageWriteResponse":
    +
    +    request = StorageWriteRequest()
    +    request.bucket_name = bucket_name
    +    request.key = key
    +    request.body = body
    +
    +    return await self._unary_unary("/nitric.storage.v1.Storage/Write", request, StorageWriteResponse)
    +
    +
    +
    +
    +
    +class StorageWriteRequest +(bucket_name: str = <object object>, key: str = <object object>, body: bytes = <object object>) +
    +
    +

    Request to put (create/update) a storage item

    +
    + +Expand source code + +
    class StorageWriteRequest(betterproto.Message):
    +    """Request to put (create/update) a storage item"""
    +
    +    # Nitric name of the bucket to store in  this will be automatically resolved
    +    # to the provider specific bucket identifier.
    +    bucket_name: str = betterproto.string_field(1)
    +    # Key to store the item under
    +    key: str = betterproto.string_field(2)
    +    # bytes array to store
    +    body: bytes = betterproto.bytes_field(3)
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +

    Class variables

    +
    +
    var body : bytes
    +
    +
    +
    +
    var bucket_name : str
    +
    +
    +
    +
    var key : str
    +
    +
    +
    +
    +
    +
    +class StorageWriteResponse +
    +
    +

    Result of putting a storage item

    +
    + +Expand source code + +
    class StorageWriteResponse(betterproto.Message):
    +    """Result of putting a storage item"""
    +
    +    pass
    +
    +

    Ancestors

    +
      +
    • betterproto.Message
    • +
    • abc.ABC
    • +
    +
    +
    +
    +
    + +
    + + + \ No newline at end of file diff --git a/docs/nitric/proto/queue/index.html b/docs/nitric/proto/queue/index.html deleted file mode 100644 index 6a565bf..0000000 --- a/docs/nitric/proto/queue/index.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - -nitric.proto.queue API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.queue

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -
    -
    -

    Sub-modules

    -
    -
    nitric.proto.queue.v1
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/queue/v1/index.html b/docs/nitric/proto/queue/v1/index.html deleted file mode 100644 index da1c281..0000000 --- a/docs/nitric/proto/queue/v1/index.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - -nitric.proto.queue.v1 API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.queue.v1

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -
    -
    -

    Sub-modules

    -
    -
    nitric.proto.queue.v1.queue_pb2
    -
    -

    Generated protocol buffer code.

    -
    -
    nitric.proto.queue.v1.queue_pb2_grpc
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/queue/v1/queue_pb2_grpc.html b/docs/nitric/proto/queue/v1/queue_pb2_grpc.html deleted file mode 100644 index eb3e16c..0000000 --- a/docs/nitric/proto/queue/v1/queue_pb2_grpc.html +++ /dev/null @@ -1,677 +0,0 @@ - - - - - - -nitric.proto.queue.v1.queue_pb2_grpc API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.queue.v1.queue_pb2_grpc

    -
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
    -"""Client and server classes corresponding to protobuf-defined services."""
    -import grpc
    -
    -from nitric.proto.queue.v1 import queue_pb2 as queue_dot_v1_dot_queue__pb2
    -
    -
    -class QueueStub(object):
    -    """The Nitric Queue Service contract
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Send = channel.unary_unary(
    -                '/nitric.queue.v1.Queue/Send',
    -                request_serializer=queue_dot_v1_dot_queue__pb2.QueueSendRequest.SerializeToString,
    -                response_deserializer=queue_dot_v1_dot_queue__pb2.QueueSendResponse.FromString,
    -                )
    -        self.SendBatch = channel.unary_unary(
    -                '/nitric.queue.v1.Queue/SendBatch',
    -                request_serializer=queue_dot_v1_dot_queue__pb2.QueueSendBatchRequest.SerializeToString,
    -                response_deserializer=queue_dot_v1_dot_queue__pb2.QueueSendBatchResponse.FromString,
    -                )
    -        self.Receive = channel.unary_unary(
    -                '/nitric.queue.v1.Queue/Receive',
    -                request_serializer=queue_dot_v1_dot_queue__pb2.QueueReceiveRequest.SerializeToString,
    -                response_deserializer=queue_dot_v1_dot_queue__pb2.QueueReceiveResponse.FromString,
    -                )
    -        self.Complete = channel.unary_unary(
    -                '/nitric.queue.v1.Queue/Complete',
    -                request_serializer=queue_dot_v1_dot_queue__pb2.QueueCompleteRequest.SerializeToString,
    -                response_deserializer=queue_dot_v1_dot_queue__pb2.QueueCompleteResponse.FromString,
    -                )
    -
    -
    -class QueueServicer(object):
    -    """The Nitric Queue Service contract
    -    """
    -
    -    def Send(self, request, context):
    -        """Send a single event to a queue
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def SendBatch(self, request, context):
    -        """Send multiple events to a queue
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Receive(self, request, context):
    -        """Receive event(s) off a queue
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Complete(self, request, context):
    -        """Complete an event previously popped from a queue
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -
    -def add_QueueServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Send': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Send,
    -                    request_deserializer=queue_dot_v1_dot_queue__pb2.QueueSendRequest.FromString,
    -                    response_serializer=queue_dot_v1_dot_queue__pb2.QueueSendResponse.SerializeToString,
    -            ),
    -            'SendBatch': grpc.unary_unary_rpc_method_handler(
    -                    servicer.SendBatch,
    -                    request_deserializer=queue_dot_v1_dot_queue__pb2.QueueSendBatchRequest.FromString,
    -                    response_serializer=queue_dot_v1_dot_queue__pb2.QueueSendBatchResponse.SerializeToString,
    -            ),
    -            'Receive': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Receive,
    -                    request_deserializer=queue_dot_v1_dot_queue__pb2.QueueReceiveRequest.FromString,
    -                    response_serializer=queue_dot_v1_dot_queue__pb2.QueueReceiveResponse.SerializeToString,
    -            ),
    -            'Complete': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Complete,
    -                    request_deserializer=queue_dot_v1_dot_queue__pb2.QueueCompleteRequest.FromString,
    -                    response_serializer=queue_dot_v1_dot_queue__pb2.QueueCompleteResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.queue.v1.Queue', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    - # This class is part of an EXPERIMENTAL API.
    -class Queue(object):
    -    """The Nitric Queue Service contract
    -    """
    -
    -    @staticmethod
    -    def Send(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Send',
    -            queue_dot_v1_dot_queue__pb2.QueueSendRequest.SerializeToString,
    -            queue_dot_v1_dot_queue__pb2.QueueSendResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def SendBatch(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/SendBatch',
    -            queue_dot_v1_dot_queue__pb2.QueueSendBatchRequest.SerializeToString,
    -            queue_dot_v1_dot_queue__pb2.QueueSendBatchResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Receive(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Receive',
    -            queue_dot_v1_dot_queue__pb2.QueueReceiveRequest.SerializeToString,
    -            queue_dot_v1_dot_queue__pb2.QueueReceiveResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Complete(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Complete',
    -            queue_dot_v1_dot_queue__pb2.QueueCompleteRequest.SerializeToString,
    -            queue_dot_v1_dot_queue__pb2.QueueCompleteResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -
    -
    -

    Functions

    -
    -
    -def add_QueueServicer_to_server(servicer, server) -
    -
    -
    -
    - -Expand source code - -
    def add_QueueServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Send': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Send,
    -                    request_deserializer=queue_dot_v1_dot_queue__pb2.QueueSendRequest.FromString,
    -                    response_serializer=queue_dot_v1_dot_queue__pb2.QueueSendResponse.SerializeToString,
    -            ),
    -            'SendBatch': grpc.unary_unary_rpc_method_handler(
    -                    servicer.SendBatch,
    -                    request_deserializer=queue_dot_v1_dot_queue__pb2.QueueSendBatchRequest.FromString,
    -                    response_serializer=queue_dot_v1_dot_queue__pb2.QueueSendBatchResponse.SerializeToString,
    -            ),
    -            'Receive': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Receive,
    -                    request_deserializer=queue_dot_v1_dot_queue__pb2.QueueReceiveRequest.FromString,
    -                    response_serializer=queue_dot_v1_dot_queue__pb2.QueueReceiveResponse.SerializeToString,
    -            ),
    -            'Complete': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Complete,
    -                    request_deserializer=queue_dot_v1_dot_queue__pb2.QueueCompleteRequest.FromString,
    -                    response_serializer=queue_dot_v1_dot_queue__pb2.QueueCompleteResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.queue.v1.Queue', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class Queue -
    -
    -

    The Nitric Queue Service contract

    -
    - -Expand source code - -
    class Queue(object):
    -    """The Nitric Queue Service contract
    -    """
    -
    -    @staticmethod
    -    def Send(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Send',
    -            queue_dot_v1_dot_queue__pb2.QueueSendRequest.SerializeToString,
    -            queue_dot_v1_dot_queue__pb2.QueueSendResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def SendBatch(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/SendBatch',
    -            queue_dot_v1_dot_queue__pb2.QueueSendBatchRequest.SerializeToString,
    -            queue_dot_v1_dot_queue__pb2.QueueSendBatchResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Receive(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Receive',
    -            queue_dot_v1_dot_queue__pb2.QueueReceiveRequest.SerializeToString,
    -            queue_dot_v1_dot_queue__pb2.QueueReceiveResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Complete(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Complete',
    -            queue_dot_v1_dot_queue__pb2.QueueCompleteRequest.SerializeToString,
    -            queue_dot_v1_dot_queue__pb2.QueueCompleteResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -

    Static methods

    -
    -
    -def Complete(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Complete(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Complete',
    -        queue_dot_v1_dot_queue__pb2.QueueCompleteRequest.SerializeToString,
    -        queue_dot_v1_dot_queue__pb2.QueueCompleteResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -def Receive(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Receive(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Receive',
    -        queue_dot_v1_dot_queue__pb2.QueueReceiveRequest.SerializeToString,
    -        queue_dot_v1_dot_queue__pb2.QueueReceiveResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -def Send(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Send(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/Send',
    -        queue_dot_v1_dot_queue__pb2.QueueSendRequest.SerializeToString,
    -        queue_dot_v1_dot_queue__pb2.QueueSendResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -def SendBatch(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def SendBatch(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.queue.v1.Queue/SendBatch',
    -        queue_dot_v1_dot_queue__pb2.QueueSendBatchRequest.SerializeToString,
    -        queue_dot_v1_dot_queue__pb2.QueueSendBatchResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -class QueueServicer -
    -
    -

    The Nitric Queue Service contract

    -
    - -Expand source code - -
    class QueueServicer(object):
    -    """The Nitric Queue Service contract
    -    """
    -
    -    def Send(self, request, context):
    -        """Send a single event to a queue
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def SendBatch(self, request, context):
    -        """Send multiple events to a queue
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Receive(self, request, context):
    -        """Receive event(s) off a queue
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Complete(self, request, context):
    -        """Complete an event previously popped from a queue
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -

    Methods

    -
    -
    -def Complete(self, request, context) -
    -
    -

    Complete an event previously popped from a queue

    -
    - -Expand source code - -
    def Complete(self, request, context):
    -    """Complete an event previously popped from a queue
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -def Receive(self, request, context) -
    -
    -

    Receive event(s) off a queue

    -
    - -Expand source code - -
    def Receive(self, request, context):
    -    """Receive event(s) off a queue
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -def Send(self, request, context) -
    -
    -

    Send a single event to a queue

    -
    - -Expand source code - -
    def Send(self, request, context):
    -    """Send a single event to a queue
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -def SendBatch(self, request, context) -
    -
    -

    Send multiple events to a queue

    -
    - -Expand source code - -
    def SendBatch(self, request, context):
    -    """Send multiple events to a queue
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -
    -
    -class QueueStub -(channel) -
    -
    -

    The Nitric Queue Service contract

    -

    Constructor.

    -

    Args

    -
    -
    channel
    -
    A grpc.Channel.
    -
    -
    - -Expand source code - -
    class QueueStub(object):
    -    """The Nitric Queue Service contract
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Send = channel.unary_unary(
    -                '/nitric.queue.v1.Queue/Send',
    -                request_serializer=queue_dot_v1_dot_queue__pb2.QueueSendRequest.SerializeToString,
    -                response_deserializer=queue_dot_v1_dot_queue__pb2.QueueSendResponse.FromString,
    -                )
    -        self.SendBatch = channel.unary_unary(
    -                '/nitric.queue.v1.Queue/SendBatch',
    -                request_serializer=queue_dot_v1_dot_queue__pb2.QueueSendBatchRequest.SerializeToString,
    -                response_deserializer=queue_dot_v1_dot_queue__pb2.QueueSendBatchResponse.FromString,
    -                )
    -        self.Receive = channel.unary_unary(
    -                '/nitric.queue.v1.Queue/Receive',
    -                request_serializer=queue_dot_v1_dot_queue__pb2.QueueReceiveRequest.SerializeToString,
    -                response_deserializer=queue_dot_v1_dot_queue__pb2.QueueReceiveResponse.FromString,
    -                )
    -        self.Complete = channel.unary_unary(
    -                '/nitric.queue.v1.Queue/Complete',
    -                request_serializer=queue_dot_v1_dot_queue__pb2.QueueCompleteRequest.SerializeToString,
    -                response_deserializer=queue_dot_v1_dot_queue__pb2.QueueCompleteResponse.FromString,
    -                )
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/storage/index.html b/docs/nitric/proto/storage/index.html deleted file mode 100644 index d1ed0ae..0000000 --- a/docs/nitric/proto/storage/index.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - -nitric.proto.storage API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.storage

    -
    -
    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -
    -
    -

    Sub-modules

    -
    -
    nitric.proto.storage.v1
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/storage/v1/storage_pb2_grpc.html b/docs/nitric/proto/storage/v1/storage_pb2_grpc.html deleted file mode 100644 index 89c8bcb..0000000 --- a/docs/nitric/proto/storage/v1/storage_pb2_grpc.html +++ /dev/null @@ -1,563 +0,0 @@ - - - - - - -nitric.proto.storage.v1.storage_pb2_grpc API documentation - - - - - - - - - - - -
    -
    -
    -

    Module nitric.proto.storage.v1.storage_pb2_grpc

    -
    -
    -

    Client and server classes corresponding to protobuf-defined services.

    -
    - -Expand source code - -
    #
    -# Copyright (c) 2021 Nitric Technologies Pty Ltd.
    -#
    -# This file is part of Nitric Python 3 SDK.
    -# See https://github.com/nitrictech/python-sdk for further info.
    -#
    -# Licensed under the Apache License, Version 2.0 (the "License");
    -# you may not use this file except in compliance with the License.
    -# You may obtain a copy of the License at
    -#
    -#     http://www.apache.org/licenses/LICENSE-2.0
    -#
    -# Unless required by applicable law or agreed to in writing, software
    -# distributed under the License is distributed on an "AS IS" BASIS,
    -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    -# See the License for the specific language governing permissions and
    -# limitations under the License.
    -#
    -
    -# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
    -"""Client and server classes corresponding to protobuf-defined services."""
    -import grpc
    -
    -from nitric.proto.storage.v1 import storage_pb2 as storage_dot_v1_dot_storage__pb2
    -
    -
    -class StorageStub(object):
    -    """Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Read = channel.unary_unary(
    -                '/nitric.storage.v1.Storage/Read',
    -                request_serializer=storage_dot_v1_dot_storage__pb2.StorageReadRequest.SerializeToString,
    -                response_deserializer=storage_dot_v1_dot_storage__pb2.StorageReadResponse.FromString,
    -                )
    -        self.Write = channel.unary_unary(
    -                '/nitric.storage.v1.Storage/Write',
    -                request_serializer=storage_dot_v1_dot_storage__pb2.StorageWriteRequest.SerializeToString,
    -                response_deserializer=storage_dot_v1_dot_storage__pb2.StorageWriteResponse.FromString,
    -                )
    -        self.Delete = channel.unary_unary(
    -                '/nitric.storage.v1.Storage/Delete',
    -                request_serializer=storage_dot_v1_dot_storage__pb2.StorageDeleteRequest.SerializeToString,
    -                response_deserializer=storage_dot_v1_dot_storage__pb2.StorageDeleteResponse.FromString,
    -                )
    -
    -
    -class StorageServicer(object):
    -    """Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.
    -    """
    -
    -    def Read(self, request, context):
    -        """Retrieve an item from a bucket
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Write(self, request, context):
    -        """Store an item to a bucket
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Delete(self, request, context):
    -        """Delete an item from a bucket
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -
    -def add_StorageServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Read': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Read,
    -                    request_deserializer=storage_dot_v1_dot_storage__pb2.StorageReadRequest.FromString,
    -                    response_serializer=storage_dot_v1_dot_storage__pb2.StorageReadResponse.SerializeToString,
    -            ),
    -            'Write': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Write,
    -                    request_deserializer=storage_dot_v1_dot_storage__pb2.StorageWriteRequest.FromString,
    -                    response_serializer=storage_dot_v1_dot_storage__pb2.StorageWriteResponse.SerializeToString,
    -            ),
    -            'Delete': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Delete,
    -                    request_deserializer=storage_dot_v1_dot_storage__pb2.StorageDeleteRequest.FromString,
    -                    response_serializer=storage_dot_v1_dot_storage__pb2.StorageDeleteResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.storage.v1.Storage', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    - # This class is part of an EXPERIMENTAL API.
    -class Storage(object):
    -    """Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.
    -    """
    -
    -    @staticmethod
    -    def Read(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Read',
    -            storage_dot_v1_dot_storage__pb2.StorageReadRequest.SerializeToString,
    -            storage_dot_v1_dot_storage__pb2.StorageReadResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Write(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Write',
    -            storage_dot_v1_dot_storage__pb2.StorageWriteRequest.SerializeToString,
    -            storage_dot_v1_dot_storage__pb2.StorageWriteResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Delete(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Delete',
    -            storage_dot_v1_dot_storage__pb2.StorageDeleteRequest.SerializeToString,
    -            storage_dot_v1_dot_storage__pb2.StorageDeleteResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -
    -
    -

    Functions

    -
    -
    -def add_StorageServicer_to_server(servicer, server) -
    -
    -
    -
    - -Expand source code - -
    def add_StorageServicer_to_server(servicer, server):
    -    rpc_method_handlers = {
    -            'Read': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Read,
    -                    request_deserializer=storage_dot_v1_dot_storage__pb2.StorageReadRequest.FromString,
    -                    response_serializer=storage_dot_v1_dot_storage__pb2.StorageReadResponse.SerializeToString,
    -            ),
    -            'Write': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Write,
    -                    request_deserializer=storage_dot_v1_dot_storage__pb2.StorageWriteRequest.FromString,
    -                    response_serializer=storage_dot_v1_dot_storage__pb2.StorageWriteResponse.SerializeToString,
    -            ),
    -            'Delete': grpc.unary_unary_rpc_method_handler(
    -                    servicer.Delete,
    -                    request_deserializer=storage_dot_v1_dot_storage__pb2.StorageDeleteRequest.FromString,
    -                    response_serializer=storage_dot_v1_dot_storage__pb2.StorageDeleteResponse.SerializeToString,
    -            ),
    -    }
    -    generic_handler = grpc.method_handlers_generic_handler(
    -            'nitric.storage.v1.Storage', rpc_method_handlers)
    -    server.add_generic_rpc_handlers((generic_handler,))
    -
    -
    -
    -
    -
    -

    Classes

    -
    -
    -class Storage -
    -
    -

    Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.

    -
    - -Expand source code - -
    class Storage(object):
    -    """Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.
    -    """
    -
    -    @staticmethod
    -    def Read(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Read',
    -            storage_dot_v1_dot_storage__pb2.StorageReadRequest.SerializeToString,
    -            storage_dot_v1_dot_storage__pb2.StorageReadResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Write(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Write',
    -            storage_dot_v1_dot_storage__pb2.StorageWriteRequest.SerializeToString,
    -            storage_dot_v1_dot_storage__pb2.StorageWriteResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -    @staticmethod
    -    def Delete(request,
    -            target,
    -            options=(),
    -            channel_credentials=None,
    -            call_credentials=None,
    -            insecure=False,
    -            compression=None,
    -            wait_for_ready=None,
    -            timeout=None,
    -            metadata=None):
    -        return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Delete',
    -            storage_dot_v1_dot_storage__pb2.StorageDeleteRequest.SerializeToString,
    -            storage_dot_v1_dot_storage__pb2.StorageDeleteResponse.FromString,
    -            options, channel_credentials,
    -            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -

    Static methods

    -
    -
    -def Delete(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Delete(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Delete',
    -        storage_dot_v1_dot_storage__pb2.StorageDeleteRequest.SerializeToString,
    -        storage_dot_v1_dot_storage__pb2.StorageDeleteResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -def Read(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Read(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Read',
    -        storage_dot_v1_dot_storage__pb2.StorageReadRequest.SerializeToString,
    -        storage_dot_v1_dot_storage__pb2.StorageReadResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -def Write(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None) -
    -
    -
    -
    - -Expand source code - -
    @staticmethod
    -def Write(request,
    -        target,
    -        options=(),
    -        channel_credentials=None,
    -        call_credentials=None,
    -        insecure=False,
    -        compression=None,
    -        wait_for_ready=None,
    -        timeout=None,
    -        metadata=None):
    -    return grpc.experimental.unary_unary(request, target, '/nitric.storage.v1.Storage/Write',
    -        storage_dot_v1_dot_storage__pb2.StorageWriteRequest.SerializeToString,
    -        storage_dot_v1_dot_storage__pb2.StorageWriteResponse.FromString,
    -        options, channel_credentials,
    -        insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
    -
    -
    -
    -
    -
    -class StorageServicer -
    -
    -

    Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.

    -
    - -Expand source code - -
    class StorageServicer(object):
    -    """Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.
    -    """
    -
    -    def Read(self, request, context):
    -        """Retrieve an item from a bucket
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Write(self, request, context):
    -        """Store an item to a bucket
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -    def Delete(self, request, context):
    -        """Delete an item from a bucket
    -        """
    -        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -        context.set_details('Method not implemented!')
    -        raise NotImplementedError('Method not implemented!')
    -
    -

    Methods

    -
    -
    -def Delete(self, request, context) -
    -
    -

    Delete an item from a bucket

    -
    - -Expand source code - -
    def Delete(self, request, context):
    -    """Delete an item from a bucket
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -def Read(self, request, context) -
    -
    -

    Retrieve an item from a bucket

    -
    - -Expand source code - -
    def Read(self, request, context):
    -    """Retrieve an item from a bucket
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -def Write(self, request, context) -
    -
    -

    Store an item to a bucket

    -
    - -Expand source code - -
    def Write(self, request, context):
    -    """Store an item to a bucket
    -    """
    -    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    -    context.set_details('Method not implemented!')
    -    raise NotImplementedError('Method not implemented!')
    -
    -
    -
    -
    -
    -class StorageStub -(channel) -
    -
    -

    Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.

    -

    Constructor.

    -

    Args

    -
    -
    channel
    -
    A grpc.Channel.
    -
    -
    - -Expand source code - -
    class StorageStub(object):
    -    """Services for storage and retrieval of files in the form of byte arrays, such as text and binary files.
    -    """
    -
    -    def __init__(self, channel):
    -        """Constructor.
    -
    -        Args:
    -            channel: A grpc.Channel.
    -        """
    -        self.Read = channel.unary_unary(
    -                '/nitric.storage.v1.Storage/Read',
    -                request_serializer=storage_dot_v1_dot_storage__pb2.StorageReadRequest.SerializeToString,
    -                response_deserializer=storage_dot_v1_dot_storage__pb2.StorageReadResponse.FromString,
    -                )
    -        self.Write = channel.unary_unary(
    -                '/nitric.storage.v1.Storage/Write',
    -                request_serializer=storage_dot_v1_dot_storage__pb2.StorageWriteRequest.SerializeToString,
    -                response_deserializer=storage_dot_v1_dot_storage__pb2.StorageWriteResponse.FromString,
    -                )
    -        self.Delete = channel.unary_unary(
    -                '/nitric.storage.v1.Storage/Delete',
    -                request_serializer=storage_dot_v1_dot_storage__pb2.StorageDeleteRequest.SerializeToString,
    -                response_deserializer=storage_dot_v1_dot_storage__pb2.StorageDeleteResponse.FromString,
    -                )
    -
    -
    -
    -
    -
    - -
    - - - \ No newline at end of file diff --git a/docs/nitric/proto/storage/v1/index.html b/docs/nitric/utils.html similarity index 64% rename from docs/nitric/proto/storage/v1/index.html rename to docs/nitric/utils.html index 7e7a385..1b9a4ab 100644 --- a/docs/nitric/proto/storage/v1/index.html +++ b/docs/nitric/utils.html @@ -4,7 +4,7 @@ -nitric.proto.storage.v1 API documentation +nitric.utils API documentation @@ -19,7 +19,7 @@
    -

    Module nitric.proto.storage.v1

    +

    Module nitric.utils

    @@ -43,28 +43,96 @@

    Module nitric.proto.storage.v1

    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# +# +import re +from betterproto.lib.google.protobuf import Struct +from google.protobuf.json_format import MessageToDict +from google.protobuf.struct_pb2 import Struct as WorkingStruct +from nitric.config import settings +from urllib.parse import urlparse +from grpclib.client import Channel + + +def format_url(url: str): + """Add the default http scheme prefix to urls without one.""" + if not re.match("^((?:http|ftp|https):)?//", url.lower()): + return "http://{0}".format(url) + return url + + +def new_default_channel(): + """Create new gRPC channel from settings.""" + channel_url = urlparse(format_url(settings.SERVICE_BIND)) + return Channel(host=channel_url.hostname, port=channel_url.port) + + +# These functions convert to/from python dict <-> betterproto.lib.google.protobuf.Struct +# the existing Struct().from_dict() method doesn't work for Structs, +# it relies on Message meta information, that isn't available for dynamic structs. +def _dict_from_struct(struct: Struct) -> dict: + """Construct a dict from a Struct.""" + # Convert the bytes representation of the betterproto Struct into a protobuf Struct + # in order to use the MessageToDict function to safely create a dict. + gpb_struct = WorkingStruct() + gpb_struct.ParseFromString(bytes(struct)) + return MessageToDict(gpb_struct) + + +def _struct_from_dict(dictionary: dict) -> Struct: + """Construct a Struct from a dict.""" + # Convert to dict into a Struct class from the protobuf library + # since protobuf Structs are able to be created from a dict + # unlike the Struct class from betterproto. + gpb_struct = WorkingStruct() + gpb_struct.update(dictionary) + # Convert the bytes representation of the protobuf Struct into the betterproto Struct + # so that the returned Struct is compatible with other betterproto generated classes + struct = Struct().parse(gpb_struct.SerializeToString()) + return struct
    -

    Sub-modules

    +
    +
    +
    +
    +

    Functions

    -
    nitric.proto.storage.v1.storage_pb2
    +
    +def format_url(url: str) +
    -

    Generated protocol buffer code.

    +

    Add the default http scheme prefix to urls without one.

    +
    + +Expand source code + +
    def format_url(url: str):
    +    """Add the default http scheme prefix to urls without one."""
    +    if not re.match("^((?:http|ftp|https):)?//", url.lower()):
    +        return "http://{0}".format(url)
    +    return url
    +
    -
    nitric.proto.storage.v1.storage_pb2_grpc
    +
    +def new_default_channel() +
    -

    Client and server classes corresponding to protobuf-defined services.

    +

    Create new gRPC channel from settings.

    +
    + +Expand source code + +
    def new_default_channel():
    +    """Create new gRPC channel from settings."""
    +    channel_url = urlparse(format_url(settings.SERVICE_BIND))
    +    return Channel(host=channel_url.hostname, port=channel_url.port)
    +
    -
    -
    -
    -